Browse Source

AMBARI-1470. Refactor confirmation popups. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1448917 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 years ago
parent
commit
779a0997e6

+ 2 - 0
CHANGES.txt

@@ -45,6 +45,8 @@ Trunk (unreleased changes):
 
 
  IMPROVEMENTS
  IMPROVEMENTS
 
 
+ AMBARI-1470. Refactor confirmation popups. (yusaku)
+
  AMBARI-1414. Expose fine grained HDFS capacity metrics in API. (tbeerbower)
  AMBARI-1414. Expose fine grained HDFS capacity metrics in API. (tbeerbower)
 
 
  AMBARI-1444. Make install, service & host configuration pages reuse same
  AMBARI-1444. Make install, service & host configuration pages reuse same

+ 1 - 0
ambari-web/app/config.js

@@ -19,6 +19,7 @@
 var App = require('app');
 var App = require('app');
 
 
 App.testMode = false;
 App.testMode = false;
+App.testModeDelayForActions = 10000;
 App.skipBootstrap = false;
 App.skipBootstrap = false;
 App.alwaysGoToInstaller = false;
 App.alwaysGoToInstaller = false;
 App.apiPrefix = '/api/v1';
 App.apiPrefix = '/api/v1';

+ 4 - 24
ambari-web/app/controllers/main/host.js

