Skip to content

Commit c6f133c

Browse files
committed
add border to robot image
1 parent e8c3cfd commit c6f133c

5 files changed

Lines changed: 26 additions & 31 deletions

File tree

OpenFlowNodeRED/src/nodered/nodes/googleauth_nodes.ts

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,29 @@ const { GoogleAuth, OAuth2Client } = require('google-auth-library');
55
var fs = require("fs");
66
const request = require('request');
77

8+
function GetGoogleAuthClient(config: Igoogleauth_credentials): any {
9+
if (config != null) {
10+
if (typeof config.serviceaccount === "string" && !NoderedUtil.IsNullEmpty(config.serviceaccount)) {
11+
config.serviceaccount = JSON.parse(config.serviceaccount);
12+
}
13+
if (!NoderedUtil.IsNullEmpty(config.serviceaccount)) {
14+
this.auth = new GoogleAuth({
15+
scopes: config.scopes,
16+
credentials: config.serviceaccount
17+
});
18+
}
19+
if (!NoderedUtil.IsNullEmpty(config.clientid) || !NoderedUtil.IsNullEmpty(config.clientsecret) || !NoderedUtil.IsNullEmpty(config.redirecturi)) {
20+
this.Client = new OAuth2Client(
21+
config.clientid,
22+
config.clientsecret,
23+
config.redirecturi
24+
);
25+
if (!NoderedUtil.IsNullEmpty(config.tokens)) {
26+
this.Client.setCredentials(JSON.parse(config.tokens));
27+
}
28+
}
29+
}
30+
}
831

932
export interface Igoogleauth_credentials {
1033
name: string;
@@ -166,41 +189,14 @@ export class googleauth_request {
166189
this._config = RED.nodes.getNode(this.config.config);
167190
this.method = this.config.method;
168191
this.url = this.config.url;
169-
this.init();
192+
this.Client = GetGoogleAuthClient(this._config);
170193
this.node.on('input', this.oninput);
171-
} catch (error) {
172-
NoderedUtil.HandleError(this, error);
173-
}
174-
}
175-
init() {
176-
try {
177-
if (this._config != null) {
178-
if (typeof this._config.serviceaccount === "string" && !NoderedUtil.IsNullEmpty(this._config.serviceaccount)) {
179-
this._config.serviceaccount = JSON.parse(this._config.serviceaccount);
180-
}
181-
if (!NoderedUtil.IsNullEmpty(this._config.serviceaccount)) {
182-
this.auth = new GoogleAuth({
183-
scopes: this._config.scopes,
184-
credentials: this._config.serviceaccount
185-
});
186-
}
187-
if (!NoderedUtil.IsNullEmpty(this._config.clientid) || !NoderedUtil.IsNullEmpty(this._config.clientsecret) || !NoderedUtil.IsNullEmpty(this._config.redirecturi)) {
188-
this.Client = new OAuth2Client(
189-
this._config.clientid,
190-
this._config.clientsecret,
191-
this._config.redirecturi
192-
);
193-
if (!NoderedUtil.IsNullEmpty(this._config.tokens)) {
194-
this.Client.setCredentials(JSON.parse(this._config.tokens));
195-
}
196-
}
197-
}
198194
this.node.status({});
199195
} catch (error) {
200196
NoderedUtil.HandleError(this, error);
201-
202197
}
203198
}
199+
204200
async oninput(msg: any, send: any, done: any) {
205201
try {
206202
this.node.status({ fill: "blue", shape: "dot", text: "Getting client" });
2.55 KB
Loading
-819 Bytes
Loading

OpenFlowNodeRED/src/nodered/nodes/rpa.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102
},
103103
inputs: 1,
104104
outputs: 3,
105-
align: "right",
106105
outputLabels: ["completed", "status", "failed"],
107106
label: function () {
108107
return this.name || "rpa workflow";

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.545
1+
0.0.546

0 commit comments

Comments
 (0)