@@ -95,28 +95,31 @@ define(["jquery", "underscore", "models", "views/generic/page", "quicksettings"]
9595
9696 data = { } ;
9797 _ . forEach ( this . workergroupPanels , function ( panel ) {
98- if ( panel != null && panel != undefined )
98+ if ( panel != null && panel != undefined )
9999 {
100100 panelJSON = panel . getValuesAsJSON ( ) ;
101101 workergroup = {
102102 "profiles" : { } ,
103103 "process_termination_timeout" : parseInt ( panelJSON [ "Process Termination Timeout" ] , 10 )
104104 }
105105 _ . forEach ( _ . range ( 1 , panel . profilesNumber + 1 ) , function ( index ) {
106- profile = { } ;
107106 header = "Profile " + String ( index ) + " - " ;
108- profile [ "memory" ] = parseInt ( panelJSON [ header + "Memory" ] , 10 ) ;
109- profile [ "cpu" ] = parseInt ( panelJSON [ header + "CPU" ] , 10 ) ;
110- profile [ "min_count" ] = parseInt ( panelJSON [ header + "MinCount" ] , 10 ) ;
111- profile [ "max_count" ] = parseInt ( panelJSON [ header + "MaxCount" ] , 10 ) ;
112- profile [ "command" ] = panelJSON [ header + "Command" ] ;
113- workergroup [ "profiles" ] [ panelJSON [ header + "Profile Name" ] ] = profile ;
107+ console . log ( panelJSON [ header + "Profile Name" ] )
108+ if ( panelJSON [ header + "Profile Name" ] != null && panelJSON [ header + "Profile Name" ] != "" )
109+ {
110+ profile = { } ;
111+ profile [ "memory" ] = parseInt ( panelJSON [ header + "Memory" ] , 10 ) ;
112+ profile [ "cpu" ] = parseInt ( panelJSON [ header + "CPU" ] , 10 ) ;
113+ profile [ "min_count" ] = parseInt ( panelJSON [ header + "MinCount" ] , 10 ) ;
114+ profile [ "max_count" ] = parseInt ( panelJSON [ header + "MaxCount" ] , 10 ) ;
115+ profile [ "command" ] = panelJSON [ header + "Command" ] ;
116+ workergroup [ "profiles" ] [ panelJSON [ header + "Profile Name" ] ] = profile ;
117+ }
114118 } )
115119 data [ panelJSON [ "Workgroup Name" ] ] = workergroup ;
116120 }
117121 } )
118122 console . log ( data )
119- console . log ( JSON . stringify ( data ) )
120123
121124 $ . post ( "/api/workergroups" , { "workergroups" : JSON . stringify ( data ) } ) . done ( function ( result ) {
122125 if ( result . status != "ok" ) {
0 commit comments