@@ -99,14 +99,13 @@ module openflow {
9999 this . loadData ( ) ;
100100 } ) ;
101101 }
102-
103102 async loadData ( ) : Promise < void > {
104103 this . loading = true ;
105104 this . charts = [ ] ;
106105 var chart : chartset = null ;
107106 console . log ( "get workflows" ) ;
108107 this . models = await this . api . Query ( "openrpa" , { _type : "workflow" } , null , null ) ;
109-
108+ if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
110109 for ( var i = 0 ; i < this . models . length ; i ++ ) {
111110 var workflow = this . models [ i ] as any ;
112111 var d = new Date ( ) ;
@@ -194,21 +193,13 @@ module openflow {
194193 public api : api
195194 ) {
196195 super ( $scope , $location , $routeParams , WebSocketClient , api ) ;
196+ this . collection = "workflow" ;
197+ this . basequery = { _type : "workflow" , web : true } ;
197198 console . debug ( "WorkflowsCtrl" ) ;
198199 WebSocketClient . onSignedin ( ( user : TokenUser ) => {
199- this . loadData ( ) ;
200+ this . _loadData ( ) ;
200201 } ) ;
201202 }
202-
203- async loadData ( ) : Promise < void > {
204- this . loading = true ;
205- this . charts = [ ] ;
206- var chart : chartset = null ;
207- console . log ( "get workflows" ) ;
208- this . models = await this . api . Query ( "workflow" , { _type : "workflow" , web : true } , null , null ) ;
209- this . loading = false ;
210- if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
211- }
212203 }
213204
214205
@@ -243,7 +234,6 @@ module openflow {
243234 this . loadData ( ) ;
244235 } ) ;
245236 }
246-
247237 async loadData ( ) : Promise < void > {
248238 this . loading = true ;
249239 this . charts = [ ] ;
@@ -393,7 +383,7 @@ module openflow {
393383 this . collection = "workflow_instances"
394384 this . basequery = { state : { $ne : "completed" } , form : { $exists : true } } ;
395385 WebSocketClient . onSignedin ( ( _user : TokenUser ) => {
396- this . loadData ( ) ;
386+ this . _loadData ( ) ;
397387 } ) ;
398388 }
399389 }
@@ -629,7 +619,7 @@ module openflow {
629619 this . basequery = { _type : "provider" } ;
630620 this . collection = "config" ;
631621 WebSocketClient . onSignedin ( ( user : TokenUser ) => {
632- this . loadData ( ) ;
622+ this . _loadData ( ) ;
633623 } ) ;
634624 }
635625 async DeleteOne ( model : any ) : Promise < any > {
@@ -689,23 +679,19 @@ module openflow {
689679 this . collection = "users" ;
690680 WebSocketClient . onSignedin ( ( user : TokenUser ) => {
691681 this . loadData ( ) ;
692- this . _loadData ( ) ;
693682 } ) ;
694-
695683 }
696- async _loadData ( ) : Promise < void > {
684+ async loadData ( ) : Promise < void > {
697685 this . loading = true ;
698686 var chart : chartset = null ;
699687 console . log ( "get users" ) ;
700688 this . models = await this . api . Query ( "users" , { _type : "user" } , null , null ) ;
701-
689+ if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
702690 for ( var i = 0 ; i < this . models . length ; i ++ ) {
703691 var user = this . models [ i ] as any ;
704692 var d = new Date ( ) ;
705693 // d.setMonth(d.getMonth() - 1);
706694 d . setDate ( d . getDate ( ) - 7 ) ;
707-
708-
709695 console . log ( "get mapreduce for " + user . name ) ;
710696 var stats = await this . api . MapReduce ( "audit" ,
711697 function map ( ) {
@@ -828,7 +814,7 @@ module openflow {
828814 this . basequery = { _type : "role" } ;
829815 this . collection = "users" ;
830816 WebSocketClient . onSignedin ( ( user : TokenUser ) => {
831- this . loadData ( ) ;
817+ this . _loadData ( ) ;
832818 } ) ;
833819 }
834820 async DeleteOne ( model : any ) : Promise < any > {
@@ -999,7 +985,6 @@ module openflow {
999985
1000986
1001987 export class EntitiesCtrl extends entitiesCtrl < openflow . Base > {
1002-
1003988 constructor (
1004989 public $scope : ng . IScope ,
1005990 public $location : ng . ILocationService ,
@@ -1013,7 +998,7 @@ module openflow {
1013998 this . collection = $routeParams . collection ;
1014999 this . baseprojection = { _type : 1 , type : 1 , name : 1 , _created : 1 , _createdby : 1 , _modified : 1 } ;
10151000 WebSocketClient . onSignedin ( ( user : TokenUser ) => {
1016- this . loadData ( ) ;
1001+ this . _loadData ( ) ;
10171002 } ) ;
10181003 }
10191004 async DeleteOne ( model : any ) : Promise < any > {
@@ -1055,7 +1040,7 @@ module openflow {
10551040 this . collection = "forms" ;
10561041 this . baseprojection = { _type : 1 , type : 1 , name : 1 , _created : 1 , _createdby : 1 , _modified : 1 } ;
10571042 WebSocketClient . onSignedin ( ( user : TokenUser ) => {
1058- this . loadData ( ) ;
1043+ this . _loadData ( ) ;
10591044 } ) ;
10601045 }
10611046 async DeleteOne ( model : any ) : Promise < any > {
@@ -1293,20 +1278,11 @@ module openflow {
12931278 console . debug ( "jslogCtrl" ) ;
12941279 this . collection = "jslog" ;
12951280 this . basequery = { } ;
1281+ this . orderby = { _created : - 1 } ;
12961282 WebSocketClient . onSignedin ( ( user : TokenUser ) => {
1297- this . loadData ( ) ;
1283+ this . _loadData ( ) ;
12981284 } ) ;
12991285 }
1300-
1301- async loadData ( ) : Promise < void > {
1302- this . loading = true ;
1303- this . charts = [ ] ;
1304- var chart : chartset = null ;
1305- console . log ( "get log" ) ;
1306- this . models = await this . api . Query ( "jslog" , { } , null , { _created : - 1 } ) ;
1307- this . loading = false ;
1308- if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
1309- }
13101286 async DeleteMany ( ) : Promise < void > {
13111287 this . loading = true ;
13121288 var Promises : Promise < DeleteOneMessage > [ ] = [ ] ;
@@ -1322,7 +1298,7 @@ module openflow {
13221298 values . forEach ( ( x : DeleteOneMessage ) => ids . push ( x . _id ) ) ;
13231299 this . models = this . models . filter ( function ( m : any ) : boolean { return ids . indexOf ( m . _id ) === - 1 ; } ) ;
13241300 this . loading = false ;
1325- this . loadData ( ) ;
1301+ this . _loadData ( ) ;
13261302 //if (!this.$scope.$$phase) { this.$scope.$apply(); }
13271303 }
13281304
0 commit comments