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/1bd562a1 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1bd562a1 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1bd562a1 Branch: refs/heads/branch-feature-AMBARI-18901 Commit: 1bd562a1803efa12a4afcbf312c5a898f63bff41 Parents: adde3db Author: Andrii Tkach <atk...@apache.org> Authored: Wed Nov 30 14:19:52 2016 +0200 Committer: Andrii Tkach <atk...@apache.org> Committed: Wed Nov 30 15:45:04 2016 +0200 ---------------------------------------------------------------------- .../app/templates/main/admin/service_auto_start.hbs | 10 ++++++---- ambari-web/app/views/main/admin.js | 3 ++- ambari-web/app/views/main/admin/service_auto_start.js | 4 ++++ .../main/admin/service_auto_start/component_auto_start.js | 1 + .../admin/stack_upgrade/upgrade_version_box_view_test.js | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/1bd562a1/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 e2eb192..a14add2 100644 --- a/ambari-web/app/templates/main/admin/service_auto_start.hbs +++ b/ambari-web/app/templates/main/admin/service_auto_start.hbs @@ -63,10 +63,12 @@ </div> </div> {{/each}} - <div class="offset4"> - <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> - </div> + {{#isAuthorized "SERVICE.START_STOP, CLUSTER.MODIFY_CONFIGS"}} + <div class="offset4"> + <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> + </div> + {{/isAuthorized}} </div> {{/each}} </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/1bd562a1/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/1bd562a1/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 5b10d1b..51512a2 100644 --- a/ambari-web/app/views/main/admin/service_auto_start.js +++ b/ambari-web/app/views/main/admin/service_auto_start.js @@ -30,8 +30,11 @@ App.MainAdminServiceAutoStartView = Em.View.extend({ savedRecoveryEnabled: false, + isDisabled: false, + didInsertElement: function () { var self = this; + this.set('isDisabled', !App.isAuthorized('SERVICE.START_STOP, CLUSTER.MODIFY_CONFIGS')); this.get('controller').loadClusterConfig().done(function (data) { var tag = [ { @@ -77,6 +80,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.updateClusterConfigs(state); http://git-wip-us.apache.org/repos/asf/ambari/blob/1bd562a1/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 ceafd21..9794d6f 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 @@ -56,6 +56,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)); http://git-wip-us.apache.org/repos/asf/ambari/blob/1bd562a1/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js index 4eaaac0..45ce8e9 100644 --- a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js +++ b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js @@ -718,7 +718,7 @@ describe('App.UpgradeVersionBoxView', function () { status: 'UPGRADING', isLink: true, action: 'openUpgradeDialog', - iconClass: 'glyphicon glyphicon-pause', + iconClass: 'icon-pause', text: Em.I18n.t('admin.stackVersions.version.upgrade.pause') }, title: 'upgrading, holding, isWizardRestricted=true'