Skip to content

Commit 354666a

Browse files
committed
112
1 parent 9a936a5 commit 354666a

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

OpenFlowNodeRED/src/nodered/nodes/workflow_nodes.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,16 @@ export class workflow_in_node {
193193
if (!NoderedUtil.IsNullUndefinded(Config.queue_prefix)) {
194194
queue = Config.queue_prefix + this.config.queue;
195195
}
196+
197+
var who = WebSocketClient.instance.user;
198+
196199
var jwt = data.jwt;
197200
delete data.jwt;
198201
var who = WebSocketClient.instance.user;
199-
var res2 = await NoderedUtil.InsertOne("workflow_instances",
200-
{ _type: "instance", "queue": queue, "name": this.workflow.name, payload: data, workflow: this.workflow._id, targetid: who._id }, 1, true, jwt);
202+
var item: Base = ({ _type: "instance", "queue": queue, "name": this.workflow.name, payload: data, workflow: this.workflow._id, targetid: who._id }) as any;
203+
item = Base.assign(item);
204+
item.addRight(who._id, who.name, [-1]);
205+
var res2 = await NoderedUtil.InsertOne("workflow_instances", item, 1, true, jwt);
201206

202207
// Logger.instanse.info("workflow in activated creating a new workflow instance with id " + res2._id);
203208
// OpenFlow Controller.ts needs the id, when creating a new intance !
@@ -511,14 +516,11 @@ export class assign_workflow_node {
511516
var state = res[0].state;
512517
var _parentid = res[0].parentid;
513518
if (_parentid !== null && _parentid !== undefined && _parentid !== "") {
514-
res = await NoderedUtil.Query("workflow_instances", { "_id": _parentid }, null, null, 1, 0, data.jwt);
519+
res = await NoderedUtil.Query("workflow_instances", { "_id": _parentid }, null, null, 1, 0, null);
515520
if (res.length == 0) {
516-
res = await NoderedUtil.Query("workflow_instances", { "_id": _parentid }, null, null, 1, 0, null);
517-
if (res.length == 0) {
518-
NoderedUtil.HandleError(this, "Unknown workflow_instances parentid " + _id);
519-
if (ack !== null && ack !== undefined) ack();
520-
return;
521-
}
521+
NoderedUtil.HandleError(this, "Unknown workflow_instances parentid " + _id);
522+
if (ack !== null && ack !== undefined) ack();
523+
return;
522524
}
523525

524526
res[0].state = state;

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.509
1+
0.0.510

0 commit comments

Comments
 (0)