ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject ambari git commit: AMBARI-13563 Upgrade: UI should determine the ongoing upgrade type based on Upgrade/upgrade_type from the API. (atkach)
Date Mon, 26 Oct 2015 17:32:57 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk f4448448b -> 66b1c2717


AMBARI-13563 Upgrade: UI should determine the ongoing upgrade type based on Upgrade/upgrade_type
from the API. (atkach)


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

Branch: refs/heads/trunk
Commit: 66b1c27176fde8b66711403aa9d2caef03c79b59
Parents: f444844
Author: Andrii Tkach <atkach@hortonworks.com>
Authored: Mon Oct 26 18:47:04 2015 +0200
Committer: Andrii Tkach <atkach@hortonworks.com>
Committed: Mon Oct 26 19:32:48 2015 +0200

----------------------------------------------------------------------
 .../controllers/global/cluster_controller.js    |  3 +-
 .../main/admin/stack_and_upgrade_controller.js  | 31 ++++++++++++++++++--
 ambari-web/app/utils/ajax/ajax.js               |  2 +-
 3 files changed, 31 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/66b1c271/ambari-web/app/controllers/global/cluster_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index 6fdfc18..4c3d1bb 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -306,7 +306,8 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
         upgradeController.setDBProperties({
           upgradeId: lastUpgradeData.Upgrade.request_id,
           isDowngrade: lastUpgradeData.Upgrade.direction === 'DOWNGRADE',
-          upgradeState: lastUpgradeData.Upgrade.request_status
+          upgradeState: lastUpgradeData.Upgrade.request_status,
+          upgradeType: lastUpgradeData.Upgrade.upgrade_type
         });
         upgradeController.loadRepoVersionsToModel().done(function () {
           upgradeController.setDBProperty('upgradeVersion', App.RepositoryVersion.find().findProperty('repositoryVersion',
lastUpgradeData.Upgrade.to_version).get('displayName'));

http://git-wip-us.apache.org/repos/asf/ambari/blob/66b1c271/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 40419a3..e2deaf5 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
@@ -49,6 +49,12 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
    * @type {string}
    * @default null
    */
+  upgradeType: null,
+
+  /**
+   * @type {string}
+   * @default null
+   */
   upgradeTypeDisplayName: null,
 
   /**
@@ -111,7 +117,16 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
   /**
    * properties that stored to localStorage to resume wizard progress
    */
-  wizardStorageProperties: ['upgradeId', 'upgradeVersion', 'currentVersion', 'upgradeTypeDisplayName',
'failuresTolerance', 'isDowngrade', 'isSuspended'],
+  wizardStorageProperties: [
+    'upgradeId',
+    'upgradeVersion',
+    'currentVersion',
+    'upgradeTypeDisplayName',
+    'upgradeType',
+    'failuresTolerance',
+    'isDowngrade',
+    'isSuspended'
+  ],
 
   /**
    * mutable properties of Upgrade Task
@@ -511,7 +526,15 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     this.set('upgradeVersion', params.label);
     this.set('isDowngrade', !!params.isDowngrade);
     var upgradeMethod = this.get('upgradeMethods').findProperty('type', params.type);
-    var upgradeTypeDisplayName  = upgradeMethod ? upgradeMethod.get('displayName') : null;
+    var upgradeTypeDisplayName = null;
+    var upgradeType = null;
+
+    if (upgradeMethod) {
+      upgradeTypeDisplayName = upgradeMethod.get('displayName');
+      upgradeType = upgradeMethod.get('type');
+    }
+
+    this.set('upgradeType', upgradeType);
     this.set('upgradeTypeDisplayName', upgradeTypeDisplayName);
     this.set('failuresTolerance', Em.Object.create({
       skipComponentFailures: params.skipComponentFailures == 'true',
@@ -522,6 +545,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       upgradeId: data.resources[0].Upgrade.request_id,
       upgradeState: 'PENDING',
       isDowngrade: !!params.isDowngrade,
+      upgradeType: upgradeType,
       upgradeTypeDisplayName: upgradeTypeDisplayName,
       failuresTolerance: Em.Object.create({
         skipComponentFailures: params.skipComponentFailures == 'true',
@@ -781,7 +805,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     var self = this;
     if (isInUpgradeWizard) {
       this.get('upgradeMethods').forEach(function(method){
-        if (method.get('displayName') == self.get('upgradeTypeDisplayName')) {
+        if (method.get('type') == self.get('upgradeType')) {
           method.set('selected', true);
         } else {
           method.set('selected', false);
@@ -1107,6 +1131,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
         upgradeVersion: undefined,
         currentVersion: undefined,
         upgradeTypeDisplayName: undefined,
+        upgradeType: undefined,
         failuresTolerance: undefined,
         isDowngrade: undefined
       });

http://git-wip-us.apache.org/repos/asf/ambari/blob/66b1c271/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 7e7bc58..f845381 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1291,7 +1291,7 @@ var urls = {
     'mock': '/data/clusters/info.json'
   },
   'cluster.load_last_upgrade': {
-    'real': '/clusters/{clusterName}/upgrades?fields=Upgrade/request_status,Upgrade/request_id,Upgrade/to_version,Upgrade/direction',
+    'real': '/clusters/{clusterName}/upgrades?fields=Upgrade/request_status,Upgrade/request_id,Upgrade/to_version,Upgrade/direction,Upgrade/upgrade_type',
     'mock': '/data/stack_versions/upgrades.json'
   },
   'cluster.update_upgrade_version': {


Mime
View raw message