You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rz...@apache.org on 2017/02/28 20:53:01 UTC

ambari git commit: AMBARI-20194 - Enable/Disable UI objects related to managing alert targets based on user's privileges (rzang)

Repository: ambari
Updated Branches:
  refs/heads/trunk aeb5076ad -> aa057cb42


AMBARI-20194 - Enable/Disable UI objects related to managing alert targets based on user's privileges <fix1>(rzang)


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

Branch: refs/heads/trunk
Commit: aa057cb42b08676fac4d4ef75d1b77ad3b6da893
Parents: aeb5076
Author: Richard Zang <rz...@apache.org>
Authored: Tue Feb 28 12:52:12 2017 -0800
Committer: Richard Zang <rz...@apache.org>
Committed: Tue Feb 28 12:52:12 2017 -0800

----------------------------------------------------------------------
 ambari-web/app/app.js                                 |  2 +-
 .../alerts/alert_definitions_actions_controller.js    |  2 +-
 .../main/alerts/manage_alert_notifications_popup.hbs  |  3 +--
 .../main/alerts/manage_alert_notifications_view.js    | 13 ++++---------
 .../alerts/manage_alert_notifications_view_test.js    | 14 --------------
 5 files changed, 7 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/aa057cb4/ambari-web/app/app.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js
index ee0b6cf..9c7d874 100644
--- a/ambari-web/app/app.js
+++ b/ambari-web/app/app.js
@@ -42,7 +42,7 @@ module.exports = Em.Application.create({
   isOperator: false,
   isClusterUser: false,
   isPermissionDataLoaded: false,
-  auth: null,
+  auth: undefined,
   isOnlyViewUser: function() {
     return App.auth && (App.auth.length == 0 || (App.isAuthorized('VIEW.USE') && App.auth.length == 1));
   }.property('auth'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/aa057cb4/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 f37876f..71d9acf 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
@@ -57,7 +57,7 @@ App.MainAlertDefinitionActionsController = Em.ArrayController.extend({
       showDivider: false
     });
     return content;
-  }.property('App.supports.createAlerts'),
+  }.property('App.supports.createAlerts', 'App.auth'),
 
   /**
    * Common handler for menu item click

http://git-wip-us.apache.org/repos/asf/ambari/blob/aa057cb4/ambari-web/app/templates/main/alerts/manage_alert_notifications_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/manage_alert_notifications_popup.hbs b/ambari-web/app/templates/main/alerts/manage_alert_notifications_popup.hbs
index 9b5442d..51676ae 100644
--- a/ambari-web/app/templates/main/alerts/manage_alert_notifications_popup.hbs
+++ b/ambari-web/app/templates/main/alerts/manage_alert_notifications_popup.hbs
@@ -32,14 +32,13 @@
           <div class="btn-toolbar pull-right">
             <button rel="button-info" class="btn btn-default add-notification-button"
               {{translateAttr data-original-title="alerts.actions.manage_alert_notifications_popup.addButton"}}
-              {{bindAttr disabled="view.isAddButtonDisabled"}}
               {{action addAlertNotification target="controller"}}><i class="glyphicon glyphicon-plus"></i></button>
             <button rel="button-info" class="btn btn-default remove-notification-button"
               {{translateAttr data-original-title="alerts.actions.manage_alert_notifications_popup.removeButton"}}
               {{bindAttr disabled="view.isRemoveButtonDisabled"}}
               {{action deleteAlertNotification target="controller"}}><i class="glyphicon glyphicon-minus"></i></button>
             <div class="btn-group notification-actions-button dropup">
-              <button class="btn btn-default dropdown-toggle" data-toggle="dropdown" {{bindAttr disabled="view.isAddButtonDisabled"}}>
+              <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                 <i class="glyphicon glyphicon-cog"></i>&nbsp;<span class="caret"></span>
               </button>
               <ul class="dropdown-menu">

http://git-wip-us.apache.org/repos/asf/ambari/blob/aa057cb4/ambari-web/app/views/main/alerts/manage_alert_notifications_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alerts/manage_alert_notifications_view.js b/ambari-web/app/views/main/alerts/manage_alert_notifications_view.js
index 5d81281..22eadcc 100644
--- a/ambari-web/app/views/main/alerts/manage_alert_notifications_view.js
+++ b/ambari-web/app/views/main/alerts/manage_alert_notifications_view.js
@@ -36,27 +36,22 @@ App.ManageAlertNotificationsView = Em.View.extend({
   /**
    * @type {boolean}
    */
-  isAddButtonDisabled: Em.computed.alias('App.isOperator'),
+  isEditButtonDisabled: Em.computed.or('!someAlertNotificationIsSelected', '!controller.selectedAlertNotification.enabled'),
 
   /**
    * @type {boolean}
    */
-  isEditButtonDisabled: Em.computed.or('!someAlertNotificationIsSelected', 'App.isOperator', '!controller.selectedAlertNotification.enabled'),
+  isRemoveButtonDisabled: Em.computed.or('!someAlertNotificationIsSelected'),
 
   /**
    * @type {boolean}
    */
-  isRemoveButtonDisabled: Em.computed.or('!someAlertNotificationIsSelected', 'App.isOperator'),
+  isDuplicateButtonDisabled: Em.computed.or('!someAlertNotificationIsSelected', '!controller.selectedAlertNotification.enabled'),
 
   /**
    * @type {boolean}
    */
-  isDuplicateButtonDisabled: Em.computed.or('!someAlertNotificationIsSelected', 'App.isOperator', '!controller.selectedAlertNotification.enabled'),
-
-  /**
-   * @type {boolean}
-   */
-  isEnableOrDisableButtonDisabled: Em.computed.or('!someAlertNotificationIsSelected', 'App.isOperator'),
+  isEnableOrDisableButtonDisabled: Em.computed.or('!someAlertNotificationIsSelected'),
 
   /**
    * Show EMAIL information if selected alert notification has type EMAIL

http://git-wip-us.apache.org/repos/asf/ambari/blob/aa057cb4/ambari-web/test/views/main/alerts/manage_alert_notifications_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/alerts/manage_alert_notifications_view_test.js b/ambari-web/test/views/main/alerts/manage_alert_notifications_view_test.js
index bb04a0d..961e709 100644
--- a/ambari-web/test/views/main/alerts/manage_alert_notifications_view_test.js
+++ b/ambari-web/test/views/main/alerts/manage_alert_notifications_view_test.js
@@ -229,20 +229,6 @@ describe('App.ManageAlertNotificationsView', function () {
         view.onLoad();
         expect(view.get('selectedAlertNotification')).to.be.null;
       });
-
-      it("isAddButtonDisabled should be true", function () {
-        view.set('isAddButtonDisabled', true);
-        App.set('isOperator', true);
-        view.onLoad();
-        expect(view.get('isAddButtonDisabled')).to.be.true;
-      });
-
-      it("isAddButtonDisabled should be false", function () {
-        view.set('isAddButtonDisabled', true);
-        App.set('isOperator', false);
-        view.onLoad();
-        expect(view.get('isAddButtonDisabled')).to.be.false;
-      });
     });
 
     describe("controller.isLoaded is true, alertNotifications is array", function () {