@@ -2646,9 +2646,12 @@ export class NoderedCtrl {
26462646 public user : NoderedUser = null ;
26472647 public limitsmemory : string = "" ;
26482648 public loading : boolean = false ;
2649- public labels : any [ ] = [ ] ;
2649+ public labels : any = { } ;
26502650 public keys : string [ ] = [ ] ;
2651+ public labelkeys : string [ ] = [ ] ;
26512652 public label : any = null ;
2653+ public newkey : string = "" ;
2654+ public newvalue : string = "" ;
26522655 constructor (
26532656 public $scope : ng . IScope ,
26542657 public $location : ng . ILocationService ,
@@ -2689,7 +2692,10 @@ export class NoderedCtrl {
26892692 this . limitsmemory = this . user . nodered . resources . limits . memory ;
26902693 }
26912694 if ( this . user . nodered != null && ( this . user . nodered as any ) . nodeselector != null ) {
2692- this . label = JSON . stringify ( ( this . user . nodered as any ) . nodeselector ) ;
2695+ // this.label = JSON.stringify((this.user.nodered as any).nodeselector);
2696+ this . label = ( this . user . nodered as any ) . nodeselector ;
2697+ this . labelkeys = Object . keys ( this . label ) ;
2698+
26932699 }
26942700 this . name = this . name . split ( "@" ) . join ( "" ) . split ( "." ) . join ( "" ) ;
26952701 this . name = this . name . toLowerCase ( ) ;
@@ -2723,8 +2729,15 @@ export class NoderedCtrl {
27232729 }
27242730 }
27252731 if ( this . label ) {
2732+ const keys = Object . keys ( this . label ) ;
2733+ if ( keys . length == 0 ) this . label = null ;
2734+ }
2735+ if ( this . label ) {
2736+ if ( this . user . nodered == null ) this . user . nodered = new NoderedConfig ( ) ;
2737+ ( this . user . nodered as any ) . nodeselector = this . label ;
2738+ } else {
27262739 if ( this . user . nodered == null ) this . user . nodered = new NoderedConfig ( ) ;
2727- ( this . user . nodered as any ) . nodeselector = JSON . parse ( this . label ) ;
2740+ delete ( this . user . nodered as any ) . nodeselector ;
27282741 }
27292742 this . loading = true ;
27302743 this . messages = 'Updating ' + this . user . name + "\n" + this . messages ;
@@ -2877,6 +2890,24 @@ export class NoderedCtrl {
28772890 }
28782891 if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
28792892 }
2893+ addkey ( ) {
2894+ if ( this . label == null ) this . label = { } ;
2895+ var _label : any [ ] = this . labels [ this . newkey ] ;
2896+ this . label [ this . newkey ] = _label [ 0 ] ;
2897+ if ( this . newvalue != null ) this . label [ this . newkey ] = this . newvalue ;
2898+ this . labelkeys = Object . keys ( this . label ) ;
2899+ }
2900+ removekey ( key ) {
2901+ if ( key == null ) key = this . newkey ;
2902+ if ( this . label == null ) this . label = { } ;
2903+ var _label : any [ ] = this . labels [ key ] ;
2904+ delete this . label [ key ] ;
2905+ this . labelkeys = Object . keys ( this . label ) ;
2906+ }
2907+ newkeyselected ( ) {
2908+ if ( this . label == null || this . label [ this . newkey ] == null ) this . newvalue = this . labels [ this . newkey ] [ 0 ] ;
2909+ if ( this . label != null && this . label [ this . newkey ] != null ) this . newvalue = this . label [ this . newkey ] ;
2910+ }
28802911}
28812912export class hdrobotsCtrl extends entitiesCtrl < unattendedclient > {
28822913 constructor (
0 commit comments