@@ -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
0 commit comments