Parcourir la source

AMBARI-8740. Alerts UI: some minor clean up. (xiwang via yusaku)

Yusaku Sako il y a 10 ans
Parent
commit
6a39f2b37e

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

@@ -1900,6 +1900,7 @@ Em.I18n.translations = {
   'alerts.actions.manage_alert_groups_popup.removeButtonDisabled':'Cannot delete default alert group',
   'alerts.actions.manage_alert_groups_popup.renameButton':'Rename Alert Group',
   'alerts.actions.manage_alert_groups_popup.duplicateButton':'Duplicate Alert Group',
+  'alerts.actions.manage_alert_groups_popup.addDefinition.noDefinitions':'No alert definitions to display',
   'alerts.actions.manage_alert_groups_popup.addDefinition':'Add alert definitions to selected Alert Group',
   'alerts.actions.manage_alert_groups_popup.addDefinitionDisabled':'There are no available alert definitions to add',
   'alerts.actions.manage_alert_groups_popup.addDefinitionToDefault': 'Cannot modify default alert group',

+ 23 - 16
ambari-web/app/templates/main/alerts/add_definition_to_group_popup.hbs

@@ -97,26 +97,33 @@
           <th width="25%">{{t common.service}}</th>
           <th width="30%">{{t common.component}}</th>
         </tr>
-    </thead>
+      </thead>
     </table>
     <div class="hosts-table-container">
       <table class="table table-striped hosts-table">
-        {{#each entry in view.pageContent}}
-          <tr {{bindAttr class="entry.filtered::hidden"}}>
-            <td width="10%">
-              {{view Ember.Checkbox checkedBinding="entry.selected"}}
-            </td>
-            <td width="35%">
-              {{entry.label}}
-            </td>
-            <td>
-              {{entry.serviceNameDisplay}}
-            </td>
-            <td>
-              {{entry.componentNameDisplay}}
-            </td>
+        {{#if view.pageContent}}
+          {{#each entry in view.pageContent}}
+            <tr {{bindAttr class="entry.filtered::hidden"}}>
+              <td width="10%">
+                {{view Ember.Checkbox checkedBinding="entry.selected"}}
+              </td>
+              <td width="35%">
+                {{entry.label}}
+              </td>
+              <td>
+                {{entry.serviceNameDisplay}}
+              </td>
+              <td>
+                {{entry.componentNameDisplay}}
+              </td>
+            </tr>
+          {{/each}}
+        {{else}}
+          <tr>
+            <td width="30%"></td>
+            <td>{{t alerts.actions.manage_alert_groups_popup.addDefinition.noDefinitions}}</td>
           </tr>
-        {{/each}}
+        {{/if}}
       </table>
     </div>
 </div>

+ 1 - 1
ambari-web/app/views/main/alert_definitions_view.js

@@ -171,7 +171,7 @@ App.MainAlertDefinitionsView = App.TableView.extend({
       },
       {
         value: 'PENDING',
-        label: 'PENDING'
+        label: 'NONE'
       }
     ],
     onChangeValue: function () {

+ 11 - 4
ambari-web/app/views/main/alerts/manage_alert_groups_view.js

@@ -130,15 +130,22 @@ App.MainAlertsManageAlertGroupView = Em.View.extend({
       else {
         return  Em.I18n.t('alerts.actions.manage_alert_groups_popup.addDefinition');
       }
-  }.property('controller.selectedAlertGroup.isDefault', 'controller.selectedAlertGroup.isAddDefinitionsDisabled'),
+  }.property('controller.selectedAlertGroup.default', 'controller.selectedAlertGroup.isAddDefinitionsDisabled'),
 
   /**
    * Tooltip for "Remove definition from group"-button
    * @type {string}
    */
   removeDefinitionTooltip: function () {
-    return this.get('controller.isDeleteDefinitionsDisabled') ? Em.I18n.t('alerts.actions.manage_alert_groups_popup.removeDefinitionDisabled') :
-        Em.I18n.t('alerts.actions.manage_alert_groups_popup.removeDefinition');
-  }.property('controller.isDeleteDefinitionsDisabled')
+    if (this.get('controller.selectedAlertGroup.default')) {
+      return Em.I18n.t('alerts.actions.manage_alert_groups_popup.removeDefinitionDisabled');
+    }
+    else
+      if (this.get('controller.isDeleteDefinitionsDisabled')) {
+        return 'Nothing to delete';
+      } else {
+        return Em.I18n.t('alerts.actions.manage_alert_groups_popup.removeDefinition');
+      }
+  }.property('controller.selectedAlertGroup.default', 'controller.isDeleteDefinitionsDisabled')
 
 });