ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: Revert "AMBARI-10533. Admin View About says 2.0.0 (and links to Admin View are hardcoded to 2.0.0) (alexantonenko)"
Date Fri, 17 Apr 2015 15:15:35 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 77e77010c -> affca503f


Revert "AMBARI-10533. Admin View About says 2.0.0 (and links to Admin View are hardcoded to
2.0.0) (alexantonenko)"

This reverts commit ecaf2d15f3657ca53625434bbfcce2c36fbaf4b4.


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

Branch: refs/heads/trunk
Commit: affca503f2521d009790d69e80c298e8f3ca3325
Parents: 77e7701
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Fri Apr 17 18:11:24 2015 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Fri Apr 17 18:11:24 2015 +0300

----------------------------------------------------------------------
 .../assets/data/cluster/ambariServerInfo.json   |  7 ---
 .../main/resources/ui/admin-web/app/index.html  |  1 -
 .../app/scripts/controllers/mainCtrl.js         | 23 ++++----
 .../admin-web/app/scripts/services/Component.js | 30 -----------
 .../admin-web/app/views/modals/AboutModal.html  |  4 +-
 .../test/unit/services/Component_test.js        | 56 --------------------
 ambari-web/app/router.js                        | 28 +++-------
 .../main/admin/stack_upgrade/versions_view.js   |  7 +--
 ambari-web/test/router_test.js                  | 38 -------------
 .../admin/stack_upgrade/version_view_test.js    | 14 +----
 10 files changed, 20 insertions(+), 188 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/affca503/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/cluster/ambariServerInfo.json
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/cluster/ambariServerInfo.json
b/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/cluster/ambariServerInfo.json
deleted file mode 100644
index bddc249..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/cluster/ambariServerInfo.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "RootServiceComponents" : {
-    "component_name" : "AMBARI_SERVER",
-    "component_version" : "2.0.0",
-    "service_name" : "AMBARI"
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/affca503/ambari-admin/src/main/resources/ui/admin-web/app/index.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/index.html b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
index ca2ae8b..17a1dc9 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/index.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
@@ -146,7 +146,6 @@
     <script src="scripts/services/User.js"></script>
     <script src="scripts/services/Group.js"></script>
     <script src="scripts/services/View.js"></script>
-    <script src="scripts/services/Component.js"></script>
     <script src="scripts/services/Cluster.js"></script>
     <script src="scripts/services/Alert.js"></script>
     <script src="scripts/services/PermissionLoader.js"></script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/affca503/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
index 1bdfe05..baec0cf 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
@@ -18,7 +18,7 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('MainCtrl',['$scope', '$window','Auth', 'Alert', '$modal', 'Cluster', 'Component',
'View', function($scope, $window, Auth, Alert, $modal, Cluster, Component, View) {
+.controller('MainCtrl',['$scope', '$window','Auth', 'Alert', '$modal', 'Cluster', 'View',
function($scope, $window, Auth, Alert, $modal, Cluster, View) {
   $scope.signOut = function() {
     var data = JSON.parse(localStorage.ambari);
     delete data.app.authenticated;
@@ -31,19 +31,14 @@ angular.module('ambariAdminConsole')
   };
 
   $scope.about = function() {
-    Component.getAmbariServer().then(function(component) {
-      var modalInstance = $modal.open({
-        templateUrl:'views/modals/AboutModal.html',
-        controller: ['$scope', function($scope) {
-          $scope.component = component;
-          $scope.ok = function() {
-            modalInstance.close();
-          };
-        }]
-      });
-    }).catch(function() {
-      Alert.error('Cannot load component status');
-    });
+  	var modalInstance = $modal.open({
+  		templateUrl:'views/modals/AboutModal.html',
+  		controller: ['$scope', function($scope) {
+  			$scope.ok = function() {
+  				modalInstance.close();
+  			};
+  		}]
+  	});
   };
 
   $scope.currentUser = Auth.getCurrentUser();

http://git-wip-us.apache.org/repos/asf/ambari/blob/affca503/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Component.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Component.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Component.js
deleted file mode 100644
index 7432a90..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Component.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-'use strict';
-
-angular.module('ambariAdminConsole')
-  .factory('Component', ['$http', '$q', 'Settings', function($http, $q, Settings) {
-    return {
-      getAmbariServer: function() {
-        return $http.get(Settings.baseUrl + '/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/component_version&minimal_response=true')
-          .then(function(response) {
-            return response.data;
-          });
-      }
-    };
-  }]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/affca503/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/AboutModal.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/AboutModal.html
b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/AboutModal.html
index c2820df..d1ac132 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/AboutModal.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/AboutModal.html
@@ -28,7 +28,7 @@
       <div class="project">Apache Ambari</div>
       <br>
       <span id="i18n-33">Version</span>
-      <span>{{component.RootServiceComponents.component_version}}</span>
+      <script id="metamorph-199-start" type="text/x-placeholder"></script>2.0.0<script
id="metamorph-199-end" type="text/x-placeholder"></script>
       <br>
       <br>
       <a href="http://ambari.apache.org/" target="_blank"><span id="i18n-34">Get
involved!</span></a>
@@ -39,4 +39,4 @@
 </div>
 <div class="modal-footer">
     <button class="btn btn-success" ng-click="ok()">OK</button>
-</div>
+</div>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/affca503/ambari-admin/src/main/resources/ui/admin-web/test/unit/services/Component_test.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/services/Component_test.js
b/ambari-admin/src/main/resources/ui/admin-web/test/unit/services/Component_test.js
deleted file mode 100644
index 03373b5..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/test/unit/services/Component_test.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-describe('#Component', function () {
-  var componentService,
-    httpBackend,
-    Settings;
-
-  beforeEach(function() {
-    module('ambariAdminConsole');
-
-    inject(function(_Component_, $httpBackend, _Settings_) {
-      componentService = _Component_;
-      httpBackend = $httpBackend;
-      Settings = _Settings_;
-    });
-  });
-
-  afterEach(function() {
-    httpBackend.verifyNoOutstandingExpectation();
-    httpBackend.verifyNoOutstandingRequest();
-  });
-
-  var returnData = {
-    RootServiceComponents: {
-      'component_name': "AMBARI_SERVER",
-      'component_version': "2.0.0",
-      'service_name': "AMBARI"
-    }
-  };
-  it('should get the information of the Ambari server', function() {
-    httpBackend.whenGET(/\/api\/v1\/services\/AMBARI\/components\/AMBARI_SERVER\?.*/).respond(returnData);
-
-    componentService.getAmbariServer().then(function(response) {
-      expect(response).toEqual(returnData);
-      expect(response.RootServiceComponents.component_version).toEqual('2.0.0');
-    });
-
-    httpBackend.flush();
-  });
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/affca503/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index 8d2a5d2..9759b0f 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -271,9 +271,12 @@ App.Router = Em.Router.extend({
     } else {
       controller.postLogin(false, false, null);
     }
+
   },
 
   loginGetClustersSuccessCallback: function (clustersData, opt, params) {
+    var adminViewUrl = '/views/ADMIN_VIEW/2.0.0/INSTANCE/#/';
+    //TODO: Replace hard coded value with query. Same in templates/application.hbs
     var loginController = this.get('loginController');
     var loginData = params.loginData;
     var privileges = loginData.privileges || [];
@@ -287,12 +290,8 @@ App.Router = Em.Router.extend({
           router.setClusterInstalled(clustersData);
           transitionToApp = true;
         } else {
-          App.ajax.send({
-            name: 'ambari.service.load_server_version',
-            sender: this,
-            success: 'adminViewInfoSuccessCallback',
-            error: 'adminViewInfoErrorCallback'
-          });
+          window.location = adminViewUrl;
+          return;
         }
       } else {
         if (clustersData.items.length) {
@@ -328,16 +327,6 @@ App.Router = Em.Router.extend({
       }
   },
 
-  adminViewInfoSuccessCallback: function(data) {
-    if (data && data.RootServiceComponents && data.RootServiceComponents.component_version)
{
-      window.location.replace('/views/ADMIN_VIEW/'+data.RootServiceComponents.component_version+'/INSTANCE/#/');
-    }
-  },
-
-  adminViewInfoErrorCallback: function (req) {
-    console.log("Get admin view version error: " + req.statusCode);
-  },
-
   loginGetClustersErrorCallback: function (req) {
     console.log("Get clusters error: " + req.statusCode);
   },
@@ -516,12 +505,7 @@ App.Router = Em.Router.extend({
             router.transitionTo('login');
           });
         } else {
-          App.ajax.send({
-            name: 'ambari.service.load_server_version',
-            sender: router,
-            success: 'adminViewInfoSuccessCallback',
-            error: 'adminViewInfoErrorCallback'
-          });
+            window.location.replace('/views/ADMIN_VIEW/2.0.0/INSTANCE/#/');
         }
       }
     }),

http://git-wip-us.apache.org/repos/asf/ambari/blob/affca503/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 3cb7f79..3b2848d 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
@@ -168,12 +168,7 @@ App.MainAdminStackVersionsView = Em.View.extend({
    */
   goToVersions: function () {
     return App.showConfirmationPopup(function () {
-        App.ajax.send({
-          name: 'ambari.service.load_server_version',
-          sender: this
-        }).then(function(data) {
-          window.location.replace('/views/ADMIN_VIEW/'+data.RootServiceComponents.component_version+'/INSTANCE/#/stackVersions');
-        });
+      window.location.replace('/views/ADMIN_VIEW/2.0.0/INSTANCE/#/stackVersions');
     },
     Em.I18n.t('admin.stackVersions.manageVersions.popup.body'),
     null,

http://git-wip-us.apache.org/repos/asf/ambari/blob/affca503/ambari-web/test/router_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/router_test.js b/ambari-web/test/router_test.js
index 3aa7751..eefb35a 100644
--- a/ambari-web/test/router_test.js
+++ b/ambari-web/test/router_test.js
@@ -108,42 +108,4 @@ describe('App.Router', function () {
 
   });
 
-  describe('#adminViewInfoSuccessCallback', function() {
-    beforeEach(function() {
-      sinon.stub(window.location, 'replace', Em.K);
-    });
-
-    afterEach(function() {
-      window.location.replace.restore();
-    });
-
-    it('should redirect to the latest version of admin view', function() {
-      var tests = [
-        {
-          mockData: {
-            RootServiceComponents: {
-              component_version: '2.0.0'
-            }
-          },
-          expected: '/views/ADMIN_VIEW/2.0.0/INSTANCE/#/'
-        },
-        {
-          mockData: {
-            RootServiceComponents: {
-              component_version: '2.1.0'
-            }
-          },
-          expected: '/views/ADMIN_VIEW/2.1.0/INSTANCE/#/'
-        }
-      ];
-
-      tests.forEach(function(data) {
-        router.adminViewInfoSuccessCallback(data.mockData);
-        expect(window.location.replace.calledWith(data.expected)).to.be.true;
-      });
-
-    });
-
-  });
-
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/affca503/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 29de70d..5a457bf 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
@@ -281,26 +281,16 @@ describe('App.mainAdminStackVersionsView', function () {
     before(function () {
       sinon.spy(App, 'showConfirmationPopup', Em.K);
       sinon.stub(window.location, 'replace', Em.K);
-      var data = {
-        RootServiceComponents: {
-          component_version: '2.1.0'
-        }
-      };
-      sinon.stub(App.ajax, 'send').returns({then: function(callback) { callback(data); }});
     });
-
     after(function () {
       App.showConfirmationPopup.restore();
       window.location.replace.restore();
-      App.ajax.send.restore();
     });
-
-    it("should go to link using the version retrieved by query", function() {
+    it("", function() {
       var popup = view.goToVersions();
       expect(App.showConfirmationPopup.calledOnce).to.be.true;
       popup.onPrimary();
-      expect(App.ajax.send.calledOnce).to.be.true;
-      expect(window.location.replace.calledWith('/views/ADMIN_VIEW/2.1.0/INSTANCE/#/stackVersions')).to.be.true;
+      expect(window.location.replace.calledWith('/views/ADMIN_VIEW/2.0.0/INSTANCE/#/stackVersions')).to.be.true;
     });
   });
 


Mime
View raw message