Browse Source

AMBARI-8121. Admin->Service Accounts page should automatically display user and groups properties for newly added service. (jaimin)

Jaimin Jetly 10 years ago
parent
commit
a80dc9ac93

+ 0 - 2
ambari-web/app/controllers/wizard/step7_controller.js

@@ -124,8 +124,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, {
    */
   serviceConfigTags: [],
 
-  serviceConfigsData: require('data/service_configs'),
-
   /**
    * Are advanced configs loaded
    * @type {bool}

+ 1 - 18
ambari-web/app/data/service_configs.js

@@ -32,24 +32,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'Users and Groups', displayName : 'Users and Groups'})
     ],
     configTypes: {
-      "cluster-env": {supports: {final: false}},
-      "hadoop-env": {supports: {final: false}},
-      "mapred-env": {supports: {final: false}},
-      "yarn-env": {supports: {final: false}},
-      "hbase-env": {supports: {final: false}},
-      "ganglia-env": {supports: {final: false}},
-      "nagios-env": {supports: {final: false}},
-      "oozie-env": {supports: {final: false}},
-      "zookeeper-env": {supports: {final: false}},
-      "hive-env": {supports: {final: false}},
-      "tez-env": {supports: {final: false}},
-      "storm-env": {supports: {final: false}},
-      "falcon-env": {supports: {final: false}},
-      "webhcat-env": {supports: {final: false}},
-      "pig-env": {supports: {final: false}},
-      "sqoop-env": {supports: {final: false}},
-      "knox-env" : {supports: {final: false}},
-      "kafka-env": {supports: {final: false}}
+      "cluster-env": {supports: {final: false}}
     },
     configs: []
   })

+ 10 - 0
ambari-web/app/utils/config.js

@@ -85,6 +85,16 @@ App.config = Em.Object.create({
     var allTabs;
     if (isMiscTabToBeAdded) {
       var nonServiceTab = require('data/service_configs');
+      var miscService = nonServiceTab.findProperty('serviceName', 'MISC');
+      var tagTypes = {};
+      servicesWithConfigTypes.mapProperty('configTypes').forEach(function(configTypes) {
+        for (var fileName in configTypes) {
+          if (fileName.endsWith('-env') && !miscService.get('configTypes')[fileName]) {
+            tagTypes[fileName] = configTypes[fileName];
+          }
+        }
+      });
+      miscService.set('configTypes', $.extend(miscService.get('configTypes'), tagTypes));
       allTabs = servicesWithConfigTypes.concat(nonServiceTab);
     } else {
       allTabs = servicesWithConfigTypes;

+ 38 - 0
ambari-web/test/utils/config_test.js

@@ -587,6 +587,44 @@ describe('App.config', function () {
 
   });
 
+  describe('#setPreDefinedServiceConfigs', function() {
+    beforeEach(function() {
+      sinon.stub(App.StackService, 'find', function() {
+        return [
+          Em.Object.create({
+            id: 'HDFS',
+            serviceName: 'HDFS',
+            configTypes: {
+              'hadoop-env': {},
+              'hdfs-site': {}
+            }
+          }),
+          Em.Object.create({
+            id: 'OOZIE',
+            serviceName: 'OOZIE',
+            configTypes: {
+              'oozie-env': {},
+              'oozie-site': {}
+            }
+          })
+        ];
+      });
+      App.config.setPreDefinedServiceConfigs(true);
+    });
+    afterEach(function() {
+      App.StackService.find.restore();
+    });
+
+    it('should include service MISC', function() {
+      expect(App.config.get('preDefinedServiceConfigs').findProperty('serviceName', 'MISC')).to.be.ok;
+    });
+
+    it('should include -env config types according to stack services', function() {
+      var miscCategory = App.config.get('preDefinedServiceConfigs').findProperty('serviceName', 'MISC');
+      expect(Em.keys(miscCategory.get('configTypes'))).to.eql(['cluster-env', 'hadoop-env', 'oozie-env']);
+    });
+  });
+  
   describe('#isManagedMySQLForHiveAllowed', function () {
 
     var cases = [