Repository: ambari
Updated Branches:
  refs/heads/trunk ebc66f709 -> 4ff99fccb


AMBARI-15910. Read-only user is getting extra perms (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 4ff99fccb94e11ea705b91a87284c495f605829d
Parents: 2d3fb6b
Author: Oleg Nechiporenko <onechipore...@apache.org>
Authored: Fri Apr 15 12:54:29 2016 +0300
Committer: Oleg Nechiporenko <onechipore...@apache.org>
Committed: Fri Apr 15 14:43:14 2016 +0300

----------------------------------------------------------------------
 .../common/configs/config_history_flow.hbs      |  4 ++
 .../common/configs/service_version_box.hbs      |  2 +
 ambari-web/app/views/main/host/details.js       | 60 ++++++++++++++++----
 3 files changed, 54 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4ff99fcc/ambari-web/app/templates/common/configs/config_history_flow.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/config_history_flow.hbs 
b/ambari-web/app/templates/common/configs/config_history_flow.hbs
index a099a6c..73d6913 100644
--- a/ambari-web/app/templates/common/configs/config_history_flow.hbs
+++ b/ambari-web/app/templates/common/configs/config_history_flow.hbs
@@ -47,9 +47,11 @@
                   
<strong>{{view.compareServiceVersion.authorFormatted}}</strong>&nbsp;{{t 
dashboard.configHistory.info-bar.authoredOn}}
                   
&nbsp;<strong>{{view.compareServiceVersion.createdDate}}</strong>
               </div>
+            {{#isAuthorized "SERVICE.MODIFY_CONFIGS"}}
               <div class="pull-right operations-button">
                   <button class="btn btn-success"  {{action doAction 
view.serviceVersionsReferences.compare view.actionTypes.REVERT target="view"}} 
{{bindAttr disabled="view.versionActionsDisabled" 
class="view.compareServiceVersion.canBeMadeCurrent::hidden"}}>{{view.compareServiceVersion.makeCurrentButtonText}}</button>
               </div>
+            {{/isAuthorized}}
           </div>
       </div>
     {{/isAuthorized}}
@@ -81,6 +83,8 @@
                         <button {{bindAttr 
disabled="serviceVersion.disabledActionAttr.view" class=":btn 
serviceVersion.isDisplayed:not-allowed-cursor" 
title="serviceVersion.disabledActionMessages.view"}} {{action doAction 
serviceVersion view.actionTypes.SWITCH target="view"}}><i 
class="icon-search"></i>&nbsp;{{t common.view}}</button>
                         {{#isAuthorized "SERVICE.COMPARE_CONFIGS"}}
                           <button {{bindAttr 
disabled="serviceVersion.disabledActionAttr.compare" class=":btn 
serviceVersion.isDisplayed:not-allowed-cursor" 
title="serviceVersion.disabledActionMessages.compare"}} {{action doAction 
serviceVersion view.actionTypes.COMPARE target="view"}}><i 
class="icon-copy"></i>&nbsp;{{t common.compare}}</button>
+                        {{/isAuthorized}}
+                        {{#isAuthorized "SERVICE.MODIFY_CONFIGS"}}
                           <button {{bindAttr 
disabled="serviceVersion.disabledActionAttr.revert" class=":btn 
serviceVersion.isCurrent:not-allowed-cursor 
serviceVersion.isCompatible::hidden" 
title="serviceVersion.disabledActionMessages.revert"}} {{action doAction 
serviceVersion view.actionTypes.REVERT target="view"}}>{{t 
dashboard.configHistory.info-bar.revert.button}}</button>
                         {{/isAuthorized}}
                       </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ff99fcc/ambari-web/app/templates/common/configs/service_version_box.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_version_box.hbs 
b/ambari-web/app/templates/common/configs/service_version_box.hbs
index 65d7f48..d44efb8 100644
--- a/ambari-web/app/templates/common/configs/service_version_box.hbs
+++ b/ambari-web/app/templates/common/configs/service_version_box.hbs
@@ -46,6 +46,8 @@
         <button {{bindAttr disabled="view.disabledActionAttr.view" class=":btn 
view.serviceVersion.isDisplayed:not-allowed-cursor" 
title="view.disabledActionMessages.view"}} {{action doAction 
view.serviceVersion view.actionTypes.SWITCH target="view.parentView"}}><i 
class="icon-search"></i>&nbsp;{{t common.view}}</button>
         {{#isAuthorized "SERVICE.COMPARE_CONFIGS"}}
           <button {{bindAttr disabled="view.disabledActionAttr.compare" 
class=":btn view.serviceVersion.isDisplayed:not-allowed-cursor" 
title="view.disabledActionMessages.compare"}} {{action doAction 
view.serviceVersion view.actionTypes.COMPARE target="view.parentView"}}><i 
class="icon-copy"></i>&nbsp;{{t common.compare}}</button>
+        {{/isAuthorized}}
+        {{#isAuthorized "SERVICE.MODIFY_CONFIGS"}}
           <button {{bindAttr disabled="view.disabledActionAttr.revert" 
class=":btn view.serviceVersion.isCurrent:not-allowed-cursor 
view.serviceVersion.isCompatible::hidden" 
title="view.disabledActionMessages.revert"}} {{action doAction 
view.serviceVersion view.actionTypes.REVERT target="view.parentView"}}>{{t 
dashboard.configHistory.info-bar.revert.button}}</button>
         {{/isAuthorized}}
       </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ff99fcc/ambari-web/app/views/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/details.js 
b/ambari-web/app/views/main/host/details.js
index 5b42766..784e63c 100644
--- a/ambari-web/app/views/main/host/details.js
+++ b/ambari-web/app/views/main/host/details.js
@@ -17,7 +17,6 @@
  */
 
 var App = require('app');
-var date = require('utils/date/date');
 
 App.MainHostDetailsView = Em.View.extend({
   templateName: require('templates/main/host/details'),
@@ -31,34 +30,66 @@ App.MainHostDetailsView = Em.View.extend({
 
   clients: Em.computed.filterBy('content.hostComponents', 'isClient', true),
 
-  clientsWithConfigs: function() {
-    return 
this.get('content.hostComponents').filterProperty('isClient').filter(function(client)
 {
+  clientsWithConfigs: function () {
+    return 
this.get('content.hostComponents').filterProperty('isClient').filter(function 
(client) {
       return 
!App.get('services.noConfigTypes').contains(client.get('service.serviceName'));
     });
   }.property('content.hostComponents.@each'),
 
   isActive: Em.computed.equal('controller.content.passiveState', 'OFF'),
 
-  maintenance: function(){
+  maintenance: function () {
     var onOff = this.get('isActive') ? "On" : "Off";
     var result = [];
     if (App.isAuthorized("SERVICE.START_STOP")) {
       result = result.concat([
-        {action: 'startAllComponents', liClass: 
(this.get('controller.content.isNotHeartBeating')?'disabled':'enabled'), 
cssClass: 'icon-play', 'label': 
this.t('hosts.host.details.startAllComponents')},
-        {action: 'stopAllComponents', liClass: 
(this.get('controller.content.isNotHeartBeating')?'disabled':'enabled'), 
cssClass: 'icon-stop', 'label': this.t('hosts.host.details.stopAllComponents')},
-        {action: 'restartAllComponents', liClass: 
(this.get('controller.content.isNotHeartBeating')?'disabled':'enabled'), 
cssClass: 'icon-repeat', 'label': 
this.t('hosts.host.details.restartAllComponents')}
+        {
+          action: 'startAllComponents',
+          liClass: this.get('controller.content.isNotHeartBeating') ? 
'disabled' : 'enabled',
+          cssClass: 'icon-play',
+          label: this.t('hosts.host.details.startAllComponents')
+        },
+        {
+          action: 'stopAllComponents',
+          liClass: this.get('controller.content.isNotHeartBeating') ? 
'disabled' : 'enabled',
+          cssClass: 'icon-stop',
+          label: this.t('hosts.host.details.stopAllComponents')
+        },
+        {
+          action: 'restartAllComponents',
+          liClass: this.get('controller.content.isNotHeartBeating') ? 
'disabled' : 'enabled',
+          cssClass: 'icon-repeat',
+          label: this.t('hosts.host.details.restartAllComponents')
+        }
       ]);
     }
-    result.push({action: 'setRackId', liClass:'', cssClass: 'icon-gear', 
'label': this.t('hosts.host.details.setRackId')});
     if (App.isAuthorized("HOST.TOGGLE_MAINTENANCE")) {
-      result.push({action: 'onOffPassiveModeForHost', liClass:'', cssClass: 
'icon-medkit', active:this.get('isActive'), 'label': this.t('passiveState.turn' 
+ onOff)});
+      result.push({
+        action: 'setRackId',
+        liClass: '',
+        cssClass: 'icon-gear',
+        label: this.t('hosts.host.details.setRackId')
+      });
+      result.push({
+        action: 'onOffPassiveModeForHost',
+        liClass: '',
+        cssClass: 'icon-medkit',
+        active: this.get('isActive'),
+        label: this.t('passiveState.turn' + onOff)
+      });
     }
     if (App.isAuthorized("HOST.ADD_DELETE_HOSTS")) {
-      result.push({action: 'deleteHost', liClass:'', cssClass: 'icon-remove', 
'label': this.t('hosts.host.details.deleteHost')});
+      result.push({
+        action: 'deleteHost',
+        liClass: '',
+        cssClass: 'icon-remove',
+        label: this.t('hosts.host.details.deleteHost')
+      });
     }
     return result;
-  }.property('controller.content','isActive', 
'controller.content.isNotHeartBeating'),
-  didInsertElement: function() {
+  }.property('controller.content', 'isActive', 
'controller.content.isNotHeartBeating'),
+
+  didInsertElement: function () {
     var self = this;
     var host = self.get('content');
 
@@ -71,5 +102,10 @@ App.MainHostDetailsView = Em.View.extend({
         App.router.transitionTo('main.hosts.index');
       }
     });
+  },
+
+  willDestroyElement: function () {
+    $("[rel='HealthTooltip']").tooltip('destroy');
   }
+
 });

Reply via email to