@@ -91,18 +91,8 @@ App.MainHostController = Em.ArrayController.extend({
    */
    */
   decommissionButtonPopup:function () {
   decommissionButtonPopup:function () {
     var self = this;
     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.ArrayController.extend({
    */
    */
   deleteButtonPopup:function () {
   deleteButtonPopup:function () {
     var self = this;
     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();
     });
     });
   },
   },
 
 

+ 87 - 138
ambari-web/app/controllers/main/host/details.js

@@ -90,54 +90,43 @@ App.MainHostDetailsController = Em.Controller.extend({
    */
    */
   startComponent: function (event) {
   startComponent: function (event) {
     var self = this;
     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 (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();
-              }
-            });
-          }
+        if(!requestId){
+          return;
+        }
 
 
-          App.router.get('backgroundOperationsController').showPopup();
+        console.log('Send request for STARTING successfully');
+
+        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.Controller.extend({
    */
    */
   stopComponent: function (event) {
   stopComponent: function (event) {
     var self = this;
     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');
-
-          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();
-              }
-            });
-          }
+        console.log('Send request for STOPPING successfully');
+
+        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.Controller.extend({
     if (decommissionHostNames == null) {
     if (decommissionHostNames == null) {
       decommissionHostNames = [];
       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.Controller.extend({
     if (decommissionHostNames == null) {
     if (decommissionHostNames == null) {
       decommissionHostNames = [];
       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.Controller.extend({
    */
    */
   deleteButtonPopup: function() {
   deleteButtonPopup: function() {
     var self = this;
     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();
     });
     });
   },
   },
 
 

+ 84 - 135
ambari-web/app/controllers/main/service/item.js

@@ -68,52 +68,42 @@ App.MainServiceItemController = Em.Controller.extend({
     }
     }
 
 
     var self = this;
     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');
+    App.showConfirmationPopup(function(){
+      self.sendCommandToServer('/services/' + self.get('content.serviceName').toUpperCase(), "PUT", {
+        ServiceInfo: {
+          state: 'STARTED'
+        }
+      }, function (requestId) {
 
 
-          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();
-      }
+        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.Controller.extend({
     }
     }
 
 
     var self = this;
     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.Controller.extend({
    */
    */
   runRebalancer: function (event) {
   runRebalancer: function (event) {
     var self = this;
     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);
         self.content.set('runRebalancer', true);
         App.router.get('backgroundOperationsController').showPopup();
         App.router.get('backgroundOperationsController').showPopup();
-        this.hide();
-      },
-      onSecondary: function() {
-        this.hide();
-      }
     });
     });
   },
   },
 
 
@@ -202,19 +172,9 @@ App.MainServiceItemController = Em.Controller.extend({
    */
    */
   runCompaction: function (event) {
   runCompaction: function (event) {
     var self = this;
     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);
         self.content.set('runCompaction', true);
         App.router.get('backgroundOperationsController').showPopup();
         App.router.get('backgroundOperationsController').showPopup();
-        this.hide();
-      },
-      onSecondary: function() {
-        this.hide();
-      }
     });
     });
   },
   },
 
 
@@ -224,31 +184,20 @@ App.MainServiceItemController = Em.Controller.extend({
    */
    */
   runSmokeTest: function (event) {
   runSmokeTest: function (event) {
     var self = this;
     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() {
-
-        var serviceName = self.get('content.serviceName').toUpperCase();
-        var smokeName = serviceName + "_SERVICE_CHECK";
-        self.sendCommandToServer('/services/' + serviceName + '/actions/' + smokeName, "POST",
-            null,
-            function (requestId) {
+    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) {
 
 
-              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();
+        }
+      );
     });
     });
   },
   },
 
 

+ 7 - 14
ambari-web/app/controllers/wizard/step3_controller.js

@@ -195,20 +195,13 @@ App.WizardStep3Controller = Em.Controller.extend({
 
 
   removeHosts: function (hosts) {
   removeHosts: function (hosts) {
     var self = this;
     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 */
   /* Removes a single element on the trash icon click. Called from View */

+ 7 - 17
ambari-web/app/messages.js

@@ -37,6 +37,9 @@ Em.I18n.translations = {
   'as':'as',
   'as':'as',
   'any': 'Any',
   'any': 'Any',
   'more':'more',
   'more':'more',
+  'yes':'Yes',
+  'no':'No',
+
 
 
   'common.learnMore':'Learn more',
   'common.learnMore':'Learn more',
   'common.back':'Back',
   'common.back':'Back',
@@ -101,7 +104,10 @@ Em.I18n.translations = {
   'common.loading': 'Loading',
   'common.loading': 'Loading',
   'common.search': 'Search',
   'common.search': 'Search',
 
 
+  'question.sure':'Are you sure {0}?',
+
   'popup.highlight':'click to highlight',
   'popup.highlight':'click to highlight',
+  'popup.confirmation.commonHeader':'Confirmation',
 
 
   'router.hadoopClusterNotSetUp':'Your administrator has not set up a Hadoop cluster yet.',
   '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.',
     '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.hostLog.popup.header':'Registration log for {0}',
   'installer.step3.hosts.remove.popup.header':'Remove Hosts',
   '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.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.hostInformation.popup.body' : 'All bootstrapped hosts registered but unable to retrieve cpu and memory related information',
   'installer.step3.hostWarningsPopup.details':'Show Details',
   'installer.step3.hostWarningsPopup.details':'Show Details',
@@ -457,14 +461,8 @@ Em.I18n.translations = {
   'admin.cluster.upgradeAvailable':'Upgrade available',
   'admin.cluster.upgradeAvailable':'Upgrade available',
   'admin.cluster.upgradeUnavailable':'Upgrade unavailable',
   'admin.cluster.upgradeUnavailable':'Upgrade unavailable',
 
 
-  'question.sure':'Are you sure?',
-  'yes':'Yes',
-  'no':'No',
-
   'services.service.start':'Start',
   'services.service.start':'Start',
   'services.service.stop':'Stop',
   'services.service.stop':'Stop',
-  'services.service.confirmation.header':'Confirmation',
-  'services.service.confirmation.body':'Are you sure?',
   'services.service.summary.version':'Version',
   'services.service.summary.version':'Version',
   'services.service.summary.nameNode':'NameNode Web UI',
   'services.service.summary.nameNode':'NameNode Web UI',
   'services.service.summary.nameNodeUptime':'NameNode Uptime',
   'services.service.summary.nameNodeUptime':'NameNode Uptime',
@@ -651,19 +649,11 @@ Em.I18n.translations = {
   'host.host.componentFilter.slave':'Slave Components',
   'host.host.componentFilter.slave':'Slave Components',
   'host.host.componentFilter.client':'Client 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':'No alerts',
   'hosts.host.alert.noAlerts.message':'There are no alerts for this host.',
   '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.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.mastersDown':"The following master components are down:\n",
   'hosts.host.healthStatus.slavesDown':"The following slave 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.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.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}.',
   'hosts.cant.do.popup.workingList.body':'You cannot delete this host because following slave services are not fully stopped or decommissioned: {0}.',

+ 23 - 0
ambari-web/app/views/common/modal_popup.js

@@ -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>",
     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
     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();
+    }
+  });
 }
 }

+ 0 - 18
ambari-web/app/views/main/service/item.js

@@ -44,22 +44,4 @@ App.MainServiceItemView = Em.View.extend({
   hasConfigTab: function(){
   hasConfigTab: function(){
     return this.get("controller.content.isConfigurable");
     return this.get("controller.content.isConfigurable");
   }.property('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'))
-  }
 });
 });