ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-17563. Configs attention message appears after Next button click (alexantonenko)
Date Tue, 05 Jul 2016 16:22:03 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 32169fd2d -> f0fec408b


AMBARI-17563. Configs attention message appears after Next button click (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f0fec408
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f0fec408
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f0fec408

Branch: refs/heads/trunk
Commit: f0fec408b69baf72922cf847df774f0938317947
Parents: 32169fd
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Tue Jul 5 18:20:31 2016 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Tue Jul 5 18:34:43 2016 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  |  54 ++++++----
 .../models/configs/objects/service_config.js    |   4 +-
 .../common/configs/services_config.hbs          |  16 +--
 .../test/controllers/wizard/step7_test.js       | 105 +++++++++----------
 4 files changed, 93 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f0fec408/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 78c5125..7f9c17e 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -118,6 +118,8 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
 
   isConfigsLoaded: Em.computed.and('wizardController.stackConfigsLoaded', 'isAppliedConfigLoaded'),
 
+  transitionInProgress: Em.computed.alias('App.router.btnClickInProgress'),
+
   /**
    * PreInstall Checks allowed only for Install
    * @type {boolean}
@@ -246,8 +248,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
   ],
 
   issuesFilterText: function () {
-    return this.get('isSubmitDisabled') && !this.get('submitButtonClicked') &&
-      this.get('filterColumns').findProperty('attributeName', 'hasIssues').get('selected')
?
+    return !this.get('transitionInProgress') && this.get('issuesFilterSelected')
?
         Em.I18n.t('installer.step7.showingPropertiesWithIssues') : '';
   }.property('isSubmitDisabled', 'submitButtonClicked', 'filterColumns.@each.selected'),
 
@@ -255,14 +256,14 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
    * @type {string}
    */
   issuesFilterLinkText: function () {
-    var issuesAttrSelected = this.get('filterColumns').findProperty('attributeName', 'hasIssues').get('selected');
-    if (issuesAttrSelected) {
-      return Em.I18n.t('installer.step7.showAllProperties');
-    }
-
-    if (this.get('isSubmitDisabled') && !this.get('submitButtonClicked')) {
-      return issuesAttrSelected ?
-        Em.I18n.t('installer.step7.showAllProperties') : Em.I18n.t('installer.step7.showPropertiesWithIssues');
+    var issuesAttrSelected = this.get('issuesFilterSelected');
+    if (!this.get('transitionInProgress')) {
+      if (issuesAttrSelected) {
+        return Em.I18n.t('installer.step7.showAllProperties');
+      }
+      if (this.get('hasStepConfigIssues')) {
+        return Em.I18n.t('installer.step7.showPropertiesWithIssues');
+      }
     }
     return '';
   }.property('isSubmitDisabled', 'submitButtonClicked', 'filterColumns.@each.selected'),
@@ -1557,19 +1558,34 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
   },
 
   toggleIssuesFilter: function () {
+    var errorServices = [],
+        issueServices = [];
+
     this.get('filterColumns').findProperty('attributeName', 'hasIssues').toggleProperty('selected');
 
     // if currently selected service does not have issue, jump to the first service with
issue.
-    if (this.get('selectedService.errorCount') == 0 )
+    if (this.get('selectedService.errorCount') === 0 )
     {
-      var errorServices = this.get('stepConfigs').filterProperty('errorCount');
-      if (errorServices.length > 0)
-      {
-        var service = errorServices[0];
-        this.set('selectedService', service);
-        $('a[href="#' + service.serviceName + '"]').tab('show');
-      }
+      this.get('stepConfigs').filterProperty('showConfig', true).forEach(function(service)
{
+        if (service.get('errorCount') > 0) errorServices.push(service);
+        if (service.get('hasConfigIssues') === true) issueServices.push(service);
+      });
+      if (errorServices.length === 0 && issueServices.length === 0) return;
+      this.switchToService(errorServices.length > 0 ? errorServices[0] : issueServices[0]);
     }
-  }
+  },
+
+  switchToService: function(service) {
+    this.set('selectedService', service);
+    $('a[href="#' + service.serviceName + '"]').tab('show');
+  },
+
+
+  issuesFilterSelected: function() {
+    return this.get('filterColumns').findProperty('attributeName', 'hasIssues').get('selected');
+  }.property('filterColumns.@each.selected'),
 
