From e5c83ce3880fcb0343bf80263b82823e02641e5d Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 21 Jun 2013 16:45:19 +0200 Subject: [PATCH] Do not show undefined values in service --- .../public/js/apptools-appflow-services.js | 81 ++++++++++++------- 1 file changed, 54 insertions(+), 27 deletions(-) diff --git a/flow/sunstone/public/js/apptools-appflow-services.js b/flow/sunstone/public/js/apptools-appflow-services.js index 5b8aeeb24d..4b545b15db 100644 --- a/flow/sunstone/public/js/apptools-appflow-services.js +++ b/flow/sunstone/public/js/apptools-appflow-services.js @@ -799,7 +799,7 @@ function updateServiceInfo(request,elem){ \ \ '+tr("Shutdown action")+'\ - '+elem_info.TEMPLATE.BODY.shutdown_action+'\ + '+(elem_info.TEMPLATE.BODY.shutdown_action || "")+'\ \ \ '+tr("State")+'\ @@ -836,7 +836,7 @@ function updateServiceInfo(request,elem){
'+ tr("Period") +'
\ \
\ - \ + \
\
\ \ @@ -940,29 +940,56 @@ function updateServiceInfo(request,elem){ initCheckAllBoxes(servicerolesDataTable); tableCheckboxesListener(servicerolesDataTable); + $('tbody input.check_item',servicerolesDataTable).live("change",function(){ + if($(this).is(":checked")) + { + $(this).parents('tr').children().each(function(){$(this).addClass('markrowchecked');}); + } + else + { + $(this).parents('tr').children().removeClass('markrowchecked'); + $(this).parents('tr').children().removeClass('markrowselected'); + } + }); + $('tbody tr',servicerolesDataTable).live("click",function(e){ - var aData = servicerolesDataTable.fnGetData(this); - var role_name = $(aData[0]).val(); + if ($(e.target).is('input') || + $(e.target).is('select') || + $(e.target).is('option')) return true; - var role_index = servicerolesDataTable.fnGetPosition(this); - - if ($("#service_info_panel_resize_75").attr('visibility') != 'hidden') { - $("#service_info_panel_resize_75").click(); + if (e.ctrlKey || e.metaKey || $(e.target).is('input')) + { + $('.check_item',this).trigger('click'); } + else + { + var aData = servicerolesDataTable.fnGetData(this); + var role_name = $(aData[0]).val(); - if(last_selected_row) { - last_selected_row.children().each(function(){ - $(this).removeClass('markrowselected'); + var role_index = servicerolesDataTable.fnGetPosition(this); + + if ($("#service_info_panel_resize_75").attr('visibility') != 'hidden') { + $("#service_info_panel_resize_75").click(); + } + + $('tbody input.check_item',$(this).parents('table')).removeAttr('checked'); + $('.check_item',this).click(); + $('td',$(this).parents('table')).removeClass('markrowchecked'); + + if(last_selected_row) { + last_selected_row.children().each(function(){ + $(this).removeClass('markrowselected'); + }); + } + + last_selected_row = $(this); + $(this).children().each(function(){ + $(this).addClass('markrowselected'); }); + + generate_role_div(role_index); } - last_selected_row = $(this); - $(this).children().each(function(){ - $(this).addClass('markrowselected'); - }); - - generate_role_div(role_index); - //if($(this).is(":checked")) //{ // $(this).parents('tr').children().each(function(){$(this).addClass('markrowchecked');}); @@ -1028,25 +1055,25 @@ function updateServiceInfo(request,elem){ if (role.shutdown_action) { info_str += "\ "+tr("Shutdown action")+"\ - "+role.shutdown_action+"\ + "+(role.shutdown_action || "")+"\ "; } if (role.min_vms) { info_str += "\ "+tr("Min VMs")+"\ - "+role.min_vms+"\ + "+(role.min_vms || "")+"\ "; } if (role.max_vms) { info_str += "\ "+tr("Max VMs")+"\ - "+role.max_vms+"\ + "+(role.max_vms || "")+"\ "; } if (role.cooldown) { info_str += "\ "+tr("Cooldown")+"\ - "+role.cooldown+"\ + "+(role.cooldown || "")+"\ "; } @@ -1081,11 +1108,11 @@ function updateServiceInfo(request,elem){ info_str += '\ '+this.type+'\ '+this.adjust+'\ - '+this.min_adjust_step+'\ - '+(this.expression_evaluated ? this.expression_evaluated : this.expression)+'\ - '+(this.true_evals ? this.true_evals : 0 )+'/'+ this.period+'\ + '+(this.min_adjust_step || "")+'\ + '+(this.expression_evaluated || this.expression)+'\ + '+(this.true_evals || 0 )+'/'+ this.period+'\ '+this.period_number+'\ - '+this.cooldown+'\ + '+(this.cooldown || "")+'\ ' }); @@ -1115,7 +1142,7 @@ function updateServiceInfo(request,elem){ info_str += '\ '+this.type+'\ '+this.adjust+'\ - '+this.min_adjust_step+''; + '+(this.min_adjust_step || "")+''; if (this['start_time']) { info_str += 'start_time';