Revert "Revert "AMBARI-21205 Make ToggleKerberos and AddDeleteService experimental features (Duc Le via rzang)""
This reverts commit 7e0fe2913619f4b70097e3ebcd7fb89e84eee62d. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4242225c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4242225c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4242225c Branch: refs/heads/branch-feature-AMBARI-14714 Commit: 4242225ca6aa89512886bcc74eb5c49e65bd259c Parents: 0ca8513 Author: Jaimin Jetly <jai...@hortonworks.com> Authored: Mon Oct 9 13:03:49 2017 -0700 Committer: Jaimin Jetly <jai...@hortonworks.com> Committed: Mon Oct 9 13:04:36 2017 -0700 ---------------------------------------------------------------------- ambari-web/app/config.js | 6 ++-- ambari-web/app/routes/add_service_routes.js | 2 +- ambari-web/app/routes/main.js | 2 +- .../app/templates/main/admin/kerberos.hbs | 34 +++++++++++--------- .../main/service/all_services_actions.hbs | 6 ++-- ambari-web/app/views/main/admin.js | 14 ++++---- .../main/admin/stack_upgrade/services_view.js | 2 +- ambari-web/app/views/main/menu.js | 16 +++++---- ambari-web/app/views/main/service/item.js | 2 +- .../admin/stack_upgrade/services_view_test.js | 1 + 10 files changed, 49 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/4242225c/ambari-web/app/config.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/config.js b/ambari-web/app/config.js index ba1b75d..0963f70 100644 --- a/ambari-web/app/config.js +++ b/ambari-web/app/config.js @@ -86,9 +86,11 @@ App.supports = { addingNewRepository: false, kerberosStackAdvisor: true, logCountVizualization: false, - manageJournalNode: true, createAlerts: false, - enabledWizardForHostOrderedUpgrade: true + enabledWizardForHostOrderedUpgrade: true, + manageJournalNode: true, + enableToggleKerberos: true, + enableAddDeleteServices: true }; if (App.enableExperimental) { http://git-wip-us.apache.org/repos/asf/ambari/blob/4242225c/ambari-web/app/routes/add_service_routes.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js index 1615f0d..75b3586 100644 --- a/ambari-web/app/routes/add_service_routes.js +++ b/ambari-web/app/routes/add_service_routes.js @@ -24,7 +24,7 @@ module.exports = App.WizardRoute.extend({ route: '/service/add', enter: function (router) { - if (App.isAuthorized('SERVICE.ADD_DELETE_SERVICES')) { + if (App.isAuthorized('SERVICE.ADD_DELETE_SERVICES') && App.supports.enableAddDeleteServices) { // `getSecurityStatus` call is required to retrieve information related to kerberos type: Manual or automated kerberos router.get('mainController').isLoading.call(router.get('clusterController'),'isClusterNameLoaded').done(function () { App.router.get('mainAdminKerberosController').getSecurityStatus().always(function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/4242225c/ambari-web/app/routes/main.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js index 30cc8aa..7ed18de 100644 --- a/ambari-web/app/routes/main.js +++ b/ambari-web/app/routes/main.js @@ -460,7 +460,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, { route: '/kerberos', enter: function (router, transition) { - if (router.get('loggedIn') && !App.isAuthorized('CLUSTER.TOGGLE_KERBEROS')) { + if (router.get('loggedIn') && (!App.isAuthorized('CLUSTER.TOGGLE_KERBEROS') || !App.supports.enableToggleKerberos)) { router.transitionTo('main.dashboard.index'); } }, http://git-wip-us.apache.org/repos/asf/ambari/blob/4242225c/ambari-web/app/templates/main/admin/kerberos.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/admin/kerberos.hbs b/ambari-web/app/templates/main/admin/kerberos.hbs index e7bb618..2b41122 100644 --- a/ambari-web/app/templates/main/admin/kerberos.hbs +++ b/ambari-web/app/templates/main/admin/kerberos.hbs @@ -20,20 +20,22 @@ <div> <p class="text-success">{{t admin.security.enabled}} {{#isAuthorized "CLUSTER.TOGGLE_KERBEROS"}} - <button class="btn btn-padding btn-warning admin-disable-security-btn" {{bindAttr disabled="isKerberosButtonsDisabled"}} {{action notifySecurityOffPopup target="controller"}}>{{t admin.kerberos.button.disable}} </button> - {{#unless isManualKerberos}} - <button class="btn btn-success" id="regenerate-keytabs" {{bindAttr disabled="isKerberosButtonsDisabled"}} {{action regenerateKeytabs target="controller"}}> - <i class="glyphicon glyphicon-repeat"></i> {{t admin.kerberos.button.regenerateKeytabs}}</button> - {{#if App.isCredentialStorePersistent}} - <button class="btn btn-primary" {{action showManageKDCCredentialsPopup target="controller"}}>{{t admin.kerberos.credentials.store.menu.label}}</button> + {{#if App.supports.enableToggleKerberos}} + <button class="btn btn-padding btn-warning admin-disable-security-btn" {{bindAttr disabled="isKerberosButtonsDisabled"}} {{action notifySecurityOffPopup target="controller"}}>{{t admin.kerberos.button.disable}} </button> + {{#unless isManualKerberos}} + <button class="btn btn-success" id="regenerate-keytabs" {{bindAttr disabled="isKerberosButtonsDisabled"}} {{action regenerateKeytabs target="controller"}}> + <i class="glyphicon glyphicon-repeat"></i> {{t admin.kerberos.button.regenerateKeytabs}}</button> + {{#if App.isCredentialStorePersistent}} + <button class="btn btn-primary" {{action showManageKDCCredentialsPopup target="controller"}}>{{t admin.kerberos.credentials.store.menu.label}}</button> + {{/if}} + {{/unless}} + <br/> + {{#unless isEditMode}} + <a href="#" {{action makeConfigsEditable target="controller"}} class="pull-right"> + {{t common.edit}} + </a> + {{/unless}} {{/if}} - {{/unless}} - <br/> - {{#unless isEditMode}} - <a href="#" {{action makeConfigsEditable target="controller"}} class="pull-right"> - {{t common.edit}} - </a> - {{/unless}} {{/isAuthorized}} </p> </div> @@ -51,8 +53,10 @@ <div> <p class="muted background-text">{{t admin.security.disabled}} {{#isAuthorized "CLUSTER.TOGGLE_KERBEROS"}} - <a class="btn btn-padding btn-success admin-enable-security-btn" {{action checkAndStartKerberosWizard target="controller"}}>{{t admin.kerberos.button.enable}} </a> - <br/> + {{#if App.supports.enableToggleKerberos}} + <a class="btn btn-padding btn-success admin-enable-security-btn" {{action checkAndStartKerberosWizard target="controller"}}>{{t admin.kerberos.button.enable}} </a> + <br/> + {{/if}} {{/isAuthorized}} </p> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/4242225c/ambari-web/app/templates/main/service/all_services_actions.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/service/all_services_actions.hbs b/ambari-web/app/templates/main/service/all_services_actions.hbs index 3e87cb2..a9e122b 100644 --- a/ambari-web/app/templates/main/service/all_services_actions.hbs +++ b/ambari-web/app/templates/main/service/all_services_actions.hbs @@ -22,12 +22,14 @@ </div> <ul class="dropdown-menu"> {{#isAuthorized "SERVICE.ADD_DELETE_SERVICES"}} - <li {{bindAttr class="view.serviceController.isAllServicesInstalled:disabled"}}> + {{#if App.supports.enableAddDeleteServices}} + <li {{bindAttr class="view.serviceController.isAllServicesInstalled:disabled"}}> <a href="#" {{bindAttr class="view.serviceController.isAllServicesInstalled:disabled"}} {{action gotoAddService target="view.serviceController"}}> <i class="glyphicon glyphicon-plus"></i> {{t services.service.add}}</a> - </li> + </li> + {{/if}} {{/isAuthorized}} {{#isAuthorized "SERVICE.START_STOP"}} <li class="divider"></li> http://git-wip-us.apache.org/repos/asf/ambari/blob/4242225c/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 509f380..05d0f56 100644 --- a/ambari-web/app/views/main/admin.js +++ b/ambari-web/app/views/main/admin.js @@ -39,12 +39,14 @@ App.MainAdminView = Em.View.extend({ }); } if (!App.get('isHadoopWindowsStack') && App.isAuthorized('CLUSTER.TOGGLE_KERBEROS') || (App.get('upgradeInProgress') || App.get('upgradeHolding')) ) { - items.push({ - name: 'kerberos', - url: 'adminKerberos.index', - label: Em.I18n.t('common.kerberos'), - disabled: App.get('upgradeInProgress') || App.get('upgradeHolding') - }); + if (App.supports.enableToggleKerberos) { + items.push({ + name: 'kerberos', + url: 'adminKerberos.index', + label: Em.I18n.t('common.kerberos'), + disabled: App.get('upgradeInProgress') || App.get('upgradeHolding') + }); + } } if ((App.isAuthorized('SERVICE.START_STOP, CLUSTER.MODIFY_CONFIGS') && App.isAuthorized('SERVICE.MANAGE_AUTO_START, CLUSTER.MANAGE_AUTO_START')) || (App.get('upgradeInProgress') || App.get('upgradeHolding'))) { if (App.supports.serviceAutoStart) { http://git-wip-us.apache.org/repos/asf/ambari/blob/4242225c/ambari-web/app/views/main/admin/stack_upgrade/services_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/admin/stack_upgrade/services_view.js b/ambari-web/app/views/main/admin/stack_upgrade/services_view.js index f566814..25efffe 100644 --- a/ambari-web/app/views/main/admin/stack_upgrade/services_view.js +++ b/ambari-web/app/views/main/admin/stack_upgrade/services_view.js @@ -56,7 +56,7 @@ App.MainAdminStackServicesView = Em.View.extend({ * @param event */ goToAddService: function (event) { - if (!App.isAuthorized('SERVICE.ADD_DELETE_SERVICES')) { + if (!App.isAuthorized('SERVICE.ADD_DELETE_SERVICES') || !App.supports.enableAddDeleteServices) { return; } else if (event.context == "KERBEROS") { App.router.get('mainAdminKerberosController').checkAndStartKerberosWizard(); http://git-wip-us.apache.org/repos/asf/ambari/blob/4242225c/ambari-web/app/views/main/menu.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/menu.js b/ambari-web/app/views/main/menu.js index 4bb53ae..32c4f6f 100644 --- a/ambari-web/app/views/main/menu.js +++ b/ambari-web/app/views/main/menu.js @@ -118,13 +118,15 @@ App.MainSideMenuView = Em.CollectionView.extend({ }); } if (!App.get('isHadoopWindowsStack') && App.isAuthorized('CLUSTER.TOGGLE_KERBEROS') || upg) { - categories.push({ - name: 'kerberos', - url: 'kerberos/', - label: Em.I18n.t('common.kerberos'), - disabled: App.get('upgradeInProgress') || App.get('upgradeHolding'), - href: router.urlFor('main.admin.adminKerberos') - }); + if (App.supports.enableToggleKerberos) { + categories.push({ + name: 'kerberos', + url: 'kerberos/', + label: Em.I18n.t('common.kerberos'), + disabled: App.get('upgradeInProgress') || App.get('upgradeHolding'), + href: router.urlFor('main.admin.adminKerberos') + }); + } } if ((App.isAuthorized('SERVICE.START_STOP, CLUSTER.MODIFY_CONFIGS') && App.isAuthorized('SERVICE.MANAGE_AUTO_START, CLUSTER.MANAGE_AUTO_START')) || upg) { if (App.supports.serviceAutoStart) { http://git-wip-us.apache.org/repos/asf/ambari/blob/4242225c/ambari-web/app/views/main/service/item.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js index 37e0904..45c783b 100644 --- a/ambari-web/app/views/main/service/item.js +++ b/ambari-web/app/views/main/service/item.js @@ -289,7 +289,7 @@ App.MainServiceItemView = Em.View.extend({ options.push(actionMap.DOWNLOAD_CLIENT_CONFIGS); } - if (App.isAuthorized("SERVICE.ADD_DELETE_SERVICES")) { + if (App.isAuthorized("SERVICE.ADD_DELETE_SERVICES") && App.supports.enableAddDeleteServices) { options.push(actionMap.DELETE_SERVICE); } http://git-wip-us.apache.org/repos/asf/ambari/blob/4242225c/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js index 70d182c..da75cf2 100644 --- a/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js +++ b/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js @@ -34,6 +34,7 @@ describe('App.MainAdminStackServicesView', function () { sinon.stub(App.router, 'get').returns(mock); sinon.spy(mock, 'checkAndStartKerberosWizard'); isAccessibleMock = sinon.stub(App, 'isAuthorized'); + App.set('supports.enableAddDeleteServices', true); }); afterEach(function() { App.get('router').transitionTo.restore();