Skip to content

Commit 665e082

Browse files
committed
Fix edit workitem queue select
1 parent 9e328fd commit 665e082

3 files changed

Lines changed: 25 additions & 16 deletions

File tree

OpenFlow/src/public/Controllers.ts

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7121,21 +7121,10 @@ export class WorkitemQueueCtrl extends entityCtrl<WorkitemQueue> {
71217121
this.postloadData = this.processdata;
71227122
WebSocketClientService.onSignedin(async (user: TokenUser) => {
71237123
try {
7124-
this.projects = await NoderedUtil.Query({ collectionname: "openrpa", query: { "_type": "project" }, projection: { "name": 1 } });
7125-
this.projects.forEach((e: any) => { e.display = e.name });
7126-
this.projects.unshift({ "_id": "", "name": "", "display": "(no project)" } as any);
7127-
this.workflows = await NoderedUtil.Query({ collectionname: "openrpa", query: { "_type": "workflow" }, projection: { "name": 1, "projectandname": 1 }, top: 500 });
7128-
this.workflows.forEach((e: any) => { e.display = e.projectandname });
7129-
this.workflows.unshift({ "_id": "", "name": "", "display": "(no workflow)" } as any);
7130-
this.users = await NoderedUtil.Query({ collectionname: "users", query: { "$or": [{ "_type": "user" }, { "_type": "role", "rparole": true }] }, projection: { "name": 1 }, top: 500 });
7131-
this.users.forEach((e: any) => { e.display = e.name });
7132-
this.users.unshift({ "_id": "", "name": "", "display": "(no robot)" } as any);
7133-
this.amqpqueues = await NoderedUtil.Query({ collectionname: "mq", query: { "_type": "queue" }, projection: { "name": 1 }, top: 500 });
7134-
this.amqpqueues.forEach((e: any) => { e.display = e.name });
7135-
this.amqpqueues.unshift({ "_id": "", "name": "", "display": "(no queue)" } as any);
71367124
if (this.id !== null && this.id !== undefined) {
71377125
await this.loadData();
71387126
} else {
7127+
await this.loadselects();
71397128
this.model = new WorkitemQueue();
71407129
this.model.maxretries = 3;
71417130
this.model.retrydelay = 0;
@@ -7148,12 +7137,31 @@ export class WorkitemQueueCtrl extends entityCtrl<WorkitemQueue> {
71487137
if (!this.$scope.$$phase) { this.$scope.$apply(); }
71497138
});
71507139
}
7151-
processdata() {
7140+
async loadselects() {
7141+
this.projects = await NoderedUtil.Query({ collectionname: "openrpa", query: { "_type": "project" }, projection: { "name": 1 } });
7142+
this.projects.forEach((e: any) => { e.display = e.name });
7143+
this.projects.unshift({ "_id": "", "name": "", "display": "(no project)" } as any);
7144+
let queryas: string = null;
7145+
if (this.model != null) queryas = this.model.robotqueue;
7146+
console.log("queryas", queryas)
7147+
this.workflows = await NoderedUtil.Query({ collectionname: "openrpa", query: { "_type": "workflow" }, projection: { "name": 1, "projectandname": 1 }, top: 500, queryas });
7148+
this.workflows.forEach((e: any) => { e.display = e.projectandname });
7149+
this.workflows.unshift({ "_id": "", "name": "", "display": "(no workflow)" } as any);
7150+
this.users = await NoderedUtil.Query({ collectionname: "users", query: { "$or": [{ "_type": "user" }, { "_type": "role", "rparole": true }] }, projection: { "name": 1 }, top: 500 });
7151+
this.users.forEach((e: any) => { e.display = e.name });
7152+
this.users.unshift({ "_id": "", "name": "", "display": "(no robot)" } as any);
7153+
this.amqpqueues = await NoderedUtil.Query({ collectionname: "mq", query: { "_type": "queue" }, projection: { "name": 1 }, top: 500 });
7154+
this.amqpqueues.forEach((e: any) => { e.display = e.name });
7155+
this.amqpqueues.unshift({ "_id": "", "name": "", "display": "(no queue)" } as any);
7156+
if (!this.$scope.$$phase) { this.$scope.$apply(); }
7157+
}
7158+
async processdata() {
71527159
this.loading = false;
71537160
if (NoderedUtil.IsNullEmpty(this.model.projectid)) this.model.projectid = "";
71547161
if (NoderedUtil.IsNullEmpty(this.model.workflowid)) this.model.workflowid = "";
71557162
if (NoderedUtil.IsNullEmpty(this.model.robotqueue)) this.model.robotqueue = "";
71567163
if (NoderedUtil.IsNullEmpty(this.model.amqpqueue)) this.model.amqpqueue = "";
7164+
await this.loadselects();
71577165
if (!this.$scope.$$phase) { this.$scope.$apply(); }
71587166
}
71597167

OpenFlow/src/public/Entities.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
<thead class="thead-dark">
4444
<tr>
4545
<th scope="col" ng-click="ctrl.ToggleOrder('name')"><b translate lib="web">name</b></th>
46-
<th class="w-100" scope="col" ng-click="ctrl.ToggleOrder('_type')"><b translate lib="web">type</b></th>
47-
<th scope="col" ng-click="ctrl.ToggleOrder('_createdby')"><b translate lib="web">createdby</b></th>
46+
<th class="w-150" scope="col" ng-click="ctrl.ToggleOrder('_type')"><b translate lib="web">type</b></th>
47+
<th class="w-150" ng-click="ctrl.ToggleOrder('_createdby')"><b translate lib="web">createdby</b></th>
4848
<th class="w-100" scope="col" ng-click="ctrl.ToggleOrder('_created')"><b translate lib="web">created</b></th>
4949
<th class="w-100" scope="col" ng-click="ctrl.ToggleOrder('_modified')"><b translate lib="web">updated</b></th>
5050
<th class="w-200"></th>

OpenFlow/src/public/WorkitemQueue.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ <h1 class="pagetitle" translate lib="web">{{ctrl.model.name}}</h1>
4444
<label for="state" class="col-sm-2 control-label" translate lib="web">workflow</label>
4545
<div class="col-sm-4">
4646
<select class="form-control" id="country" ng-model="ctrl.model.workflowid" required="required"
47-
ng-options="item._id as item.display for item in ctrl.workflows | orderBy: 'display'"
47+
ng-options="item.projectandname as item.display for item in ctrl.workflows | orderBy: 'display'"
4848
ng-disabled="ctrl.loading==true">
4949
</select>
5050
</div>
@@ -54,6 +54,7 @@ <h1 class="pagetitle" translate lib="web">{{ctrl.model.name}}</h1>
5454
<div class="col-sm-4">
5555
<select class="form-control" id="country" ng-model="ctrl.model.robotqueue" required="required"
5656
ng-options="item._id as item.display for item in ctrl.users | orderBy: 'display'"
57+
ng-change="ctrl.loadselects()"
5758
ng-disabled="ctrl.loading==true">
5859
</select>
5960
</div>

0 commit comments

Comments
 (0)