ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-11639: Ambari Admin View URL does not get properly parsed for custom versions (dili)
Date Fri, 02 Sep 2016 19:14:20 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk b1c2edbe2 -> 24a50b7a2


AMBARI-11639: Ambari Admin View URL does not get properly parsed for custom versions (dili)


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

Branch: refs/heads/trunk
Commit: 24a50b7a26336c7d91a3623ce77d83e280f026a8
Parents: b1c2edb
Author: Di Li <dili@apache.org>
Authored: Fri Sep 2 15:14:01 2016 -0400
Committer: Di Li <dili@apache.org>
Committed: Fri Sep 2 15:14:01 2016 -0400

----------------------------------------------------------------------
 ambari-web/app/router.js                        |  2 +-
 .../main/admin/stack_upgrade/versions_view.js   |  2 +-
 ambari-web/test/router_test.js                  |  4 +-
 .../admin/stack_upgrade/version_view_test.js    | 44 ++++++++++++++++++++
 4 files changed, 48 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/24a50b7a/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index d367ce3..c7a70f1 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -630,7 +630,7 @@ App.Router = Em.Router.extend({
           }
         }),
         sortedMappedVersions = mappedVersions.sort(),
-        latestVersion = sortedMappedVersions[sortedMappedVersions.length-1];
+        latestVersion = sortedMappedVersions[sortedMappedVersions.length-1].replace(/[^\d.-]/g,
'');
       window.location.replace(App.appURLRoot +  'views/ADMIN_VIEW/' + latestVersion + '/INSTANCE/#/');
     }
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/24a50b7a/ambari-web/app/views/main/admin/stack_upgrade/versions_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/versions_view.js b/ambari-web/app/views/main/admin/stack_upgrade/versions_view.js
index 59baf07..9847209 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/versions_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/versions_view.js
@@ -193,7 +193,7 @@ App.MainAdminStackVersionsView = Em.View.extend({
               }
             }),
             sortedMappedVersions = mappedVersions.sort(),
-            latestVersion = sortedMappedVersions[sortedMappedVersions.length-1];
+            latestVersion = sortedMappedVersions[sortedMappedVersions.length-1].replace(/[^\d.-]/g,
'');
             window.location.replace(App.appURLRoot + 'views/ADMIN_VIEW/' + latestVersion
+ '/INSTANCE/#/stackVersions');
         }
       });

http://git-wip-us.apache.org/repos/asf/ambari/blob/24a50b7a/ambari-web/test/router_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/router_test.js b/ambari-web/test/router_test.js
index e17c9e2..7e58ad0 100644
--- a/ambari-web/test/router_test.js
+++ b/ambari-web/test/router_test.js
@@ -102,7 +102,7 @@ describe('App.Router', function () {
           }
         }, {
           'RootServiceComponents': {
-            'component_version': '2.0.0'
+            'component_version': '2.0.0_MyBuild'
           }
         }]
       },
@@ -128,7 +128,7 @@ describe('App.Router', function () {
       mockData: {
         components: [{
           'RootServiceComponents': {
-            component_version: '2.1.0'
+            component_version: '2.1.0_MyBuild'
           }
         }]
       },

http://git-wip-us.apache.org/repos/asf/ambari/blob/24a50b7a/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
index b7df818..b9e8e6d 100644
--- a/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
+++ b/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
@@ -374,6 +374,50 @@ describe('App.mainAdminStackVersionsView', function () {
     });
   });
 
+  describe("#goToVersionsCustomVersions", function() {
+    var data = {
+      components: [{
+        'RootServiceComponents': {
+          'component_version': '1.9.0'
+        }
+      }, {
+        'RootServiceComponents': {
+          'component_version': '2.1.0_MyBuild'
+        }
+      }, {
+        'RootServiceComponents': {
+          'component_version': '2.0.0'
+        }
+      }]
+    };
+    before(function () {
+      sinon.spy(App, 'showConfirmationPopup');
+      sinon.stub(window.location, 'replace', Em.K);
+    });
+    after(function () {
+      App.showConfirmationPopup.restore();
+      window.location.replace.restore();
+    });
+
+    beforeEach(function () {
+      App.ajax.send.restore();
+      sinon.stub(App.ajax, 'send').returns({
+        then: function(callback) {
+          callback(data);
+        }
+      });
+    });
+
+    it("should go to link using the version retrieved by query", function() {
+      var popup = view.goToVersions();
+      expect(App.showConfirmationPopup.calledOnce).to.be.true;
+      popup.onPrimary();
+      var args = testHelpers.findAjaxRequest('name', 'ambari.service.load_server_version');
+      expect(args[0]).exists;
+      expect(window.location.replace.calledWith('/views/ADMIN_VIEW/2.1.0/INSTANCE/#/stackVersions')).to.be.true;
+    });
+  });
+
   describe("#willInsertElement()", function() {
     beforeEach(function () {
       sinon.stub(view, 'poll', Em.K);


Mime
View raw message