From 5a9dbcf18777627a34c1f52b173bf1ed985ce6ae Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 8 Aug 2012 13:56:13 -0700 Subject: [PATCH] cloudstack 3.0 UI - autoscale -fix a bug that action bar was not refreshed after action was complete. --- ui/scripts/autoscaler.js | 18 +++++++++++++----- ui/scripts/ui-custom/autoscaler.js | 6 +++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ui/scripts/autoscaler.js b/ui/scripts/autoscaler.js index 658a9b727d2..29a39ab90db 100644 --- a/ui/scripts/autoscaler.js +++ b/ui/scripts/autoscaler.js @@ -81,11 +81,19 @@ if(args.context.originalAutoscaleData == null) { //new LB rule //no actions for new LB rule } - else { //existing LB rule - if(args.context.originalAutoscaleData[0].context.autoscaleVmGroup.state == 'disabled') - allowedActions.push('enable'); - else if(args.context.originalAutoscaleData[0].context.autoscaleVmGroup.state == 'enabled') - allowedActions.push('disable'); + else { //existing LB rule + if(args.context.originalAutoscaleData[0].afterActionIsComplete == null) { + if(args.context.originalAutoscaleData[0].context.autoscaleVmGroup.state == 'disabled') + allowedActions.push('enable'); + else if(args.context.originalAutoscaleData[0].context.autoscaleVmGroup.state == 'enabled') + allowedActions.push('disable'); + } + else { + if(args.context.originalAutoscaleData[0].afterActionIsComplete.state == 'disabled') + allowedActions.push('enable'); + else if(args.context.originalAutoscaleData[0].afterActionIsComplete.state == 'enabled') + allowedActions.push('disable'); + } } return allowedActions; }, diff --git a/ui/scripts/ui-custom/autoscaler.js b/ui/scripts/ui-custom/autoscaler.js index f0636272726..f1eb268f375 100644 --- a/ui/scripts/ui-custom/autoscaler.js +++ b/ui/scripts/ui-custom/autoscaler.js @@ -95,8 +95,12 @@ }); // Reload actions + if(data != null) { //data is originalAutoscaleData in \ui\scripts\autoscaler.js + data['afterActionIsComplete'] = args.data; + } + var $newActions = renderActions({ - data: data ? $.extend(data, args.data) : args.data, + data: data ? data: args.data, actionFilter: args.actionFilter, context: context });