瀏覽代碼

AMBARI-9004. Installer step7->step8->step7 navigation issue (onechiporenko)

Oleg Nechiporenko 10 年之前
父節點
當前提交
0d601a8d13
共有 3 個文件被更改,包括 61 次插入3 次删除
  1. 2 1
      ambari-web/app/controllers/wizard.js
  2. 3 2
      ambari-web/app/utils/config.js
  3. 56 0
      ambari-web/test/controllers/wizard_test.js

+ 2 - 1
ambari-web/app/controllers/wizard.js

@@ -868,7 +868,8 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
           hasInitialValue: !!_configProperties.get('hasInitialValue'),
           isRequired: _configProperties.get('isRequired'), // flag that allow saving property with empty value
           group: !!_configProperties.get('group') ? _configProperties.get('group.name') : null,
-          showLabel: _configProperties.get('showLabel')
+          showLabel: _configProperties.get('showLabel'),
+          category: _configProperties.get('category')
         };
         serviceConfigProperties.push(configProperty);
       }, this);

+ 3 - 2
ambari-web/app/utils/config.js

@@ -1215,7 +1215,7 @@ App.config = Em.Object.create({
     var configData = {
       id: stored.id,
       name: stored.name,
-      displayName: stored.name,
+      displayName: App.format.normalizeName(stored.name),
       serviceName: stored.serviceName,
       value: stored.value,
       defaultValue: stored.defaultValue,
@@ -1230,7 +1230,8 @@ App.config = Em.Object.create({
       isFinal: stored.isFinal,
       defaultIsFinal: stored.defaultIsFinal,
       supportsFinal: stored.supportsFinal,
-      showLabel: stored.showLabel !== false
+      showLabel: stored.showLabel !== false,
+      category: stored.category
     };
 
     App.get('config').calculateConfigProperties(configData, isAdvanced, advancedConfigs);

+ 56 - 0
ambari-web/test/controllers/wizard_test.js

@@ -20,6 +20,8 @@ var App = require('app');
 require('models/cluster');
 require('controllers/wizard');
 
+var c;
+
 describe('App.WizardController', function () {
 
   var wizardController = App.WizardController.create({});
@@ -30,6 +32,10 @@ describe('App.WizardController', function () {
     ruller.push(i);
   }
 
+  beforeEach(function () {
+    c = App.WizardController.create({});
+  });
+
   describe('#setLowerStepsDisable', function() {
     for(var i = 1; i < totalSteps; i++) {
       var indx = i;
@@ -159,4 +165,54 @@ describe('App.WizardController', function () {
     });
   });
 
+  describe('#saveServiceConfigProperties', function () {
+
+    beforeEach(function () {
+      c.set('content', {});
+      sinon.stub(c, 'setDBProperty', Em.K);
+    });
+
+    afterEach(function () {
+      c.setDBProperty.restore();
+    });
+
+    var stepController = Em.Object.create({
+      installedServiceNames: [],
+      stepConfigs: [
+      Em.Object.create({
+        serviceName: 'HDFS',
+        configs: [
+          Em.Object.create({
+            id: 'id',
+            name: 'name',
+            value: 'value',
+            defaultValue: 'defaultValue',
+            description: 'description',
+            serviceName: 'serviceName',
+            domain: 'domain',
+            isVisible: true,
+            isFinal: true,
+            defaultIsFinal: true,
+            supportsFinal: true,
+            filename: 'filename',
+            displayType: 'string',
+            isRequiredByAgent: true,
+            hasInitialValue: true,
+            isRequired: true,
+            group: {name: 'group'},
+            showLabel: true,
+            category: 'some_category'
+          })
+        ]
+      })
+    ]});
+
+    it('should save configs to content.serviceConfigProperties', function () {
+      c.saveServiceConfigProperties(stepController);
+      var saved = c.get('content.serviceConfigProperties');
+      expect(saved.length).to.equal(1);
+      expect(saved[0].category).to.equal('some_category');
+    });
+
+  });
 });