+  hasStepConfigIssues: function() {
+    return !this.get('stepConfigs').filterProperty('showConfig', true).everyProperty('hasConfigIssues',
false);
+  }.property('stepConfigs.@each.hasConfigIssues')
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/f0fec408/ambari-web/app/models/configs/objects/service_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config.js b/ambari-web/app/models/configs/objects/service_config.js
index d07412a..4bddcb6 100644
--- a/ambari-web/app/models/configs/objects/service_config.js
+++ b/ambari-web/app/models/configs/objects/service_config.js
@@ -136,7 +136,9 @@ App.ServiceConfig = Ember.Object.extend({
     this._super();
     this.set('dependentServiceNames', App.StackService.find(this.get('serviceName')).get('dependentServiceNames')
|| []);
     this.observeForeignKeys();
-  }
+  },
+
+  hasConfigIssues: Em.computed.someBy('activeProperties', 'hasIssues', true)
 });
 
 App.ConfigSiteTag = Ember.Object.extend({

http://git-wip-us.apache.org/repos/asf/ambari/blob/f0fec408/ambari-web/app/templates/common/configs/services_config.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/services_config.hbs b/ambari-web/app/templates/common/configs/services_config.hbs
index ffdf0ed..87bfdef 100644
--- a/ambari-web/app/templates/common/configs/services_config.hbs
+++ b/ambari-web/app/templates/common/configs/services_config.hbs
@@ -44,19 +44,19 @@
 {{view App.ServiceConfigContainerView}}
 {{#if controller.isRecommendedLoaded}}
     <p class="loading align-center"></p>
-    {{#if isSubmitDisabled}}
-      {{#unless submitButtonClicked}}
+    {{#unless controller.transitionInProgress}}
+      {{#if controller.hasStepConfigIssues}}
         <div class="alert">
           <span class="icon-warning-sign"></span> {{t installer.step7.attentionNeeded}}<br
/>
           {{issuesFilterText}} <a href="#" {{action toggleIssuesFilter target="controller"}}>{{issuesFilterLinkText}}</a>
         </div>
-      {{/unless}}
-    {{else}}
-      {{#unless submitButtonClicked}}
+      {{else}}
         <div class="alert alert-success">
           <span class="icon-check"></span> {{t installer.step7.noIssues}}<br
/>
-          <a href="#" {{action toggleIssuesFilter target="controller"}}>{{issuesFilterLinkText}}</a>
+          {{#if controller.issuesFilterSelected}}
+            <a href="#" {{action toggleIssuesFilter target="controller"}}>{{issuesFilterLinkText}}</a>
+          {{/if}}
         </div>
-      {{/unless}}
-    {{/if}}
+      {{/if}}
+    {{/unless}}
 {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/f0fec408/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index d43e18d..94b222a 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -24,76 +24,62 @@ var testHelpers = require('test/helpers');
 var installerStep7Controller,
   issuesFilterCases = [
     {
-      isSubmitDisabled: true,
-      submitButtonClicked: true,
-      isIssuesFilterActive: true,
-      issuesFilterText: '',
-      issuesFilterLinkText: Em.I18n.t('installer.step7.showAllProperties'),
-      title: 'issues filter on, submit button clicked'
-    },
-    {
-      isSubmitDisabled: true,
-      submitButtonClicked: false,
-      isIssuesFilterActive: true,
+      transitionInProgress: false,
+      hasStepConfigIssues: true,
+      issuesFilterSelected: true,
       issuesFilterText: Em.I18n.t('installer.step7.showingPropertiesWithIssues'),
       issuesFilterLinkText: Em.I18n.t('installer.step7.showAllProperties'),
-      title: 'issues filter on, submit button disabled'
+      title: 'issues filter on, has property issues, submit not clicked'
     },
     {
-      isSubmitDisabled: true,
-      submitButtonClicked: true,
-      isIssuesFilterActive: false,
+      transitionInProgress: true,
+      hasStepConfigIssues: true,
+      issuesFilterSelected: true,
       issuesFilterText: '',
       issuesFilterLinkText: '',
-      title: 'issues filter off, submit button clicked'
-    },
-    {
-      isSubmitDisabled: true,
-      submitButtonClicked: false,
-      isIssuesFilterActive: false,
-      issuesFilterText: '',
-      issuesFilterLinkText: Em.I18n.t('installer.step7.showPropertiesWithIssues'),
-      title: 'issues filter off, submit button disabled'
+      title: 'issues filter on, has property issues, submit clicked'
     },
     {
-      isSubmitDisabled: false,
-      submitButtonClicked: false,
-      isIssuesFilterActive: true,
-      issuesFilterText: '',
+      transitionInProgress: false,
+      hasStepConfigIssues: false,
+      issuesFilterSelected: true,
+      issuesFilterText: Em.I18n.t('installer.step7.showingPropertiesWithIssues'),
       issuesFilterLinkText: Em.I18n.t('installer.step7.showAllProperties'),
-      title: 'issues filter on, submit button enabled'
+      title: 'issues filter on, no property issues, submit not clicked'
     },
     {
-      isSubmitDisabled: false,
-      submitButtonClicked: false,
-      isIssuesFilterActive: false,
+      transitionInProgress: false,
+      hasStepConfigIssues: true,
+      issuesFilterSelected: false,
       issuesFilterText: '',
-      issuesFilterLinkText: '',
-      title: 'issues filter off, submit button enabled'
+      issuesFilterLinkText: Em.I18n.t('installer.step7.showPropertiesWithIssues'),
+      title: 'issues filter off, has property issues, submit not clicked'
     },
     {
-      isSubmitDisabled: false,
-      submitButtonClicked: false,
-      isIssuesFilterActive: true,
+      transitionInProgress: false,
+      hasStepConfigIssues: true,
+      issuesFilterSelected: false,
       issuesFilterText: '',
-      issuesFilterLinkText: Em.I18n.t('installer.step7.showAllProperties'),
-      title: 'issues filter on, submit button not clicked but active'
+      issuesFilterLinkText: Em.I18n.t('installer.step7.showPropertiesWithIssues'),
+      title: 'issues filter off, has property issues, submit not clicked'
     },
     {
-      isSubmitDisabled: false,
-      submitButtonClicked: true,
-      isIssuesFilterActive: true,
+      transitionInProgress: false,
+      hasStepConfigIssues: true,
+      issuesFilterSelected: false,
       issuesFilterText: '',
-      issuesFilterLinkText: Em.I18n.t('installer.step7.showAllProperties'),
-      title: 'issues filter on, submit button clicked and active'
+      issuesFilterLinkText: Em.I18n.t('installer.step7.showPropertiesWithIssues'),
+      title: 'issues filter off, has property issues, submit not clicked'
     }
   ],
   issuesFilterTestSetup = function (controller, testCase) {
     controller.set('submitButtonClicked', testCase.submitButtonClicked);
     controller.reopen({
-      isSubmitDisabled: testCase.isSubmitDisabled
+      isSubmitDisabled: testCase.isSubmitDisabled,
+      transitionInProgress: testCase.transitionInProgress,
+      issuesFilterSelected: testCase.issuesFilterSelected,
+      hasStepConfigIssues: testCase.hasStepConfigIssues
     });
-    controller.get('filterColumns').findProperty('attributeName', 'hasIssues').set('selected',
testCase.isIssuesFilterActive);
   };
 
 function getController() {
@@ -1403,7 +1389,7 @@ describe('App.InstallerStep7Controller', function () {
       it(item.title, function () {
         issuesFilterTestSetup(installerStep7Controller, item);
         expect(installerStep7Controller.get('issuesFilterLinkText')).to.equal(item.issuesFilterLinkText);
-      })
+      });
     });
 
   });
@@ -1420,25 +1406,28 @@ describe('App.InstallerStep7Controller', function () {
     it('selected service should be changed', function () {
       installerStep7Controller.setProperties({
         selectedService: {
+          serviceName: 'service1',
           errorCount: 0,
-          configGroups: []
+          configGroups: [],
+          showConfig: true
         },
         stepConfigs: [
-          {
+          Em.Object.create({
+            serviceName: 'service2',
             errorCount: 1,
-            configGroups: []
-          },
-          {
+            configGroups: [],
+            showConfig: true
+          }),
+          Em.Object.create({
+            serviceName: 'service3',
             errorCount: 2,
-            configGroups: []
-          }
+            configGroups: [],
+            showConfig: true
+          })
         ]
       });
       installerStep7Controller.toggleIssuesFilter();
-      expect(installerStep7Controller.get('selectedService')).to.eql({
-        errorCount: 1,
-        configGroups: []
-      });
+      expect(installerStep7Controller.get('selectedService.serviceName')).to.eql('service2');
     });
   });
 


Mime
View raw message