Bläddra i källkod

AMBARI-7110 Customize Services page: spinner missing. (ababiichuk)

aBabiichuk 10 år sedan
förälder
incheckning
f853f1c76e

+ 1 - 0
ambari-web/app/controllers/main/service/info/configs.js

@@ -25,6 +25,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
   name: 'mainServiceInfoConfigsController',
   isHostsConfigsPage: false,
   forceTransition: false,
+  isRecommendedLoaded: true,
   dataIsLoaded: false,
   stepConfigs: [], //contains all field properties that are viewed in this service
   selectedService: null,

+ 11 - 17
ambari-web/app/controllers/wizard/step7_controller.js

@@ -43,6 +43,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, {
 
   slaveHostToGroup: null,
 
+  isRecommendedLoaded: false,
   /**
    * used in services_config.js view to mark a config with security icon
    */
@@ -232,6 +233,8 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, {
    * @method clearStep
    */
   clearStep: function () {
+    this.set('isSubmitDisabled', true);
+    this.set('isRecommendedLoaded', false);
     this.get('stepConfigs').clear();
     this.set('filter', '');
     this.get('filterColumns').setEach('selected', false);
@@ -721,25 +724,16 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, {
     }
     //STEP 6: Distribute configs by service and wrap each one in App.ServiceConfigProperty (configs -> serviceConfigs)
     var self = this;
-    if (App.get('supports.serverRecommendValidate')) {
-      this.loadServerSideConfigsRecommendations().always(function() {
-        self.setStepConfigs(configs, storedConfigs);
-        self.checkHostOverrideInstaller();
-        self.activateSpecialConfigs();
-        self.selectProperService();
-        if (self.get('content.skipConfigStep')) {
-          App.router.send('next');
-        }
-      });
-    } else {
-      this.setStepConfigs(configs, storedConfigs);
-      this.checkHostOverrideInstaller();
-      this.activateSpecialConfigs();
-      this.selectProperService();
-      if (this.get('content.skipConfigStep')) {
+    this.loadServerSideConfigsRecommendations().always(function() {
+      self.set('isRecommendedLoaded', true);
+      self.setStepConfigs(configs, storedConfigs);
+      self.checkHostOverrideInstaller();
+      self.activateSpecialConfigs();
+      self.selectProperService();
+      if (self.get('content.skipConfigStep')) {
         App.router.send('next');
       }
-    }
+    });
   },
   /**
    * If <code>App.supports.hostOverridesInstaller</code> is enabled should load config groups

+ 21 - 16
ambari-web/app/templates/common/configs/services_config.hbs

@@ -15,21 +15,26 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 }}
-
-<ul class="nav nav-tabs">
-  {{#each service in controller.stepConfigs}}
-    {{#if service.showConfig}}
-      {{#view App.ServiceConfigTab}}
-        <a href="#{{unbound service.serviceName}}" {{bindAttr class=":active service.selected:new"}}
-           data-toggle="tab" {{action selectService service target="view"}}>
-          {{service.displayName}}{{#if service.errorCount}}<span
-                class="badge badge-important">{{service.errorCount}}</span>{{/if}}</a>
-      {{/view}}
-    {{/if}}
-  {{/each}}
-</ul>
+{{#if controller.isRecommendedLoaded}}
+    <ul class="nav nav-tabs">
+      {{#each service in controller.stepConfigs}}
+        {{#if service.showConfig}}
+          {{#view App.ServiceConfigTab}}
+              <a href="#{{unbound service.serviceName}}" {{bindAttr class=":active service.selected:new"}}
+                 data-toggle="tab" {{action selectService service target="view"}}>
+                {{service.displayName}}{{#if service.errorCount}}<span
+                      class="badge badge-important">{{service.errorCount}}</span>{{/if}}</a>
+          {{/view}}
+        {{/if}}
+      {{/each}}
+    </ul>
+{{else}}
+    <div class="spinner"></div>
+{{/if}}
 {{view App.ServiceConfigContainerView}}
-<p class="loading align-center"></p>
-{{#if isSubmitDisabled}}
-  <div class="alert">{{t installer.step7.attentionNeeded}}</div>
+{{#if controller.isRecommendedLoaded}}
+    <p class="loading align-center"></p>
+    {{#if isSubmitDisabled}}
+        <div class="alert">{{t installer.step7.attentionNeeded}}</div>
+    {{/if}}
 {{/if}}

+ 4 - 4
ambari-web/test/controllers/main/service/info/config_test.js

@@ -382,14 +382,14 @@ describe("App.MainServiceInfoConfigsController", function () {
 
   describe("#doCancel", function () {
     beforeEach(function () {
-      sinon.stub(mainServiceInfoConfigsController, "loadStep", Em.K);
+      sinon.stub(Em.run, 'once', Em.K);
     });
     afterEach(function () {
-      mainServiceInfoConfigsController.loadStep.restore();
+      Em.run.once.restore();
     });
-    it("trigger loadStep", function () {
+    it("trigger onConfigGroupChange", function () {
       mainServiceInfoConfigsController.doCancel();
-      expect(mainServiceInfoConfigsController.loadStep.calledOnce).to.equal(true);
+      expect(Em.run.once.calledWith(mainServiceInfoConfigsController, "onConfigGroupChange")).to.equal(true);
     });
   });