Repository: ambari Updated Branches: refs/heads/trunk 772c09307 -> e5c5c6b11
AMBARI-19785. Need to have a flag from UI to show/hide ranger plugin configs. (jaimin) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e5c5c6b1 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e5c5c6b1 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e5c5c6b1 Branch: refs/heads/trunk Commit: e5c5c6b111b3a1a215f5c457e0e1038d6d369a13 Parents: 772c093 Author: Jaimin Jetly <[email protected]> Authored: Tue Jan 31 11:53:48 2017 -0800 Committer: Jaimin Jetly <[email protected]> Committed: Tue Jan 31 11:53:48 2017 -0800 ---------------------------------------------------------------------- .../HDP/2.0.6/configuration/cluster-env.xml | 6 +++ .../controllers/main/service/info/configs.js | 24 +++++++++--- .../app/controllers/wizard/step7_controller.js | 41 ++++++++++++++++---- 3 files changed, 59 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/e5c5c6b1/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml index 93680bf..3af8f08 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml @@ -290,4 +290,10 @@ gpgcheck=0</value> <empty-value-valid>true</empty-value-valid> </value-attributes> </property> + <property> + <name>enable_external_ranger</name> + <value>false</value> + <description>Flag to turn on when external setup of External Ranger is done.</description> + <on-ambari-upgrade add="false"/> + </property> </configuration> http://git-wip-us.apache.org/repos/asf/ambari/blob/e5c5c6b1/ambari-web/app/controllers/main/service/info/configs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js index d946ea0..319610c 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -514,14 +514,28 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi var selectedService = this.get('stepConfigs').findProperty('serviceName', this.get('content.serviceName')); this.set('selectedService', selectedService); this.checkOverrideProperty(selectedService); - /* if (App.Service.find().someProperty('serviceName', 'RANGER')) { + + var isRangerPresent = App.Service.find().someProperty('serviceName', 'RANGER'); + if (isRangerPresent) { App.router.get('mainServiceInfoSummaryController').updateRangerPluginsStatus(); this.setVisibilityForRangerProperties(selectedService); + this.loadConfigRecommendations(null, this._onLoadComplete.bind(this)); + App.loadTimer.finish('Service Configs Page'); } else { - App.config.removeRangerConfigs(this.get('stepConfigs')); - } */ - this.loadConfigRecommendations(null, this._onLoadComplete.bind(this)); - App.loadTimer.finish('Service Configs Page'); + var mainController = App.get('router.mainController'); + var clusterController = App.get('router.clusterController'); + var self = this; + mainController.isLoading.call(clusterController, 'clusterEnv').done(function () { + var isExternalRangerSetup = clusterController.get("clusterEnv")["properties"]["enable_external_ranger"]; + if (isExternalRangerSetup) { + self.setVisibilityForRangerProperties(selectedService); + } else { + App.config.removeRangerConfigs(self.get('stepConfigs')); + } + self.loadConfigRecommendations(null, self._onLoadComplete.bind(self)); + App.loadTimer.finish('Service Configs Page'); + }); + } }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/e5c5c6b1/ambari-web/app/controllers/wizard/step7_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js index 7dcc2ad..1d24ee3 100644 --- a/ambari-web/app/controllers/wizard/step7_controller.js +++ b/ambari-web/app/controllers/wizard/step7_controller.js @@ -535,13 +535,40 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E this.set('stepConfigs', serviceConfigs); this.checkHostOverrideInstaller(); this.selectProperService(); - /* var rangerService = App.StackService.find().findProperty('serviceName', 'RANGER'); - if (rangerService && !rangerService.get('isInstalled') && !rangerService.get('isSelected')) { - App.config.removeRangerConfigs(this.get('stepConfigs')); - } */ - console.timeEnd('applyServicesConfigs execution time: '); - console.time('loadConfigRecommendations execution time: '); - this.loadConfigRecommendations(null, this.completeConfigLoading.bind(this)); + var isInstallerWizard = (this.get("content.controllerName") === 'installerController'); + var self = this; + var rangerService = App.StackService.find().findProperty('serviceName', 'RANGER'); + var isRangerServiceAbsent = rangerService && !rangerService.get('isInstalled') && !rangerService.get('isSelected'); + if (isRangerServiceAbsent) { + var isExternalRangerSetup; + if (isInstallerWizard) { + isExternalRangerSetup = configs.filterProperty('fileName','cluster-env.xml').findProperty('name','enable_external_ranger'); + if (Em.isNone(isExternalRangerSetup) || isExternalRangerSetup.value !== "true") { + App.config.removeRangerConfigs(this.get('stepConfigs')); + } + console.timeEnd('applyServicesConfigs execution time: '); + console.time('loadConfigRecommendations execution time: '); + self.loadConfigRecommendations(null, self.completeConfigLoading.bind(self)); + } else { + var mainController = App.get('router.mainController'); + var clusterController = App.get('router.clusterController'); + mainController.isLoading.call(clusterController, 'clusterEnv').done(function () { + isExternalRangerSetup = clusterController.get("clusterEnv")["properties"]["enable_external_ranger"]; + if (isExternalRangerSetup !== "true") { + App.config.removeRangerConfigs(self.get('stepConfigs')); + } + console.timeEnd('applyServicesConfigs execution time: '); + console.time('loadConfigRecommendations execution time: '); + self.loadConfigRecommendations(null, self.completeConfigLoading.bind(self)); + }); + } + + } else { + console.timeEnd('applyServicesConfigs execution time: '); + console.time('loadConfigRecommendations execution time: '); + self.loadConfigRecommendations(null, self.completeConfigLoading.bind(self)); + } + }, /**
