Browse Source

AMBARI-5027 Maint mode usability improvements. (ababiichuk)

aBabiichuk 11 years ago
parent
commit
a04bd5fb2e

+ 7 - 3
ambari-web/app/controllers/main/host.js

@@ -270,7 +270,9 @@ App.MainHostController = Em.ArrayController.extend({
 
   updateHostPassiveState: function(data, opt, params) {
     params.hosts.setEach('passiveState', params.passive_state);
-    App.router.get('clusterController').loadUpdatedStatus(function(){});
+    App.router.get('clusterController').loadUpdatedStatus(function(){
+      batchUtils.infoPassiveState(params.passive_state);
+    });
   },
   /**
    * Bulk operation for selected hostComponents
@@ -461,8 +463,10 @@ App.MainHostController = Em.ArrayController.extend({
     }
   },
 
-  updateHostComponentsPassiveState: function() {
-    App.router.get('clusterController').loadUpdatedStatus(function(){});
+  updateHostComponentsPassiveState: function(data, opt, params) {
+    App.router.get('clusterController').loadUpdatedStatus(function(){
+      batchUtils.infoPassiveState(params.passive_state);
+    });
   },
   /**
    * Show BO popup after bulk request

+ 5 - 2
ambari-web/app/controllers/main/host/details.js

@@ -1004,8 +1004,10 @@ App.MainHostDetailsController = Em.Controller.extend({
 
   updateHost: function(data, opt, params) {
     this.set('content.passiveState', params.passive_state);
-    App.router.get('clusterController').loadUpdatedStatus(function(){});
-  },
+    App.router.get('clusterController').loadUpdatedStatus(function(){
+      batchUtils.infoPassiveState(params.passive_state);
+    });
+ },
 
   doStartAllComponents: function() {
     var self = this;
@@ -1270,6 +1272,7 @@ App.MainHostDetailsController = Em.Controller.extend({
 
   updateComponentPassiveState: function(data, opt, params) {
     params.component.set('passiveState',params.passive_state);
+    batchUtils.infoPassiveState(params.passive_state);
   },
 
   /**

+ 1 - 0
ambari-web/app/controllers/main/service/item.js

@@ -225,6 +225,7 @@ App.MainServiceItemController = Em.Controller.extend({
     var self = this;
     App.router.get('clusterController').loadUpdatedStatus(function(){
       self.set('content.passiveState', params.passive_state);
+      batchUtils.infoPassiveState(params.passive_state);
     });
   },
 

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

@@ -232,6 +232,7 @@ Em.I18n.translations = {
   'hostPopup.bgop.sourceRequestSchedule.running': 'Future operations of this batch request can be aborted',
   'hostPopup.bgop.sourceRequestSchedule.aborted': 'Future operations of this batch request have been aborted',
   'hostPopup.bgop.abort.rollingRestart': 'Abort Rolling Restart',
+  'hostPopup.warning.alertsTimeOut': 'Maintenance Mode has been turned {0}. It may take a few minutes for the alerts to be {1}.',
 
   'question.sure':'Are you sure?',
 

+ 17 - 0
ambari-web/app/utils/batch_scheduled_requests.js

@@ -304,6 +304,23 @@ module.exports = {
     });
   },
 
+  /**
+   * Warn user that alerts will be updated in few minutes
+   * @param {String} hostComponentName
+   */
+  infoPassiveState: function(passiveState) {
+    var enabled = passiveState == 'OFF' ? 'enabled' : 'suppressed';
+    App.ModalPopup.show({
+      header: Em.I18n.t('common.information'),
+      bodyClass: Ember.View.extend({
+        template: Ember.Handlebars.compile('<p>{{view.message}}</p>'),
+        message: function() {
+          return Em.I18n.t('hostPopup.warning.alertsTimeOut').format(passiveState.toLowerCase(), enabled);
+        }.property()
+      })
+    });
+  },
+
   /**
    * Retrieves the latest information about a specific request schedule
    * identified by 'requestScheduleId'