ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhew...@apache.org
Subject ambari git commit: AMBARI-15899 Alert Check Retries: UX edits v1 (zhewang)
Date Fri, 15 Apr 2016 17:03:04 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk e3c981640 -> f39a799f3


AMBARI-15899 Alert Check Retries: UX edits v1 (zhewang)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f39a799f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f39a799f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f39a799f

Branch: refs/heads/trunk
Commit: f39a799f3a1dad9e23482cb810151e3f73266ef3
Parents: e3c9816
Author: Zhe (Joe) Wang <zhewang@apache.org>
Authored: Fri Apr 15 10:02:35 2016 -0700
Committer: Zhe (Joe) Wang <zhewang@apache.org>
Committed: Fri Apr 15 10:02:35 2016 -0700

----------------------------------------------------------------------
 ambari-web/app/config.js                        |   1 +
 .../controllers/global/cluster_controller.js    |   4 +
 .../app/controllers/global/update_controller.js |  28 ++++
 .../alert_definitions_actions_controller.js     |  97 +++++-------
 .../alerts/definition_details_controller.js     | 148 +++++++++----------
 ambari-web/app/messages.js                      |  27 ++--
 ambari-web/app/styles/alerts.less               |   9 +-
 ambari-web/app/styles/application.less          |   3 +
 .../common/modal_popups/prompt_popup.hbs        |   8 +-
 .../main/alerts/definition_details.hbs          |  47 ++----
 .../main/alerts/definition_details_view.js      |   1 -
 .../global/update_controller_test.js            |   2 +-
 .../main/alerts/definition_details_view_test.js |   2 +-
 13 files changed, 178 insertions(+), 199 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f39a799f/ambari-web/app/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/config.js b/ambari-web/app/config.js
index 06afa49..98aa380 100644
--- a/ambari-web/app/config.js
+++ b/ambari-web/app/config.js
@@ -41,6 +41,7 @@ App.hostStatusCountersUpdateInterval = 10000;
 App.alertDefinitionsUpdateInterval = 10000;
 App.alertInstancesUpdateInterval = 10000;
 App.alertGroupsUpdateInterval = 10000;
+App.clusterEnvUpdateInterval = 10000;
 App.pageReloadTime = 3600000;
 App.nnCheckpointAgeAlertThreshold = 12; // in hours
 App.singleNodeInstall = false;

http://git-wip-us.apache.org/repos/asf/ambari/blob/f39a799f/ambari-web/app/controllers/global/cluster_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index 327bd45..9862261 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -24,6 +24,7 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
   name: 'clusterController',
   isLoaded: false,
   ambariProperties: null,
+  clusterEnv: null,
   clusterDataLoadedPercent: 'width:0', // 0 to 1
 
   isClusterNameLoaded: false,
@@ -276,6 +277,9 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
       });
     });
 
