AMBARI-19030 Service Auto Start operations are permitted during Upgrade (atkach)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 89780fabad715e971accb66c3c634cfe0030a91f
Parents: d369809
Author: Andrii Tkach <atk...@apache.org>
Authored: Wed Nov 30 14:33:08 2016 +0200
Committer: Andrii Tkach <atk...@apache.org>
Committed: Wed Nov 30 14:33:08 2016 +0200

----------------------------------------------------------------------
 .../templates/main/admin/service_auto_start.hbs | 24 +++++++++++---------
 ambari-web/app/views/main/admin.js              |  3 ++-
 .../app/views/main/admin/service_auto_start.js  |  5 ++++
 .../service_auto_start/component_auto_start.js  |  1 +
 4 files changed, 21 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/89780fab/ambari-web/app/templates/main/admin/service_auto_start.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/service_auto_start.hbs 
b/ambari-web/app/templates/main/admin/service_auto_start.hbs
index 7334995..c5a92cf 100644
--- a/ambari-web/app/templates/main/admin/service_auto_start.hbs
+++ b/ambari-web/app/templates/main/admin/service_auto_start.hbs
@@ -80,17 +80,19 @@
                     </tr>
                   {{/each}}
                 </tbody>
-                <tfoot>
-                  <tr>
-                    <td class="col-md-4"></td>
-                    <td class="col-md-8">
-                      <a href="#" class="enable-all-link" {{action enableAll 
tab target="controller"}}>
-                        {{t common.enableAll}}
-                      </a> |
-                      <a href="#" {{action disableAll tab 
target="controller"}}>{{t common.disableAll}}</a>
-                    </td>
-                  </tr>
-                </tfoot>
+                {{#isAuthorized "SERVICE.START_STOP, CLUSTER.MODIFY_CONFIGS"}}
+                  <tfoot>
+                    <tr>
+                      <td class="col-md-4"></td>
+                      <td class="col-md-8">
+                        <a href="#" class="enable-all-link" {{action enableAll 
tab target="controller"}}>
+                            {{t common.enableAll}}
+                        </a> |
+                        <a href="#" {{action disableAll tab 
target="controller"}}>{{t common.disableAll}}</a>
+                      </td>
+                    </tr>
+                  </tfoot>
+                {{/isAuthorized}}
               </table>
             </div>
           {{/each}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/89780fab/ambari-web/app/views/main/admin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin.js 
b/ambari-web/app/views/main/admin.js
index 704527b..0fa84e8 100644
--- a/ambari-web/app/views/main/admin.js
+++ b/ambari-web/app/views/main/admin.js
@@ -51,7 +51,8 @@ App.MainAdminView = Em.View.extend({
         items.push({
           name: 'serviceAutoStart',
           url: 'adminServiceAutoStart',
-          label: Em.I18n.t('admin.serviceAutoStart.title')
+          label: Em.I18n.t('admin.serviceAutoStart.title'),
+          disabled: App.get('upgradeInProgress') || App.get('upgradeHolding')
         });
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/89780fab/ambari-web/app/views/main/admin/service_auto_start.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/service_auto_start.js 
b/ambari-web/app/views/main/admin/service_auto_start.js
index 7b4e46c..1af9845 100644
--- a/ambari-web/app/views/main/admin/service_auto_start.js
+++ b/ambari-web/app/views/main/admin/service_auto_start.js
@@ -27,8 +27,12 @@ App.MainAdminServiceAutoStartView = Em.View.extend({
    */
   isLoaded: false,
 
+  isDisabled: false,
+
   didInsertElement: function () {
     var self = this;
+
+    this.set('isDisabled', !App.isAuthorized('SERVICE.START_STOP, 
CLUSTER.MODIFY_CONFIGS'));
     this.get('controller').load().then(function() {
       self.set('isLoaded', true);
       self.initSwitcher();
@@ -55,6 +59,7 @@ App.MainAdminServiceAutoStartView = Em.View.extend({
         offText: Em.I18n.t('common.disabled'),
         offColor: 'default',
         onColor: 'success',
+        disabled: this.get('isDisabled'),
         handleWidth: Math.max(Em.I18n.t('common.enabled').length, 
Em.I18n.t('common.disabled').length) * 8,
         onSwitchChange: function (event, state) {
           self.set('controller.servicesAutoStart', state);

http://git-wip-us.apache.org/repos/asf/ambari/blob/89780fab/ambari-web/app/views/main/admin/service_auto_start/component_auto_start.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/views/main/admin/service_auto_start/component_auto_start.js 
b/ambari-web/app/views/main/admin/service_auto_start/component_auto_start.js
index 8588b04..a1e09f2 100644
--- a/ambari-web/app/views/main/admin/service_auto_start/component_auto_start.js
+++ b/ambari-web/app/views/main/admin/service_auto_start/component_auto_start.js
@@ -45,6 +45,7 @@ App.MainAdminServiceAutoStartComponentView = Em.View.extend({
         offText: Em.I18n.t('common.disabled'),
         offColor: 'default',
         onColor: 'success',
+        disabled: this.get('parentView.isDisabled'),
         handleWidth: Math.max(Em.I18n.t('common.enabled').length, 
Em.I18n.t('common.disabled').length) * 8,
         onSwitchChange: function (event, state) {
           self.set('tab.enabledComponents', self.get('tab.enabledComponents') 
+ (state ? 1 : -1));

Reply via email to