Repository: ambari Updated Branches: refs/heads/branch-2.5 9d0fc1c45 -> 8f9b557c1
AMBARI-20194 - Enable/Disable UI objects related to managing alert targets based on user's privileges (rzang) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8f9b557c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8f9b557c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8f9b557c Branch: refs/heads/branch-2.5 Commit: 8f9b557c1908e48d4617c6e2773c1b4b75c623e4 Parents: 9d0fc1c Author: Richard Zang <[email protected]> Authored: Mon Feb 27 18:01:57 2017 -0800 Committer: Richard Zang <[email protected]> Committed: Mon Feb 27 18:45:45 2017 -0800 ---------------------------------------------------------------------- .../alert_definitions_actions_controller.js | 42 +++++++++++--------- 1 file changed, 24 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/8f9b557c/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 f3f0387..863855c 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 @@ -26,32 +26,38 @@ App.MainAlertDefinitionActionsController = Em.ArrayController.extend({ * List of available actions for alert definitions * @type {{title: string, icon: string, action: string, showDivider: boolean}[]} */ - content: [ - /*{ - title: Em.I18n.t('alerts.actions.create'), - icon: 'icon-plus', - action: 'createNewAlertDefinition', - showDivider: true - },*/ - { + content: function() { + var content = []; + if (App.supports.createAlerts) { + content.push({ + title: Em.I18n.t('alerts.actions.create'), + icon: 'icon-plus', + action: 'createNewAlertDefinition', + showDivider: true + }); + } + content.push({ title: Em.I18n.t('alerts.actions.manageGroups'), icon: 'icon-th-large', action: 'manageAlertGroups', showDivider: false - }, - { - title: Em.I18n.t('alerts.actions.manageNotifications'), - icon: 'icon-envelope-alt', - action: 'manageNotifications', - showDivider: false - }, - { + }); + if (App.isAuthorized('CLUSTER.MANAGE_ALERT_NOTIFICATIONS')) { + content.push({ + title: Em.I18n.t('alerts.actions.manageNotifications'), + icon: 'icon-envelope-alt', + action: 'manageNotifications', + showDivider: false + }); + } + content.push({ title: Em.I18n.t('alerts.actions.manageSettings'), icon: 'icon-cogs', action: 'manageSettings', showDivider: false - } - ], + }); + return content; + }.property('App.supports.createAlerts'), /** * Common handler for menu item click
