ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject ambari git commit: AMBARI-21046. UI: Upgrades should be started using repo_version_ids instead of version strings (alexantonenko)
Date Fri, 21 Jul 2017 13:54:03 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-21450 3430e33fd -> e378baddc


AMBARI-21046. UI: Upgrades should be started using repo_version_ids instead of version strings
(alexantonenko)


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

Branch: refs/heads/branch-feature-AMBARI-21450
Commit: e378baddcd684553e2d82a0fe6054574bf67b2bf
Parents: 3430e33
Author: Alex Antonenko <aantonenko@hortonworks.com>
Authored: Fri Jul 21 16:48:29 2017 +0300
Committer: Alex Antonenko <aantonenko@hortonworks.com>
Committed: Fri Jul 21 16:48:29 2017 +0300

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js  | 24 ++++++++++++--------
 ambari-web/app/utils/ajax/ajax.js               |  3 +--
 .../admin/stack_and_upgrade_controller_test.js  | 11 +++++----
 3 files changed, 21 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e378badd/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 8527e29..3243aa2 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
@@ -371,14 +371,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       self.loadStackVersionsToModel(true).done(function () {
         self.loadRepoVersionsToModel().done(function() {
           self.loadCompatibleVersions().done(function() {
-            var currentVersion = App.StackVersion.find().findProperty('state', 'CURRENT');
-            if (currentVersion) {
-              self.set('currentVersion', {
-                stack_name: currentVersion.get('repositoryVersion.stackVersionType'),
-                repository_version: currentVersion.get('repositoryVersion.repositoryVersion'),
-                repository_name: currentVersion.get('repositoryVersion.displayName')
-              });
-            }
+            self.updateCurrentStackVersion();
             dfd.resolve();
           });
         });
@@ -387,6 +380,17 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     return dfd.promise();
   },
 
+  updateCurrentStackVersion: function(){
+    var currentVersion = App.StackVersion.find().findProperty('state', 'CURRENT');
+    if (currentVersion) {
+      this.set('currentVersion', {
+        repository_version: currentVersion.get('repositoryVersion.repositoryVersion'),
+        repository_name: currentVersion.get('repositoryVersion.displayName'),
+        id: currentVersion.get('repositoryVersion.id')
+      });
+    }
+  },
+
   /**
    * load upgrade tasks by upgrade id
    * @return {$.Deferred}
@@ -701,6 +705,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
         from: App.RepositoryVersion.find().findProperty('displayName', this.get('upgradeVersion')).get('repositoryVersion'),
         value: currentVersion.repository_version,
         label: currentVersion.repository_name,
+        id: currentVersion.id,
         isDowngrade: true,
         upgradeType: this.get('upgradeType')
       },
@@ -1318,8 +1323,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       label: version.get('displayName'),
       type: version.get('upgradeType'),
       skipComponentFailures: version.get('skipComponentFailures') ? 'true' : 'false',
-      skipSCFailures: version.get('skipSCFailures') ? 'true' : 'false',
-      targetStack: version.get('displayName')
+      skipSCFailures: version.get('skipSCFailures') ? 'true' : 'false'
     };
     if (App.get('supports.preUpgradeCheck')) {
       this.set('requestInProgress', true);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e378badd/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 b05f325..469ed91 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1709,8 +1709,7 @@ var urls = {
         timeout : 600000,
         data: JSON.stringify({
           "Upgrade": {
-            "repository_id": data.id,
-            "repository_version": data.value,
+            "repository_version_id": data.id,
             "upgrade_type": data.type,
             "skip_failures": data.skipComponentFailures,
             "skip_service_check_failures": data.skipSCFailures,

http://git-wip-us.apache.org/repos/asf/ambari/blob/e378badd/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
index c346c6f..0ef3891 100644
--- a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
@@ -128,7 +128,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       sinon.stub(App.StackVersion, 'find').returns([Em.Object.create({
         state: 'CURRENT',
         repositoryVersion: {
-          stackVersionType: 'HDP',
+          id: '1',
           repositoryVersion: '2.2',
           displayName: 'HDP-2.2'
         }
@@ -156,7 +156,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
     });
     it('currentVersion is corrent', function () {
       expect(controller.get('currentVersion')).to.eql({
-        "stack_name": 'HDP',
+        "id": "1",
         "repository_version": "2.2",
         "repository_name": "HDP-2.2"
       });
@@ -391,7 +391,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   describe("#runPreUpgradeCheck()", function() {
     it("make ajax call", function() {
       controller.runPreUpgradeCheck(Em.Object.create({
-        id: 1,
+        id: '1',
         repositoryVersion: '2.2',
         displayName: 'HDP-2.2',
         upgradeType: 'ROLLING',
@@ -402,7 +402,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       expect(args[0]).to.exists;
       expect(args[0].sender).to.be.eql(controller);
       expect(args[0].data).to.be.eql({
-        id: 1,
+        id: '1',
         value: '2.2',
         label: 'HDP-2.2',
         type: 'ROLLING',
@@ -1157,6 +1157,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       controller.set('upgradeVersion', 'HDP-2.3');
       controller.set('upgradeType', 'NON_ROLLING');
       controller.startDowngrade(Em.Object.create({
+        id: '1',
         repository_version: '2.2',
         repository_name: 'HDP-2.2'
       }));
@@ -1169,7 +1170,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
 
     it('request-data is valid', function () {
       expect(this.callArgs.data).to.eql({
-        from: '2.3',
+        id: '1',
         value: '2.2',
         label: 'HDP-2.2',
         isDowngrade: true,


Mime
View raw message