You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/02/22 08:55:59 UTC

svn commit: r1448917 - in /incubator/ambari/trunk: ./ ambari-web/app/ ambari-web/app/controllers/main/ ambari-web/app/controllers/main/host/ ambari-web/app/controllers/main/service/ ambari-web/app/controllers/wizard/ ambari-web/app/views/common/ ambari...

Author: yusaku
Date: Fri Feb 22 07:55:59 2013
New Revision: 1448917

URL: http://svn.apache.org/r1448917
Log:
AMBARI-1470. Refactor confirmation popups. (yusaku)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-web/app/config.js
    incubator/ambari/trunk/ambari-web/app/controllers/main/host.js
    incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js
    incubator/ambari/trunk/ambari-web/app/controllers/main/service/item.js
    incubator/ambari/trunk/ambari-web/app/controllers/wizard/step3_controller.js
    incubator/ambari/trunk/ambari-web/app/messages.js
    incubator/ambari/trunk/ambari-web/app/views/common/modal_popup.js
    incubator/ambari/trunk/ambari-web/app/views/main/service/item.js

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1448917&r1=1448916&r2=1448917&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Fri Feb 22 07:55:59 2013
@@ -45,6 +45,8 @@ Trunk (unreleased changes):
 
  IMPROVEMENTS
 
+ AMBARI-1470. Refactor confirmation popups. (yusaku)
+
  AMBARI-1414. Expose fine grained HDFS capacity metrics in API. (tbeerbower)
 
  AMBARI-1444. Make install, service & host configuration pages reuse same

Modified: incubator/ambari/trunk/ambari-web/app/config.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/config.js?rev=1448917&r1=1448916&r2=1448917&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/config.js Fri Feb 22 07:55:59 2013
@@ -19,6 +19,7 @@
 var App = require('app');
 
 App.testMode = false;
