ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject [2/2] ambari git commit: AMBARI-11722. Infinite spinner after reopening RU window on Finalize stage (akovalenko)
Date Fri, 05 Jun 2015 16:18:19 GMT
AMBARI-11722. Infinite spinner after reopening RU window on Finalize stage (akovalenko)


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

Branch: refs/heads/trunk
Commit: 4ae28b812bf4980752d5f2c7c7c62bec04769254
Parents: 85b05ba
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Fri Jun 5 19:14:06 2015 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Fri Jun 5 19:14:06 2015 +0300

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js  | 12 ++++++
 .../stack_upgrade/stack_upgrade_wizard.hbs      |  6 +--
 .../admin/stack_upgrade/upgrade_wizard_view.js  | 42 ++++++++------------
 .../stack_upgrade/upgrade_wizard_view_test.js   |  8 ++--
 4 files changed, 36 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4ae28b81/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
index 3bdd317..890e5d8 100644
--- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -117,6 +117,18 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     return App.get('apiPrefix') + '/clusters/' + App.get('clusterName') + '/stack_versions?fields=ClusterStackVersions/*';
   }.property('App.clusterName'),
 
+  /**
+   * Determines if list of services with checks that failed and were skipped by user during
the upgrade is loaded
+   * @type {boolean}
+   */
+  areSkippedServiceChecksLoaded: false,
+
+  /**
+   * List of services with checks that failed and were skipped by user during the upgrade
+   * @type {array}
+   */
+  skippedServiceChecks: [],
+
   init: function () {
     this.initDBProperties();
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ae28b81/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
index 0198afb..75d97e1 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
@@ -93,11 +93,11 @@
                 <p>{{t admin.stackUpgrade.finalize.message.upgrade}}</p>
               {{/if}}
 
-              {{#if view.areSkippedServiceChecksLoaded}}
-                {{#if view.skippedServiceChecks.length}}
+              {{#if areSkippedServiceChecksLoaded}}
+                {{#if skippedServiceChecks.length}}
                   <div>{{t admin.stackUpgrade.finalize.message.skippedServiceChecks}}</div>
                   <ul>
-                    {{#each serviceName in view.skippedServiceChecks}}
+                    {{#each serviceName in skippedServiceChecks}}
                       <li>{{serviceName}}</li>
                     {{/each}}
                   </ul>

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ae28b81/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js
index 3c1f7be..590201e 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js
@@ -64,18 +64,6 @@ App.upgradeWizardView = Em.View.extend({
   outsideView: true,
 
   /**
-   * Determines if list of services with checks that failed and were skipped by user during
the upgrade is loaded
-   * @type {boolean}
-   */
-  areSkippedServiceChecksLoaded: false,
-
-  /**
-   * List of services with checks that failed and were skipped by user during the upgrade
-   * @type {array}
-   */
-  skippedServiceChecks: [],
-
-  /**
    * Downgrade should be available only if target version higher than current, so we can't
downgrade
    * when downgrade already started
    * @type {boolean}
@@ -251,18 +239,22 @@ App.upgradeWizardView = Em.View.extend({
   }.observes('App.clusterName'),
 
   getSkippedServiceChecks: function () {
-    if (this.get('isFinalizeItem') && !this.get('areSkippedServiceChecksLoaded'))
{
-      var self = this;
-      App.ajax.send({
-        name: 'admin.upgrade.service_checks',
-        sender: this,
-        data: {
-          upgradeId: this.get('controller.upgradeId')
-        },
-        success: 'getSkippedServiceChecksSuccessCallback'
-      }).complete(function () {
-          self.set('areSkippedServiceChecksLoaded', true);
-        });
+    if (this.get('isFinalizeItem')) {
+      if (!this.get('controller.areSkippedServiceChecksLoaded')) {
+        var self = this;
+        App.ajax.send({
+          name: 'admin.upgrade.service_checks',
+          sender: this,
+          data: {
+            upgradeId: this.get('controller.upgradeId')
+          },
+          success: 'getSkippedServiceChecksSuccessCallback'
+        }).complete(function () {
+            self.set('controller.areSkippedServiceChecksLoaded', true);
+          });
+      }
+    } else {
+      this.set('controller.areSkippedServiceChecksLoaded', false);
     }
   }.observes('isFinalizeItem'),
 
@@ -282,7 +274,7 @@ App.upgradeWizardView = Em.View.extend({
           }
         });
         skippedServiceChecks = skippedServiceChecks.uniq();
-        this.set('skippedServiceChecks', skippedServiceChecks);
+        this.set('controller.skippedServiceChecks', skippedServiceChecks);
       }
     }
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ae28b81/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js
index 5f47a52..9dfaddd 100644
--- a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js
+++ b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js
@@ -649,7 +649,7 @@ describe('App.upgradeWizardView', function () {
     var cases = [
       {
         isFinalizeItem: false,
-        areSkippedServiceChecksLoaded: false,
+        areSkippedServiceChecksLoaded: true,
         ajaxSendCallCount: 0,
         areSkippedServiceChecksLoadedResult: false,
         title: 'no ajax request should be sent away from Finalize step'
@@ -685,13 +685,13 @@ describe('App.upgradeWizardView', function () {
 
     cases.forEach(function (item) {
       it(item.title, function () {
-        view.set('areSkippedServiceChecksLoaded', item.areSkippedServiceChecksLoaded);
+        view.set('controller.areSkippedServiceChecksLoaded', item.areSkippedServiceChecksLoaded);
         view.reopen({
           isFinalizeItem: item.isFinalizeItem
         });
         view.propertyDidChange('isFinalizeItem');
         expect(App.ajax.send.callCount).to.equal(item.ajaxSendCallCount);
-        expect(view.get('areSkippedServiceChecksLoaded')).to.equal(item.areSkippedServiceChecksLoadedResult);
+        expect(view.get('controller.areSkippedServiceChecksLoaded')).to.equal(item.areSkippedServiceChecksLoadedResult);
         if (item.ajaxSendCallCount) {
           expect(App.ajax.send.firstCall.args[0].data.upgradeId).to.equal(1);
         }
@@ -783,7 +783,7 @@ describe('App.upgradeWizardView', function () {
 
     it('should set an array of service names from tha latest service checks step', function
() {
       view.getSkippedServiceChecksSuccessCallback(data);
-      expect(view.get('skippedServiceChecks')).to.eql(['ZooKeeper', 'YARN', 'Hive']);
+      expect(view.get('controller.skippedServiceChecks')).to.eql(['ZooKeeper', 'YARN', 'Hive']);
     });
 
   });


Mime
View raw message