Skip to content

Commit 5717fde

Browse files
committed
Fix assign workflow
1 parent 7eed226 commit 5717fde

3 files changed

Lines changed: 31 additions & 12 deletions

File tree

OpenFlow/src/DatabaseConnection.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,17 +247,22 @@ export class DatabaseConnection extends events.EventEmitter {
247247
workflowid: wiq.workflowid,
248248
data: { payload: {} }
249249
}
250+
if ("(Empty)")
250251
if (!NoderedUtil.IsNullEmpty(wiq.robotqueue) && !NoderedUtil.IsNullEmpty(wiq.workflowid)) {
251-
Logger.instanse.verbose("[workitems] Send invoke message to robot queue " + wiq.workflowid);
252-
let expiration = (Config.amqp_requeue_time / 2, 10) | 0;
253-
if (expiration < 500) expiration = 500;
254-
await amqpwrapper.Instance().send(null, wiq.robotqueue, payload, expiration, null, null, 2);
252+
if (wiq.robotqueue.toLowerCase() != "(empty)" && wiq.workflowid.toLowerCase() != "(empty)") {
253+
Logger.instanse.verbose("[workitems] Send invoke message to robot queue " + wiq.workflowid);
254+
let expiration = (Config.amqp_requeue_time / 2, 10) | 0;
255+
if (expiration < 500) expiration = 500;
256+
await amqpwrapper.Instance().send(null, wiq.robotqueue, payload, expiration, null, null, 2);
257+
}
255258
}
256259
if (!NoderedUtil.IsNullEmpty(wiq.amqpqueue)) {
257-
Logger.instanse.verbose("[workitems] Send invoke message to amqp queue " + wiq.amqpqueue);
258-
let expiration = (Config.amqp_requeue_time / 2, 10) | 0;
259-
if (expiration < 500) expiration = 500;
260-
await amqpwrapper.Instance().send(null, wiq.amqpqueue, payload, expiration, null, null, 2);
260+
if (wiq.amqpqueue.toLowerCase() != "(empty)") {
261+
Logger.instanse.verbose("[workitems] Send invoke message to amqp queue " + wiq.amqpqueue);
262+
let expiration = (Config.amqp_requeue_time / 2, 10) | 0;
263+
if (expiration < 500) expiration = 500;
264+
await amqpwrapper.Instance().send(null, wiq.amqpqueue, payload, expiration, null, null, 2);
265+
}
261266
}
262267
}
263268
}

OpenFlow/src/Messages/Message.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ export class Message {
580580
break;
581581
case "createworkflowinstance":
582582
if (!this.EnsureJWT(cli)) break;
583-
// await this.CreateWorkflowInstance(cli, span);
583+
await this.CreateWorkflowInstance(cli, span);
584584
break;
585585
case "stripeaddplan":
586586
if (!this.EnsureJWT(cli)) {
@@ -2392,12 +2392,19 @@ export class Message {
23922392
msg.correlationId = NoderedUtil.GetUniqueIdentifier();
23932393
}
23942394

2395+
(msg as any).payload = msg.data;
2396+
delete msg.data;
2397+
23952398
const _data = Base.assign<Base>(msg as any);
23962399
Base.addRight(_data, msg.targetid, "targetid", [-1]);
23972400
Base.addRight(_data, cli.user._id, cli.user.name, [-1]);
23982401
Base.addRight(_data, tuser._id, tuser.name, [-1]);
23992402
_data._type = "instance";
24002403
_data.name = msg.name;
2404+
(_data as any).state = "new";
2405+
if (!msg.initialrun) {
2406+
(_data as any).form = "unknown";
2407+
}
24012408

24022409
const res2 = await Config.db.InsertOne(_data, "workflow_instances", 1, true, msg.jwt, span);
24032410
msg.newinstanceid = res2._id;
@@ -4271,7 +4278,7 @@ export class Message {
42714278
const nextrun_seconds = Math.round((end - wi.nextrun.getTime()) / 1000);
42724279
if (seconds > 5 && nextrun_seconds >= 0) {
42734280
Config.db.queuemonitoringlastrun = new Date();
4274-
Config.db.queuemonitoring()
4281+
// Config.db.queuemonitoring()
42754282
}
42764283
} catch (error) {
42774284
await handleError(null, error);
@@ -4416,7 +4423,7 @@ export class Message {
44164423
const seconds = Math.round((end - Config.db.queuemonitoringlastrun.getTime()) / 1000);
44174424
if (seconds > 5 && isRelevant) {
44184425
Config.db.queuemonitoringlastrun = new Date();
4419-
Config.db.queuemonitoring()
4426+
// Config.db.queuemonitoring()
44204427
}
44214428
} catch (error) {
44224429
await handleError(null, error);
@@ -4585,7 +4592,7 @@ export class Message {
45854592
const nextrun_seconds = Math.round((end - wi.nextrun.getTime()) / 1000);
45864593
if (seconds > 5 && nextrun_seconds >= 0) {
45874594
Config.db.queuemonitoringlastrun = new Date();
4588-
Config.db.queuemonitoring()
4595+
// Config.db.queuemonitoring()
45894596
}
45904597
}
45914598

OpenFlow/src/public/User.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ <h1 class="pagetitle" translate lib="web">userdetails</h1>
3434
<input type="checkbox" ng-model="ctrl.model.disabled" class="input-md" ng-disabled="ctrl.loading==true" />
3535
</div>
3636
</div>
37+
<div class="form-group" ng-show="ctrl.model.company != '' && ctrl.model.company != null && ctrl.model.company != undefined">
38+
<label for="sid" class="col-sm-2 control-label" translate lib="web">company</label>
39+
<div class="col-sm-4">
40+
<input ng-model="ctrl.model.company" class="form-control input-md" ng-disabled="ctrl.loading==true || (!menuctrl.hasrole('admins') && !menuctrl.hasrole('customer admins') && !menuctrl.hasrole('resellers'))"
41+
/>
42+
</div>
43+
</div>
3744
<div class="form-group" ng-show="ctrl.model.sid != '' && ctrl.model.sid != null && ctrl.model.sid != undefined">
3845
<label for="sid" class="col-sm-2 control-label" translate lib="web">SID</label>
3946
<div class="col-sm-4">

0 commit comments

Comments
 (0)