+App.testModeDelayForActions = 10000;
 App.skipBootstrap = false;
 App.alwaysGoToInstaller = false;
 App.apiPrefix = '/api/v1';

Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/host.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/host.js?rev=1448917&r1=1448916&r2=1448917&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/host.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/host.js Fri Feb 22 07:55:59 2013
@@ -91,18 +91,8 @@ App.MainHostController = Em.ArrayControl
    */
   decommissionButtonPopup:function () {
     var self = this;
-    App.ModalPopup.show({
-      header:Em.I18n.t('hosts.decommission.popup.header'),
-      body:Em.I18n.t('hosts.decommission.popup.body'),
-      primary:Em.I18n.t('yes'),
-      secondary:Em.I18n.t('no'),
-      onPrimary:function () {
-        alert('do');
-        this.hide();
-      },
-      onSecondary:function () {
-        this.hide();
-      }
+    App.showConfirmationPopup(function(){
+      alert('do');
     });
   },
 
@@ -112,18 +102,8 @@ App.MainHostController = Em.ArrayControl
    */
   deleteButtonPopup:function () {
     var self = this;
-    App.ModalPopup.show({
-      header:Em.I18n.t('hosts.delete.popup.header'),
-      body:Em.I18n.t('hosts.delete.popup.body'),
-      primary:Em.I18n.t('yes'),
-      secondary:Em.I18n.t('no'),
-      onPrimary:function () {
-        self.removeHosts();
-        this.hide();
-      },
-      onSecondary:function () {
-        this.hide();
-      }
+    App.showConfirmationPopup(function(){
+      self.removeHosts();
     });
   },
 

Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js?rev=1448917&r1=1448916&r2=1448917&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js Fri Feb 22 07:55:59 2013
@@ -90,54 +90,43 @@ App.MainHostDetailsController = Em.Contr
    */
   startComponent: function (event) {
     var self = this;
-    App.ModalPopup.show({
-      header: Em.I18n.t('hosts.host.start.popup.header'),
-      body: Em.I18n.t('hosts.host.start.popup.body'),
-      primary: Em.I18n.t('yes'),
-      secondary: Em.I18n.t('no'),
-      onPrimary: function() {
-        var component = event.context;
-
-        self.sendCommandToServer('/hosts/' + self.get('content.hostName') + '/host_components/' + component.get('componentName').toUpperCase(),{
-          HostRoles:{
-            state: 'STARTED'
-          }
-        }, function(requestId){
+    App.showConfirmationPopup(function() {
+      var component = event.context;
 
-          if(!requestId){
-            return;
-          }
+      self.sendCommandToServer('/hosts/' + self.get('content.hostName') + '/host_components/' + component.get('componentName').toUpperCase(),{
+        HostRoles:{
+          state: 'STARTED'
+        }
+      }, function(requestId){
 
-          console.log('Send request for STARTING successfully');
+        if(!requestId){
+          return;
+        }
 
-          if (App.testMode) {
-            component.set('workStatus', App.HostComponentStatus.starting);
-            setTimeout(function(){
-              component.set('workStatus', App.HostComponentStatus.started);
-            },10000);
-          } else {
-            App.router.get('clusterController').loadUpdatedStatusDelayed(500);
-            App.router.get('backgroundOperationsController.eventsArray').push({
-              "when" : function(controller){
-                var result = (controller.getOperationsForRequestId(requestId).length == 0);
-                console.log('startComponent.when = ', result)
-                return result;
-              },
-              "do" : function(){
-                App.router.get('clusterController').loadUpdatedStatus();
-              }
-            });
-          }
+        console.log('Send request for STARTING successfully');
 
-          App.router.get('backgroundOperationsController').showPopup();
+        if (App.testMode) {
+          component.set('workStatus', App.HostComponentStatus.starting);
+          setTimeout(function(){
+            component.set('workStatus', App.HostComponentStatus.started);
+          },App.testModeDelayForActions);
+        } else {
+          App.router.get('clusterController').loadUpdatedStatusDelayed(500);
+          App.router.get('backgroundOperationsController.eventsArray').push({
+            "when" : function(controller){
+              var result = (controller.getOperationsForRequestId(requestId).length == 0);
+              console.log('startComponent.when = ', result)
+              return result;
+            },
+            "do" : function(){
+              App.router.get('clusterController').loadUpdatedStatus();
+            }
+          });
+        }
 
-        });
+        App.router.get('backgroundOperationsController').showPopup();
 
-        this.hide();
-      },
-      onSecondary: function() {
-        this.hide();
-      }
+      });
     });
   },
 
@@ -147,53 +136,43 @@ App.MainHostDetailsController = Em.Contr
    */
   stopComponent: function (event) {
     var self = this;
-    App.ModalPopup.show({
-      header: Em.I18n.t('hosts.host.start.popup.header'),
-      body: Em.I18n.t('hosts.host.start.popup.body'),
-      primary: Em.I18n.t('yes'),
-      secondary: Em.I18n.t('no'),
-      onPrimary: function() {
-        var component = event.context;
+    App.showConfirmationPopup(function() {
+      var component = event.context;
 
-        self.sendCommandToServer('/hosts/' + self.get('content.hostName') + '/host_components/' + component.get('componentName').toUpperCase(),{
-          HostRoles:{
-            state: 'INSTALLED'
-          }
-        }, function(requestId){
-          if(!requestId){
-            return
-          }
+      self.sendCommandToServer('/hosts/' + self.get('content.hostName') + '/host_components/' + component.get('componentName').toUpperCase(),{
+        HostRoles:{
+          state: 'INSTALLED'
+        }
+      }, function(requestId){
+        if(!requestId){
+          return
+        }
 
-          console.log('Send request for STOPPING successfully');
+        console.log('Send request for STOPPING successfully');
 
-          if (App.testMode) {
-            component.set('workStatus', App.HostComponentStatus.stopping);
-            setTimeout(function(){
-              component.set('workStatus', App.HostComponentStatus.stopped);
-            },10000);
-          } else {
-            App.router.get('clusterController').loadUpdatedStatus();
-            App.router.get('backgroundOperationsController.eventsArray').push({
-              "when" : function(controller){
-                var result = (controller.getOperationsForRequestId(requestId).length == 0);
-                console.log('stopComponent.when = ', result)
-                return result;
-              },
-              "do" : function(){
-                App.router.get('clusterController').loadUpdatedStatus();
-              }
-            });
-          }
+        if (App.testMode) {
+          component.set('workStatus', App.HostComponentStatus.stopping);
+          setTimeout(function(){
+            component.set('workStatus', App.HostComponentStatus.stopped);
+          },App.testModeDelayForActions);
+        } else {
+          App.router.get('clusterController').loadUpdatedStatus();
+          App.router.get('backgroundOperationsController.eventsArray').push({
+            "when" : function(controller){
+              var result = (controller.getOperationsForRequestId(requestId).length == 0);
+              console.log('stopComponent.when = ', result)
+              return result;
+            },
+            "do" : function(){
+              App.router.get('clusterController').loadUpdatedStatus();
+            }
+          });
+        }
 
-          App.router.get('backgroundOperationsController').showPopup();
+        App.router.get('backgroundOperationsController').showPopup();
 
-        });
+      });
 
-        this.hide();
-      },
-      onSecondary: function() {
-        this.hide();
-      }
     });
   },
 
@@ -207,29 +186,19 @@ App.MainHostDetailsController = Em.Contr
     if (decommissionHostNames == null) {
       decommissionHostNames = [];
     }
-    App.ModalPopup.show({
-      header: Em.I18n.t('hosts.host.start.popup.header'),
-      body: Em.I18n.t('hosts.host.start.popup.body'),
-      primary: Em.I18n.t('yes'),
-      secondary: Em.I18n.t('no'),
-      onPrimary: function(){
-        var component = event.context;
-        // Only HDFS service as of now
-        var svcName = component.get('service.serviceName');
-        if (svcName === "HDFS") {
-          var hostName = self.get('content.hostName');
-          var index = decommissionHostNames.indexOf(hostName);
-          if (index < 0) {
-            decommissionHostNames.push(hostName);
-          }
-          self.doDatanodeDecommission(decommissionHostNames);
+    App.showConfirmationPopup(function(){
+      var component = event.context;
+      // Only HDFS service as of now
+      var svcName = component.get('service.serviceName');
+      if (svcName === "HDFS") {
+        var hostName = self.get('content.hostName');
+        var index = decommissionHostNames.indexOf(hostName);
+        if (index < 0) {
+          decommissionHostNames.push(hostName);
         }
-        App.router.get('backgroundOperationsController').showPopup();
-        this.hide();
-      },
-      onSecondary: function() {
-        this.hide();
+        self.doDatanodeDecommission(decommissionHostNames);
       }
+      App.router.get('backgroundOperationsController').showPopup();
     });
   },
 
@@ -315,27 +284,17 @@ App.MainHostDetailsController = Em.Contr
     if (decommissionHostNames == null) {
       decommissionHostNames = [];
     }
-    App.ModalPopup.show({
-      header: Em.I18n.t('hosts.host.start.popup.header'),
-      body: Em.I18n.t('hosts.host.start.popup.body'),
-      primary: Em.I18n.t('yes'),
-      secondary: Em.I18n.t('no'),
-      onPrimary: function(){
-        var component = event.context;
-        // Only HDFS service as of now
-        var svcName = component.get('service.serviceName');
-        if (svcName === "HDFS") {
-          var hostName = self.get('content.hostName');
-          var index = decommissionHostNames.indexOf(hostName);
-          decommissionHostNames.splice(index, 1);
-          self.doDatanodeDecommission(decommissionHostNames);
-        }
-        App.router.get('backgroundOperationsController').showPopup();
-        this.hide();
-      },
-      onSecondary: function(){
-        this.hide();
+    App.showConfirmationPopup(function(){
+      var component = event.context;
+      // Only HDFS service as of now
+      var svcName = component.get('service.serviceName');
+      if (svcName === "HDFS") {
+        var hostName = self.get('content.hostName');
+        var index = decommissionHostNames.indexOf(hostName);
+        decommissionHostNames.splice(index, 1);
+        self.doDatanodeDecommission(decommissionHostNames);
       }
+      App.router.get('backgroundOperationsController').showPopup();
     });
   },
 
@@ -388,18 +347,8 @@ App.MainHostDetailsController = Em.Contr
    */
   deleteButtonPopup: function() {
     var self = this;
-    App.ModalPopup.show({
-      header: Em.I18n.t('hosts.delete.popup.header'),
-      body: Em.I18n.t('hosts.delete.popup.body'),
-      primary: Em.I18n.t('yes'),
-      secondary: Em.I18n.t('no'),
-      onPrimary: function() {
-        self.removeHost();
-        this.hide();
-      },
-      onSecondary: function() {
-        this.hide();
-      }
+    App.showConfirmationPopup(function(){
+      self.removeHost();
     });
   },
 

Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/service/item.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/service/item.js?rev=1448917&r1=1448916&r2=1448917&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/service/item.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/service/item.js Fri Feb 22 07:55:59 2013
@@ -68,52 +68,42 @@ App.MainServiceItemController = Em.Contr
     }
 
     var self = this;
-    App.ModalPopup.show({
-      header: Em.I18n.t('services.service.confirmation.header'),
-      body: Em.I18n.t('services.service.confirmation.body'),
-      primary: Em.I18n.t('yes'),
-      secondary: Em.I18n.t('no'),
-      onPrimary: function () {
-        self.sendCommandToServer('/services/' + self.get('content.serviceName').toUpperCase(), "PUT", {
-          ServiceInfo: {
-            state: 'STARTED'
-          }
-        }, function (requestId) {
-
-          if (!requestId) {
-            return;
-          }
-          console.log('Send request for STARTING successfully');
-
-          if (App.testMode) {
-            self.set('content.workStatus', App.Service.Health.starting);
-            self.get('content.hostComponents').setEach('workStatus', App.HostComponentStatus.starting);
-            setTimeout(function () {
-              self.set('content.workStatus', App.Service.Health.live);
-              self.get('content.hostComponents').setEach('workStatus', App.HostComponentStatus.started);
-            }, 10000);
-          } else {
-            App.router.get('clusterController').loadUpdatedStatusDelayed(500);
-            App.router.get('backgroundOperationsController.eventsArray').push({
-              "when": function (controller) {
-                var result = (controller.getOperationsForRequestId(requestId).length == 0);
-                console.log('startService.when = ', result)
-                return result;
-              },
-              "do": function () {
-                App.router.get('clusterController').loadUpdatedStatus();
-              }
-            });
-          }
-          App.router.get('backgroundOperationsController').showPopup();
-        });
-        self.set('content.isStopDisabled',true);
-        self.set('content.isStartDisabled',true);
-        this.hide();
-      },
-      onSecondary: function() {
-        this.hide();
-      }
+    App.showConfirmationPopup(function(){
+      self.sendCommandToServer('/services/' + self.get('content.serviceName').toUpperCase(), "PUT", {
+        ServiceInfo: {
+          state: 'STARTED'
+        }
+      }, function (requestId) {
+
+        if (!requestId) {
+          return;
+        }
+        console.log('Send request for STARTING successfully');
+
+        if (App.testMode) {
+          self.set('content.workStatus', App.Service.Health.starting);
+          self.get('content.hostComponents').setEach('workStatus', App.HostComponentStatus.starting);
+          setTimeout(function () {
+            self.set('content.workStatus', App.Service.Health.live);
+            self.get('content.hostComponents').setEach('workStatus', App.HostComponentStatus.started);
+          }, App.testModeDelayForActions);
+        } else {
+          App.router.get('clusterController').loadUpdatedStatusDelayed(500);
+          App.router.get('backgroundOperationsController.eventsArray').push({
+            "when": function (controller) {
+              var result = (controller.getOperationsForRequestId(requestId).length == 0);
+              console.log('startService.when = ', result)
+              return result;
+            },
+            "do": function () {
+              App.router.get('clusterController').loadUpdatedStatus();
+            }
+          });
+        }
+        App.router.get('backgroundOperationsController').showPopup();
+      });
+      self.set('content.isStopDisabled',true);
+      self.set('content.isStartDisabled',true);
     });
   },
 
@@ -127,50 +117,40 @@ App.MainServiceItemController = Em.Contr
     }
 
     var self = this;
-    App.ModalPopup.show({
-      header: Em.I18n.t('services.service.confirmation.header'),
-      body: Em.I18n.t('services.service.confirmation.body'),
-      primary: Em.I18n.t('yes'),
-      secondary: Em.I18n.t('no'),
-      onPrimary: function() {
-        self.sendCommandToServer('/services/' + self.get('content.serviceName').toUpperCase(), "PUT",{
-          ServiceInfo:{
-            state: 'INSTALLED'
-          }
-        }, function (requestId) {
-          if (!requestId) {
-            return
-          }
-          console.log('Send request for STOPPING successfully');
-          if (App.testMode) {
-            self.set('content.workStatus', App.Service.Health.stopping);
-            self.get('content.hostComponents').setEach('workStatus', App.HostComponentStatus.stopping);
-            setTimeout(function () {
-              self.set('content.workStatus', App.Service.Health.dead);
-              self.get('content.hostComponents').setEach('workStatus', App.HostComponentStatus.stopped);
-            }, 10000);
-          } else {
-            App.router.get('clusterController').loadUpdatedStatusDelayed(500);
-            App.router.get('backgroundOperationsController.eventsArray').push({
-              "when": function (controller) {
-                var result = (controller.getOperationsForRequestId(requestId).length == 0);
-                console.log('stopService.when = ', result)
-                return result;
-              },
-              "do": function () {
-                App.router.get('clusterController').loadUpdatedStatus();
-              }
-            });
-          }
-          App.router.get('backgroundOperationsController').showPopup();
-        });
-        self.set('content.isStopDisabled',true);
-        self.set('content.isStartDisabled',true);
-        this.hide();
-      },
-      onSecondary: function () {
-        this.hide();
-      }
+    App.showConfirmationPopup(function(){
+      self.sendCommandToServer('/services/' + self.get('content.serviceName').toUpperCase(), "PUT",{
+        ServiceInfo:{
+          state: 'INSTALLED'
+        }
+      }, function (requestId) {
+        if (!requestId) {
+          return
+        }
+        console.log('Send request for STOPPING successfully');
+        if (App.testMode) {
+          self.set('content.workStatus', App.Service.Health.stopping);
+          self.get('content.hostComponents').setEach('workStatus', App.HostComponentStatus.stopping);
+          setTimeout(function () {
+            self.set('content.workStatus', App.Service.Health.dead);
+            self.get('content.hostComponents').setEach('workStatus', App.HostComponentStatus.stopped);
+          }, App.testModeDelayForActions);
+        } else {
+          App.router.get('clusterController').loadUpdatedStatusDelayed(500);
+          App.router.get('backgroundOperationsController.eventsArray').push({
+            "when": function (controller) {
+              var result = (controller.getOperationsForRequestId(requestId).length == 0);
+              console.log('stopService.when = ', result)
+              return result;
+            },
+            "do": function () {
+              App.router.get('clusterController').loadUpdatedStatus();
+            }
+          });
+        }
+        App.router.get('backgroundOperationsController').showPopup();
+      });
+      self.set('content.isStopDisabled',true);
+      self.set('content.isStartDisabled',true);
     });
   },
 
@@ -180,19 +160,9 @@ App.MainServiceItemController = Em.Contr
    */
   runRebalancer: function (event) {
     var self = this;
-    App.ModalPopup.show({
-      header: Em.I18n.t('services.service.confirmation.header'),
-      body: Em.I18n.t('services.service.confirmation.body'),
-      primary: Em.I18n.t('yes'),
-      secondary: Em.I18n.t('no'),
-      onPrimary: function() {
+    App.showConfirmationPopup(function() {
         self.content.set('runRebalancer', true);
         App.router.get('backgroundOperationsController').showPopup();
-        this.hide();
-      },
-      onSecondary: function() {
-        this.hide();
-      }
     });
   },
 
@@ -202,19 +172,9 @@ App.MainServiceItemController = Em.Contr
    */
   runCompaction: function (event) {
     var self = this;
-    App.ModalPopup.show({
-      header: Em.I18n.t('services.service.confirmation.header'),
-      body: Em.I18n.t('services.service.confirmation.body'),
-      primary: Em.I18n.t('yes'),
-      secondary: Em.I18n.t('no'),
-      onPrimary: function() {
+    App.showConfirmationPopup(function() {
         self.content.set('runCompaction', true);
         App.router.get('backgroundOperationsController').showPopup();
-        this.hide();
-      },
-      onSecondary: function() {
-        this.hide();
-      }
     });
   },
 
@@ -224,31 +184,20 @@ App.MainServiceItemController = Em.Contr
    */
   runSmokeTest: function (event) {
     var self = this;
-    App.ModalPopup.show({
-      header: Em.I18n.t('services.service.confirmation.header'),
-      body: Em.I18n.t('services.service.confirmation.body'),
-      primary: Em.I18n.t('yes'),
-      secondary: Em.I18n.t('no'),
-      onPrimary: function() {
+    App.showConfirmationPopup(function(){
+      var serviceName = self.get('content.serviceName').toUpperCase();
+      var smokeName = serviceName + "_SERVICE_CHECK";
+      self.sendCommandToServer('/services/' + serviceName + '/actions/' + smokeName, "POST",
+        null,
+        function (requestId) {
 
-        var serviceName = self.get('content.serviceName').toUpperCase();
-        var smokeName = serviceName + "_SERVICE_CHECK";
-        self.sendCommandToServer('/services/' + serviceName + '/actions/' + smokeName, "POST",
-            null,
-            function (requestId) {
-
-              if (!requestId) {
-                return;
-              }
-              self.content.set('runSmokeTest', true);
-              App.router.get('backgroundOperationsController').showPopup();
-            }
-        );
-        this.hide();
-      },
-      onSecondary: function () {
-        this.hide();
-      }
+          if (!requestId) {
+            return;
+          }
+          self.content.set('runSmokeTest', true);
+          App.router.get('backgroundOperationsController').showPopup();
+        }
+      );
     });
   },
 

Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard/step3_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step3_controller.js?rev=1448917&r1=1448916&r2=1448917&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard/step3_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard/step3_controller.js Fri Feb 22 07:55:59 2013
@@ -195,20 +195,13 @@ App.WizardStep3Controller = Em.Controlle
 
   removeHosts: function (hosts) {
     var self = this;
-
-    App.ModalPopup.show({
-      header: Em.I18n.t('installer.step3.hosts.remove.popup.header'),
-      onPrimary: function () {
-        App.router.send('removeHosts', hosts);
-        self.hosts.removeObjects(hosts);
-        if (!self.hosts.length) {
-          self.set('isSubmitDisabled', true);
-        }
-        this.hide();
-      },
-      body: Em.I18n.t('installer.step3.hosts.remove.popup.body')
-    });
-
+    App.showConfirmationPopup(function() {
+      App.router.send('removeHosts', hosts);
+      self.hosts.removeObjects(hosts);
+      if (!self.hosts.length) {
+        self.set('isSubmitDisabled', true);
+      }
+    },Em.I18n.t('installer.step3.hosts.remove.popup.body'));
   },
 
   /* Removes a single element on the trash icon click. Called from View */

Modified: incubator/ambari/trunk/ambari-web/app/messages.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/messages.js?rev=1448917&r1=1448916&r2=1448917&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/messages.js (original)
+++ incubator/ambari/trunk/ambari-web/app/messages.js Fri Feb 22 07:55:59 2013
@@ -37,6 +37,9 @@ Em.I18n.translations = {
   'as':'as',
   'any': 'Any',
   'more':'more',
+  'yes':'Yes',
+  'no':'No',
+
 
   'common.learnMore':'Learn more',
   'common.back':'Back',
@@ -101,7 +104,10 @@ Em.I18n.translations = {
   'common.loading': 'Loading',
   'common.search': 'Search',
 
+  'question.sure':'Are you sure {0}?',
+
   'popup.highlight':'click to highlight',
+  'popup.confirmation.commonHeader':'Confirmation',
 
   'router.hadoopClusterNotSetUp':'Your administrator has not set up a Hadoop cluster yet.',
 
@@ -232,9 +238,7 @@ Em.I18n.translations = {
     'Please confirm the host list and remove any hosts that you do not want to include in the cluster.',
   'installer.step3.hostLog.popup.header':'Registration log for {0}',
   'installer.step3.hosts.remove.popup.header':'Remove Hosts',
-  'installer.step3.hosts.remove.popup.body':'Are you sure you want to remove the selected host(s)?',
-  'installer.step3.hosts.retry.popup.header':'Retry Host Discovery',
-  'installer.step3.hosts.retry.popup.body':'Are you sure you want to retry discovery of the selected host(s)?',
+  'installer.step3.hosts.remove.popup.body':' you want to remove the selected host(s)',
   'installer.step3.hostInformation.popup.header':'Error in retrieving host Information',
   'installer.step3.hostInformation.popup.body' : 'All bootstrapped hosts registered but unable to retrieve cpu and memory related information',
   'installer.step3.hostWarningsPopup.details':'Show Details',
@@ -457,14 +461,8 @@ Em.I18n.translations = {
   'admin.cluster.upgradeAvailable':'Upgrade available',
   'admin.cluster.upgradeUnavailable':'Upgrade unavailable',
 
-  'question.sure':'Are you sure?',
-  'yes':'Yes',
-  'no':'No',
-
   'services.service.start':'Start',
   'services.service.stop':'Stop',
-  'services.service.confirmation.header':'Confirmation',
-  'services.service.confirmation.body':'Are you sure?',
   'services.service.summary.version':'Version',
   'services.service.summary.nameNode':'NameNode Web UI',
   'services.service.summary.nameNodeUptime':'NameNode Uptime',
@@ -651,19 +649,11 @@ Em.I18n.translations = {
   'host.host.componentFilter.slave':'Slave Components',
   'host.host.componentFilter.client':'Client Components',
 
-  'hosts.host.start.popup.header':'Confirmation',
-  'hosts.host.stop.popup.header':'Confirmation',
-  'hosts.host.start.popup.body':'Are you sure?',
-  'hosts.host.stop.popup.body':'Are you sure?',
   'hosts.host.alert.noAlerts':'No alerts',
   'hosts.host.alert.noAlerts.message':'There are no alerts for this host.',
   'hosts.host.healthStatus.heartBeatNotReceived':'The server has not received a heartbeat from this host for more than 3 minutes.',
   'hosts.host.healthStatus.mastersDown':"The following master components are down:\n",
   'hosts.host.healthStatus.slavesDown':"The following slave components are down:\n",
-  'hosts.decommission.popup.body':'Are you sure?',
-  'hosts.decommission.popup.header':'Confirmation',
-  'hosts.delete.popup.body':'Are you sure?',
-  'hosts.delete.popup.header':'Confirmation',
   'hosts.cant.do.popup.header':'Operation not allowed',
   'hosts.cant.do.popup.masterList.body':'You cannot delete this host because it is hosting following master services: {0}.',
   'hosts.cant.do.popup.workingList.body':'You cannot delete this host because following slave services are not fully stopped or decommissioned: {0}.',

Modified: incubator/ambari/trunk/ambari-web/app/views/common/modal_popup.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/common/modal_popup.js?rev=1448917&r1=1448916&r2=1448917&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/common/modal_popup.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/common/modal_popup.js Fri Feb 22 07:55:59 2013
@@ -118,4 +118,27 @@ App.showReloadPopup = function(){
     body: "<div class='alert alert-info'><div class='spinner'>" + this.t('app.reloadPopup.text') + "</div></div><div><a href='#' onclick='location.reload();'>" + this.t('app.reloadPopup.link') + "</a></div>",
     encodeBody: false
   });
+}
+
+/**
+ * Show confirmation popup
+ *
+ * @param {Function} primary - "OK" button click handler
+ * @param {String} body - additional text constant. Will be placed in the popup-body
+ * @return {*}
+ */
+App.showConfirmationPopup = function(primary, body) {
+  if (!primary) {
+    return false;
+  }
+  return App.ModalPopup.show({
+    primary: Em.I18n.t('yes'),
+    secondary: Em.I18n.t('no'),
+    header: Em.I18n.t('popup.confirmation.commonHeader'),
+    body: Em.I18n.t('question.sure').format(body || ''),
+    onPrimary: function() {
+      primary();
+      this.hide();
+    }
+  });
 }
\ No newline at end of file

Modified: incubator/ambari/trunk/ambari-web/app/views/main/service/item.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/service/item.js?rev=1448917&r1=1448916&r2=1448917&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/service/item.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/service/item.js Fri Feb 22 07:55:59 2013
@@ -44,22 +44,4 @@ App.MainServiceItemView = Em.View.extend
   hasConfigTab: function(){
     return this.get("controller.content.isConfigurable");
   }.property('controller.content.isConfigurable')
-});
-
-App.MainServiceItemOperations = Em.View.extend({
-  content: null,
-  classNames: ['background-operations'],
-  classNameBindings: ['isOpen'],
-  isOpen: false,
-  logDetails: null,
-  isOpenShowLog: false,
-  iconClass: function(){
-    return this.get('isOpen') ? 'icon-minus' : 'icon-plus';
-  }.property('isOpen'),
-  openDetails: function(){
-    this.set('isOpen', !this.get('isOpen'))
-  },
-  showOperationLog:function(){
-    this.set('isOpenShowLog', !this.get('isOpenShowLog'))
-  }
 });
\ No newline at end of file