+    //load cluster-env, used by alert check tolerance // TODO services auto-start
+    updater.updateClusterEnv();
+
     /*  Root service mapper maps all the data exposed under Ambari root service which includes
ambari configurations i.e ambari-properties
      ** This is useful information but its not being used in the code anywhere as of now
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f39a799f/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index 62bab46..757d353 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -205,6 +205,7 @@ App.UpdateController = Em.Controller.extend({
       if (!App.get('router.mainAlertInstancesController.isUpdating')) {
         App.updater.run(this, 'updateUnhealthyAlertInstances', 'updateAlertInstances', App.alertInstancesUpdateInterval,
'\/main\/alerts.*');
       }
+      App.updater.run(this, 'updateClusterEnv', 'isWorking', App.clusterEnvUpdateInterval);
       App.updater.run(this, 'updateUpgradeState', 'isWorking', App.bgOperationsUpdateInterval);
       App.updater.run(this, 'updateWizardWatcher', 'isWorking', App.bgOperationsUpdateInterval);
     }
@@ -607,6 +608,33 @@ App.UpdateController = Em.Controller.extend({
     }
   },
 
+  //TODO - update service auto-start to use this
+  updateClusterEnv: function (callback) {
+    this.loadClusterConfig(callback).done(function (data) {
+      var tag = [
+        {
+          siteName: 'cluster-env',
+          tagName: data.Clusters.desired_configs['cluster-env'].tag,
+          newTagName: null
+        }
+      ];
+      App.router.get('configurationController').getConfigsByTags(tag).done(function (config)
{
+        App.router.get('clusterController').set('clusterEnv', config[0]);
+      });
+    });
+  },
+
+  loadClusterConfig: function (callback) {
+    return App.ajax.send({
+      name: 'config.tags.site',
+      sender: this,
+      data: {
+        site: 'cluster-env'
+      },
+      callback: callback
+    });
+  },
+
   updateWizardWatcher: function(callback) {
     App.router.get('wizardWatcherController').getUser().complete(callback);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f39a799f/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
b/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
index 1712b6f..51d8c42 100644
--- a/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
+++ b/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
@@ -218,73 +218,42 @@ App.MainAlertDefinitionActionsController = Em.ArrayController.extend({
    */
   manageSettings: function () {
     var controller = this;
-    var loadingPopup = App.ModalPopup.show({
-      header: Em.I18n.t('jobs.loadingTasks'),
-      primary: false,
-      secondary: false,
-      bodyClass: Em.View.extend({
-        template: Em.Handlebars.compile('{{view App.SpinnerView}}')
-      })
-    });
-    this.loadClusterConfig().done(function (data) {
-      var tag = [
-        {
-          siteName: 'cluster-env',
-          tagName: data.Clusters.desired_configs['cluster-env'].tag,
-          newTagName: null
-        }
-      ];
-      App.router.get('configurationController').getConfigsByTags(tag).done(function (config)
{
-        var configProperties = config[0].properties;
+    var configProperties = App.router.get('clusterController.clusterEnv.properties');
 
-        loadingPopup.hide();
-        return App.ModalPopup.show({
-          classNames: ['fourty-percent-width-modal'],
-          header: Em.I18n.t('alerts.actions.manageSettings'),
-          primary: Em.I18n.t('common.save'),
-          secondary: Em.I18n.t('common.cancel'),
-          inputValue: configProperties.alerts_repeat_tolerance || '1',
-          errorMessage: Em.I18n.t('alerts.actions.editRepeatTolerance.error'),
-          isInvalid: function () {
-            var intValue = Number(this.get('inputValue'));
-            return this.get('inputValue') !== 'DEBUG' && (!validator.isValidInt(intValue)
|| intValue < 1);
-          }.property('inputValue'),
-          disablePrimary: Em.computed.alias('isInvalid'),
-          onPrimary: function () {
-            if (this.get('isInvalid')) {
-              return;
-            }
-            configProperties.alerts_repeat_tolerance = this.get('inputValue');
-            App.ajax.send({
-              name: 'admin.save_configs',
-              sender: controller,
-              data: {
-                siteName: 'cluster-env',
-                properties: configProperties
-              },
-              error: 'manageSettingsErrorCallback'
-            });
-            this.hide();
+    return App.ModalPopup.show({
+      classNames: ['fourty-percent-width-modal'],
+      header: Em.I18n.t('alerts.actions.manageSettings'),
+      primary: Em.I18n.t('common.save'),
+      secondary: Em.I18n.t('common.cancel'),
+      inputValue: configProperties.alerts_repeat_tolerance || '1',
+      errorMessage: Em.I18n.t('alerts.actions.editRepeatTolerance.error'),
+      isInvalid: function () {
+        var intValue = Number(this.get('inputValue'));
+      return this.get('inputValue') !== 'DEBUG' && (!validator.isValidInt(intValue)
|| intValue < 1 || intValue > 99);
+      }.property('inputValue'),
+      disablePrimary: Em.computed.alias('isInvalid'),
+      onPrimary: function () {
+        if (this.get('isInvalid')) {
+          return;
+        }
+        configProperties.alerts_repeat_tolerance = this.get('inputValue');
+        App.ajax.send({
+          name: 'admin.save_configs',
+          sender: controller,
+          data: {
+            siteName: 'cluster-env',
+            properties: configProperties
           },
-          bodyClass: Ember.View.extend({
-            templateName: require('templates/common/modal_popups/prompt_popup'),
-            text: Em.I18n.t('alerts.actions.editRepeatTolerance.text'),
-            title: Em.I18n.t('alerts.actions.editRepeatTolerance.title'),
-            description: Em.I18n.t('alerts.actions.editRepeatTolerance.description'),
-            label: Em.I18n.t('alerts.actions.editRepeatTolerance.label')
-          })
+          error: 'manageSettingsErrorCallback'
         });
-      });
-    });
-  },
-
-  loadClusterConfig: function () {
-    return App.ajax.send({
-      name: 'config.tags.site',
-      sender: this,
-      data: {
-        site: 'cluster-env'
-      }
+        this.hide();
+      },
+      bodyClass: Ember.View.extend({
+        templateName: require('templates/common/modal_popups/prompt_popup'),
+        title: Em.I18n.t('alerts.actions.editRepeatTolerance.title'),
+        description: Em.I18n.t('alerts.actions.editRepeatTolerance.description'),
+        label: Em.I18n.t('alerts.actions.editRepeatTolerance.label')
+      })
     });
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f39a799f/ambari-web/app/controllers/main/alerts/definition_details_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/definition_details_controller.js b/ambari-web/app/controllers/main/alerts/definition_details_controller.js
index 8e716bc..15e09a4 100644
--- a/ambari-web/app/controllers/main/alerts/definition_details_controller.js
+++ b/ambari-web/app/controllers/main/alerts/definition_details_controller.js
@@ -230,7 +230,7 @@ App.MainAlertDefinitionDetailsController = Em.Controller.extend({
     });
 
     return App.showConfirmationFeedBackPopup(function (query) {
-      self.toggleDefinitionState(alertDefinition, "enabled");
+      self.toggleDefinitionState(alertDefinition);
     }, bodyMessage);
   },
 
@@ -241,101 +241,99 @@ App.MainAlertDefinitionDetailsController = Em.Controller.extend({
    * @returns {$.ajax}
    * @method toggleDefinitionState
    */
-  toggleDefinitionState: function (alertDefinition, property) {
-    var newState = !alertDefinition.get(property);
-    alertDefinition.set(property, newState);
-    var data = {};
-    data['AlertDefinition/' + property] = newState;
+  toggleDefinitionState: function (alertDefinition) {
+    var newState = !alertDefinition.get('enabled');
+    alertDefinition.set('enabled', newState);
     return App.ajax.send({
       name: 'alerts.update_alert_definition',
       sender: this,
       data: {
         id: alertDefinition.get('id'),
-        data: data
+        data: {
+          "AlertDefinition/enabled": newState
+        }
       }
     });
   },
 
-  /**
-   * "Disable / Enable Repeat Tolerance" button handler
-   * @method toggleRepeatTolerance
-   */
-  toggleRepeatTolerance: function () {
+  globalAlertsRepeatTolerance: function () {
+    return App.router.get('clusterController.clusterEnv.properties.alerts_repeat_tolerance')
|| "1";
+  }.property('App.router.clusterController.clusterEnv'),
+
+  enableRepeatTolerance: function (enable) {
     var alertDefinition = this.get('content');
-    var self = this;
-    var bodyMessage = Em.Object.create({
-      confirmMsg: alertDefinition.get('repeat_tolerance_enabled') ? Em.I18n.t('alerts.table.repeatTolerance.enabled.confirm.msg')
: Em.I18n.t('alerts.table.repeatTolerance.disabled.confirm.msg').format(alertDefinition.get('repeat_tolerance')
|| 1),
-      confirmButton: Em.I18n.t('common.confirm')
+    alertDefinition.set('repeat_tolerance_enabled', enable);
+    return App.ajax.send({
+      name: 'alerts.update_alert_definition',
+      sender: this,
+      data: {
+        id: alertDefinition.get('id'),
+        data: {
+          "AlertDefinition/repeat_tolerance_enabled": enable
+        }
+      }
     });
-
-    return App.showConfirmationFeedBackPopup(function (query) {
-      self.toggleDefinitionState(alertDefinition, "repeat_tolerance_enabled");
-    }, bodyMessage);
   },
 
   editRepeatTolerance: function () {
     var self = this;
     var alertDefinition = this.get('content');
 
-    var loadingPopup = App.ModalPopup.show({
-      header: Em.I18n.t('jobs.loadingTasks'),
-      primary: false,
-      secondary: false,
-      bodyClass: Em.View.extend({
-        template: Em.Handlebars.compile('{{view App.SpinnerView}}')
-      })
-    });
+    var alertsRepeatTolerance = App.router.get('clusterController.clusterEnv.properties.alerts_repeat_tolerance')
|| "1";
 
-    App.router.get('mainAlertDefinitionActionsController').loadClusterConfig().done(function
(data) {
-      var tag = [
-        {
-          siteName: 'cluster-env',
-          tagName: data.Clusters.desired_configs['cluster-env'].tag,
-          newTagName: null
+    return App.ModalPopup.show({
+      classNames: ['fourty-percent-width-modal'],
+      header: Em.I18n.t('alerts.actions.editRepeatTolerance.header'),
+      primary: Em.I18n.t('common.save'),
+      secondary: Em.I18n.t('common.cancel'),
+      inputValue: self.get('content.repeat_tolerance_enabled') ? (self.get('content.repeat_tolerance')
|| 1) : alertsRepeatTolerance,
+      errorMessage: Em.I18n.t('alerts.actions.editRepeatTolerance.error'),
+      isInvalid: function () {
+        var intValue = Number(this.get('inputValue'));
+        return this.get('inputValue') !== 'DEBUG' && (!validator.isValidInt(intValue)
|| intValue < 1 || intValue > 99);
+      }.property('inputValue'),
+      isChanged: function () {
+        var intValue = Number(this.get('inputValue'));
+        var isValueChanged = intValue != alertsRepeatTolerance;
+        return isValueChanged;
+      }.property('inputValue'),
+      doRestoreDefaultValue: function () {
+        this.set('inputValue', alertsRepeatTolerance);
+        this.$('[data-toggle=tooltip]').tooltip('destroy');
+      },
+      disablePrimary: Em.computed.alias('isInvalid'),
+      onPrimary: function () {
+        if (this.get('isInvalid')) {
+          return;
         }
-      ];
-      App.router.get('configurationController').getConfigsByTags(tag).done(function (config)
{
-        var configProperties = config[0].properties;
-
-        loadingPopup.hide();
-        return App.ModalPopup.show({
-          classNames: ['fourty-percent-width-modal'],
-          header: Em.I18n.t('alerts.actions.editRepeatTolerance.header'),
-          primary: Em.I18n.t('common.save'),
-          secondary: Em.I18n.t('common.cancel'),
-          inputValue: self.get('content.repeat_tolerance') || 1,
-          errorMessage: Em.I18n.t('alerts.actions.editRepeatTolerance.error'),
-          isInvalid: function () {
-            var intValue = Number(this.get('inputValue'));
-            return this.get('inputValue') !== 'DEBUG' && (!validator.isValidInt(intValue)
|| intValue < 1);
-          }.property('inputValue'),
-          disablePrimary: Em.computed.alias('isInvalid'),
-          onPrimary: function () {
-            if (this.get('isInvalid')) {
-              return;
+        var input = this.get('inputValue');
+        self.set('content.repeat_tolerance', input);
+        if (input == alertsRepeatTolerance) {
+          self.enableRepeatTolerance(false);
+        } else {
+          self.enableRepeatTolerance(true);
+        }
+        App.ajax.send({
+          name: 'alerts.update_alert_definition',
+          sender: self,
+          data: {
+            id: alertDefinition.get('id'),
+            data: {
+              "AlertDefinition/repeat_tolerance": input
             }
-            self.set('content.repeat_tolerance', this.get('inputValue'));
-            App.ajax.send({
-              name: 'alerts.update_alert_definition',
-              sender: self,
-              data: {
-                id: alertDefinition.get('id'),
-                data: {
-                  "AlertDefinition/repeat_tolerance": this.get('inputValue')
-                }
-              }
-            });
-            this.hide();
-          },
-          bodyClass: Ember.View.extend({
-            templateName: require('templates/common/modal_popups/prompt_popup'),
-            text: Em.I18n.t('alerts.actions.editRepeatTolerance.body').format(configProperties.alerts_repeat_tolerance
|| "1"),
-            title: Em.I18n.t('alerts.actions.editRepeatTolerance.title'),
-            description: Em.I18n.t('alerts.actions.editRepeatTolerance.description'),
-            label: Em.I18n.t('alerts.actions.editRepeatTolerance.label')
-          })
+          }
         });
-      });
+        this.hide();
+      },
+      didInsertElement: function () {
+        App.tooltip(this.$('[data-toggle=tooltip]'));
+      },
+      bodyClass: Ember.View.extend({
+        templateName: require('templates/common/modal_popups/prompt_popup'),
+        title: Em.I18n.t('alerts.actions.editRepeatTolerance.title'),
+        description: Em.I18n.t('alerts.actions.editRepeatTolerance.description'),
+        label: Em.I18n.t('alerts.actions.editRepeatTolerance.label')
+      })
     });
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f39a799f/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 14c957c..8d73bb3 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -214,6 +214,7 @@ Em.I18n.translations = {
   'common.stacks': 'Stacks',
   'common.stack': 'Stack',
   'common.reset': 'Reset',
+  'common.reset.default': 'Reset to default',
   'common.resume': 'Resume',
   'common.path': 'Path',
   'common.patch': 'Patch',
@@ -328,7 +329,7 @@ Em.I18n.translations = {
   'models.alert_instance.tiggered.verbose': "Occurred on {0} <br> Checked on {1}",
   'models.alert_definition.triggered.verbose': "Occurred on {0}",
   'models.alert_definition.triggered.checked': "Status Changed: {0}\nLast Checked: {1}",
-  'models.alert_definition.check.retry': "Retried {0} out of {1} alerts before sending notifications",
+  'models.alert_definition.check.retry': "Alert Check {0} out of {1}",
 
   'passiveState.turnOn':'Turn On Maintenance Mode',
   'passiveState.turnOff':'Turn Off Maintenance Mode',
@@ -1003,16 +1004,14 @@ Em.I18n.translations = {
   'alerts.actions.manageGroups': 'Manage Alert Groups',
   'alerts.actions.manageNotifications': 'Manage Notifications',
   'alerts.actions.manageNotifications.info': 'You can manage notification methods and recipients.',
-  'alerts.actions.editRepeatTolerance.text': 'Manage global setting for alerts',
-  'alerts.actions.editRepeatTolerance.header': 'Edit Alert Check Retry Count',
-  'alerts.actions.editRepeatTolerance.body': 'This will override the global check retry count
{0} for this alert.',
-  'alerts.actions.editRepeatTolerance.title': 'Alert Check Retries',
-  'alerts.actions.editRepeatTolerance.description': 'Set the amount of alert check retries
to perform before dispatching a notification.' +
-    'If during an alert check a state change occurs, Ambari will retry this number of times
before dispatching a notification. Increase this number if your environment experiences temporal
issues.',
-  'alerts.actions.editRepeatTolerance.label': 'Retries:',
-  'alerts.actions.editRepeatTolerance.error':'Input should be a positive integer.',
+  'alerts.actions.editRepeatTolerance.header': 'Edit Alert Check Count',
+  'alerts.actions.editRepeatTolerance.title': 'Alert Check Counts',
+  'alerts.actions.editRepeatTolerance.description': 'Set the number of alert checks to perform
before dispatching a notification. ' +
+    'If during an alert check a state change occurs, Ambari will attempt to check this number
of times before dispatching a notification. ' +
+    'Increase this number if your environment experiences transient issues resulting in false
alerts.',
+  'alerts.actions.editRepeatTolerance.label': 'Check Count:',
+  'alerts.actions.editRepeatTolerance.error':'Input should be an integer between 1 and 99.',
   'alerts.actions.manageSettings': 'Manage Alert Settings',
-  'alerts.actions.manageGlobalRepeatTolerance.tooltip': 'This value will be overriden, if
specific repeat tolerance value is set for individual alert.',
   'alerts.actions.manageSettings.error':'Error during remote command: ',
 
   'alerts.groups.successPopup.header': 'Alert Groups processing results',
@@ -1027,8 +1026,8 @@ Em.I18n.translations = {
   'alerts.table.header.check.response': 'Response',
   'alerts.table.header.definitionName': 'Alert Definition Name',
   'alerts.table.header.notification': 'Notification',
-  'alerts.table.header.repeatTolerance': 'Alert Check Retry Count',
-  'alerts.table.header.repeatToleranceEnabled': 'Alert Check Retries',
+  'alerts.table.header.repeatTolerance': 'Check Count',
+  'alerts.table.header.default': '(default)',
   'alerts.table.state': 'State',
   'alerts.table.state.enabled': 'Enabled',
   'alerts.table.state.disabled': 'Disabled',
@@ -1038,10 +1037,6 @@ Em.I18n.translations = {
   'alerts.table.state.disabled.confirm.msg': 'You are about to Enable this alert definition.',
   'alerts.table.state.enabled.confirm.btn': 'Confirm Disable',
   'alerts.table.state.disabled.confirm.btn': 'Confirm Enable',
-  'alerts.table.repeatTolerance.enabled.tooltip': 'Click to disable alert check retries',
-  'alerts.table.repeatTolerance.disabled.tooltip': 'Click to enable alert check retries',
-  'alerts.table.repeatTolerance.enabled.confirm.msg': 'You are about to disable alert check
retries. By disabling retries, on each state change, an alert notification will be dispatched.',
-  'alerts.table.repeatTolerance.disabled.confirm.msg': 'You are about to enable alert check
retries. By enabling retries, on each state change, Ambari will retry the check {0} times
before dispatching an alert notification.',
   'alerts.filters.filteredAlertsInfo': '{0} of {1} definitions showing',
   'alerts.definition.name': 'Alert Definition Name',
   'alerts.saveChanges': 'You have unsaved changes',

http://git-wip-us.apache.org/repos/asf/ambari/blob/f39a799f/ambari-web/app/styles/alerts.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/alerts.less b/ambari-web/app/styles/alerts.less
index 24b29b2..50246e6 100644
--- a/ambari-web/app/styles/alerts.less
+++ b/ambari-web/app/styles/alerts.less
@@ -656,10 +656,7 @@
   }
 }
 /*****end styles for alert popup*****/
-.enable-disable-button,
-.repeat-tolerance-button {
-  &::before {
-    font-family: FontAwesome;
-    content: "\f011";
-  }
+.enable-disable-button::before {
+  font-family: FontAwesome;
+  content: "\f011";
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f39a799f/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 5d95df0..5ca8683 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -5773,6 +5773,9 @@ input[type="radio"].align-checkbox, input[type="checkbox"].align-checkbox
{
   form {
     margin-top: 20px;
   }
+  .prompt-input {
+    width: 80px;
+  }
 }
 
 #views {

http://git-wip-us.apache.org/repos/asf/ambari/blob/f39a799f/ambari-web/app/templates/common/modal_popups/prompt_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/modal_popups/prompt_popup.hbs b/ambari-web/app/templates/common/modal_popups/prompt_popup.hbs
index e1e03fb..43f71e2 100644
--- a/ambari-web/app/templates/common/modal_popups/prompt_popup.hbs
+++ b/ambari-web/app/templates/common/modal_popups/prompt_popup.hbs
@@ -19,12 +19,18 @@
   <form>
     <div {{bindAttr class=":control-group view.parentView.isInvalid:error"}}>
       <label class="control-label">{{view.text}}</label>
-      <br>
       <h4>{{view.title}}</h4>
       <p>{{view.description}}</p>
       <div class="controls">
         <strong>{{view.label}}&nbsp;&nbsp;</strong>
         {{view Em.TextField class="prompt-input" valueBinding="view.parentView.inputValue"}}
+        {{#if view.parentView.isChanged}}
+          <a href="#" data-toggle="tooltip" class="btn-small"
+            {{action "doRestoreDefaultValue" this target="view.parentView"}}
+            {{translateAttr data-original-title="common.reset.default"}}>
+            <i class="icon-undo"></i>
+          </a>
+        {{/if}}
       </div>
       {{#if view.parentView.isInvalid}}
         <span class="help-inline">{{view.parentView.errorMessage}}</span>

http://git-wip-us.apache.org/repos/asf/ambari/blob/f39a799f/ambari-web/app/templates/main/alerts/definition_details.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/definition_details.hbs b/ambari-web/app/templates/main/alerts/definition_details.hbs
index fab41c7..15cf168 100644
--- a/ambari-web/app/templates/main/alerts/definition_details.hbs
+++ b/ambari-web/app/templates/main/alerts/definition_details.hbs
@@ -160,46 +160,25 @@
         </div>
         {{#unless controller.content.isTypeAggregate}}
           <div class="row-fluid">
-            <div class="span6 property-name">{{t alerts.table.header.repeatToleranceEnabled}}:</div>
+            <div class="span6 property-name">{{t alerts.table.header.repeatTolerance}}:</div>
             <div class="span6">
               {{#if controller.content.repeat_tolerance_enabled}}
-                {{#isAuthorized "SERVICE.TOGGLE_ALERTS"}}
-                  <a href="#" {{action toggleRepeatTolerance target="controller"}} {{bindAttr
class="controller.content.repeat_tolerance_enabled:alert-definition-enable:alert-definition-disable"}}>
-                    <span class="repeat-tolerance-button" {{translateAttr data-original-title="alerts.table.repeatTolerance.enabled.tooltip"}}>
-                      {{view.enabledDisplay}}
-                    </span>
-                  </a>
-                {{else}}
-                  {{view.enabledDisplay}}
-                {{/isAuthorized}}
-              {{else}}
-                {{#isAuthorized "SERVICE.TOGGLE_ALERTS"}}
-                  <a href="#" {{action toggleRepeatTolerance target="controller"}} {{bindAttr
class="controller.content.repeat_tolerance_enabled:alert-definition-enable:alert-definition-disable"}}>
-                    <span class="repeat-tolerance-button" {{translateAttr data-original-title="alerts.table.repeatTolerance.disabled.tooltip"}}>
-                      {{view.disabledDisplay}}
-                    </span>
-                  </a>
-                {{else}}
-                  {{view.disabledDisplay}}
-                {{/isAuthorized}}
-              {{/if}}
-            </div>
-          </div>
-          {{#if controller.content.repeat_tolerance_enabled}}
-            <div class="row-fluid">
-              <div class="span6 property-name">{{t alerts.table.header.repeatTolerance}}:</div>
-              <div class="span6">
                 <span>
                   {{controller.content.repeat_tolerance}}
                 </span>
-                {{#isAuthorized "SERVICE.TOGGLE_ALERTS"}}
-                  <a {{action editRepeatTolerance target="controller"}} class="edit-description-button">
-                    <i class="icon-pencil"></i>
-                  </a>
-                {{/isAuthorized}}
-              </div>
+              {{else}}
+                <span>
+                  {{controller.globalAlertsRepeatTolerance}}
+                  {{t alerts.table.header.default}}
+                </span>
+              {{/if}}
+              {{#isAuthorized "SERVICE.TOGGLE_ALERTS"}}
+                <a {{action editRepeatTolerance target="controller"}} class="edit-description-button">
+                  <i class="icon-pencil"></i>
+                </a>
+              {{/isAuthorized}}
             </div>
-          {{/if}}
+          </div>
         {{/unless}}
       </div>
     </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/f39a799f/ambari-web/app/views/main/alerts/definition_details_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alerts/definition_details_view.js b/ambari-web/app/views/main/alerts/definition_details_view.js
index 606c955..656021c 100644
--- a/ambari-web/app/views/main/alerts/definition_details_view.js
+++ b/ambari-web/app/views/main/alerts/definition_details_view.js
@@ -93,7 +93,6 @@ App.MainAlertDefinitionDetailsView = App.TableView.extend({
   tooltipsUpdater: function () {
     Em.run.next(function () {
       App.tooltip($(".enable-disable-button"));
-      App.tooltip($(".repeat-tolerance-button"));
     });
   }.observes('controller.content.enabled'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f39a799f/ambari-web/test/controllers/global/update_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/update_controller_test.js b/ambari-web/test/controllers/global/update_controller_test.js
index 2c679c6..dc57a57 100644
--- a/ambari-web/test/controllers/global/update_controller_test.js
+++ b/ambari-web/test/controllers/global/update_controller_test.js
@@ -59,7 +59,7 @@ describe('App.UpdateController', function () {
 
     it('isWorking = true', function () {
       controller.set('isWorking', true);
-      expect(App.updater.run.callCount).to.equal(12);
+      expect(App.updater.run.callCount).to.equal(13);
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f39a799f/ambari-web/test/views/main/alerts/definition_details_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/alerts/definition_details_view_test.js b/ambari-web/test/views/main/alerts/definition_details_view_test.js
index e6b88b6..a98b66b 100644
--- a/ambari-web/test/views/main/alerts/definition_details_view_test.js
+++ b/ambari-web/test/views/main/alerts/definition_details_view_test.js
@@ -155,7 +155,7 @@ describe('App.MainAlertDefinitionDetailsView', function () {
     it("Em.run.next should be called", function () {
       view.tooltipsUpdater();
       expect(Em.run.next.calledOnce).to.be.true;
-      expect(App.tooltip.calledTwice).to.be.true;
+      expect(App.tooltip.calledOnce).to.be.true;
     });
   });
 


Mime
View raw message