AMBARI-11078. Hide "Regenerate Keytabs" action from the UI if "Manual Kerberos" option is selected (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f085f59e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f085f59e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f085f59e Branch: refs/heads/trunk Commit: f085f59e7ce04c991c36af97f5b5590fb0e9bbe3 Parents: bd8a5f9 Author: Alex Antonenko <hiv...@gmail.com> Authored: Tue May 12 21:20:34 2015 +0300 Committer: Alex Antonenko <hiv...@gmail.com> Committed: Tue May 12 23:48:37 2015 +0300 ---------------------------------------------------------------------- .../app/controllers/main/admin/kerberos.js | 23 ++++++++++++++++++++ .../app/templates/main/admin/kerberos.hbs | 4 +++- ambari-web/app/utils/ajax/ajax.js | 9 ++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f085f59e/ambari-web/app/controllers/main/admin/kerberos.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/kerberos.js b/ambari-web/app/controllers/main/admin/kerberos.js index 48691f1..702d585 100644 --- a/ambari-web/app/controllers/main/admin/kerberos.js +++ b/ambari-web/app/controllers/main/admin/kerberos.js @@ -25,6 +25,7 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({ securityEnabled: false, dataIsLoaded: false, isRecommendedLoaded: true, + kdc_type: 'none', getAddSecurityWizardStatus: function () { return App.db.getSecurityWizardStatus(); }, @@ -230,6 +231,7 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({ this.set('dataIsLoaded', true); } else { //get Security Status From Server + this.getSecurityType(); return this.getSecurityStatus(); } }, @@ -365,6 +367,27 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({ } }, + getSecurityType: function () { + if (this.get('securityEnabled')) { + App.ajax.send({ + name: 'admin.security.cluster_configs.kerberos', + sender: this, + data: { + clustName: 'c1' + }, + success: 'getSecurityTypeSuccess' + }) + } + }, + + getSecurityTypeSuccess: function (data, opt, params) { + this.set('kdc_type', data.items && Em.get(data.items[0], 'properties.kdc_type') ? Em.get(data.items[0], 'properties.kdc_type') : 'none' ); + }, + + isManualKerberos: function () { + return this.get('kdc_type') === 'none'; + }.property('kdc_type'), + checkState: function(data, opt, params) { var res = Em.get(data, 'Services.attributes.kdc_validation_result'); var message = Em.get(data, 'Services.attributes.kdc_validation_failure_details'); http://git-wip-us.apache.org/repos/asf/ambari/blob/f085f59e/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 23eab55..7b86cb3 100644 --- a/ambari-web/app/templates/main/admin/kerberos.hbs +++ b/ambari-web/app/templates/main/admin/kerberos.hbs @@ -20,7 +20,9 @@ <div> <p class="text-success">{{t admin.security.enabled}} <a class="btn btn-padding btn-warning admin-disable-security-btn" {{bindAttr disabled="isSubmitDisabled"}} {{action notifySecurityOffPopup target="controller"}}>{{t admin.kerberos.button.disable}} </a> - <button class="btn btn-success"{{action regenerateKeytabs target="controller"}}><i class="icon-repeat"></i> {{t admin.kerberos.button.regenerateKeytabs}}</button> + {{#unless isManualKerberos}} + <button class="btn btn-success"{{action regenerateKeytabs target="controller"}}><i class="icon-repeat"></i> {{t admin.kerberos.button.regenerateKeytabs}}</button> + {{/unless}} <br/> </p> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/f085f59e/ambari-web/app/utils/ajax/ajax.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js index cbc0370..8998158 100644 --- a/ambari-web/app/utils/ajax/ajax.js +++ b/ambari-web/app/utils/ajax/ajax.js @@ -1350,6 +1350,15 @@ var urls = { }; } }, + 'admin.security.cluster_configs.kerberos': { + 'real': '/clusters/{clusterName}/configurations?type=kerberos-env&fields=properties/*', + 'mock': '', + 'format': function () { + return { + timeout: 10000 + }; + } + }, 'admin.get.all_configurations': { 'real': '/clusters/{clusterName}/configurations?{urlParams}', 'mock': '',