ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [32/50] [abbrv] git commit: Revert "AMBARI-7526. Unable to logout from Admin View, when ambari-server is stopped. (jaimin)"
Date Wed, 01 Oct 2014 15:27:30 GMT
Revert "AMBARI-7526. Unable to logout from Admin View, when ambari-server is stopped. (jaimin)"

This reverts commit 3843209c127aeab29c63799c5c38df2b54b2b9f1.


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

Branch: refs/heads/branch-alerts-dev
Commit: 9db24dad0d29cbfb27db5b9a6a3e8372204ee602
Parents: 83efcfe
Author: Yusaku Sako <yusaku@hortonworks.com>
Authored: Tue Sep 30 15:42:21 2014 -0700
Committer: Yusaku Sako <yusaku@hortonworks.com>
Committed: Tue Sep 30 15:42:21 2014 -0700

----------------------------------------------------------------------
 ambari-admin/pom.xml                            | 17 +-----
 .../main/resources/ui/admin-web/app/index.html  |  2 +-
 .../app/scripts/controllers/mainCtrl.js         | 15 ++---
 .../ui/admin-web/app/scripts/services/Auth.js   |  9 +--
 .../src/main/resources/ui/admin-web/bower.json  | 15 ++---
 .../main/resources/ui/admin-web/package.json    | 19 -------
 .../resources/ui/admin-web/test/e2e/signout.js  | 43 ---------------
 .../resources/ui/admin-web/test/karma.conf.js   | 58 --------------------
 .../ui/admin-web/test/protractor-conf.js        | 51 -----------------
 .../resources/ui/admin-web/test/spec/test.js    | 30 ++++++++++
 .../test/unit/controllers/mainCtrl_test.js      | 54 ------------------
 11 files changed, 43 insertions(+), 270 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9db24dad/ambari-admin/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-admin/pom.xml b/ambari-admin/pom.xml
index 3b78238..6f70b43 100644
--- a/ambari-admin/pom.xml
+++ b/ambari-admin/pom.xml
@@ -15,7 +15,7 @@
    limitations under the License.
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <parent>
     <groupId>org.apache.ambari</groupId>
     <artifactId>ambari-project</artifactId>
@@ -122,21 +122,6 @@
               </arguments>
             </configuration>
           </execution>
-          <execution>
-            <id>unit test</id>
-            <phase>test</phase>
-            <goals>
-              <goal>exec</goal>
-            </goals>
-            <configuration>
-              <workingDirectory>${basedir}/src/main/resources/ui/admin-web</workingDirectory>
-              <executable>npm</executable>
-              <arguments>
-                <argument>run</argument>
-                <argument>test-single-run</argument>
-              </arguments>
-            </configuration>
-          </execution>
         </executions>
       </plugin>
       <plugin>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9db24dad/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 b197302..2fb9fce 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
@@ -52,7 +52,7 @@
             <ul class="nav navbar-nav navbar-right">
               <li>
                 <div class="btn-group" dropdown is-open="status.isopen">
-                  <button type="button" class="btn btn-default dropdown-toggle navbar-btn"
ng-disabled="disabled">
+                <button type="button" class="btn btn-default dropdown-toggle navbar-btn"
ng-disabled="disabled">
                     <i class="fa fa-user"></i> {{currentUser}} <span class="caret"></span>
                   </button>
                   <ul class="dropdown-menu" role="menu">

http://git-wip-us.apache.org/repos/asf/ambari/blob/9db24dad/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 64b9e27..797ecb2 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,16 +18,13 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('MainCtrl',['$scope', '$window','Auth', 'uiAlert', '$modal', 'Cluster', function($scope,
$window, Auth, uiAlert, $modal, Cluster) {
+.controller('MainCtrl',['$scope', 'Auth', 'uiAlert', '$modal', 'Cluster', function($scope,
Auth, uiAlert, $modal, Cluster) {
   $scope.signOut = function() {
-    var data = JSON.parse(localStorage.ambari);
-    delete data.app.authenticated;
-    delete data.app.loginName;
-    delete data.app.user;
-    localStorage.ambari = JSON.stringify(data);
-    $window.location.pathname = '';
-    $scope.hello = "hello";
-    Auth.signout();
+    Auth.signout().then(function() {
+     window.location.pathname = ''; // Change location hard, because Angular works only with
relative urls
+    }).catch(function(data) {
+      uiAlert.danger(data.data.status, data.data.message);
+    });
   };
 
   $scope.about = function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/9db24dad/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Auth.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Auth.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Auth.js
index bc25e1e..93377b9 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Auth.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Auth.js
@@ -19,14 +19,7 @@
 
 angular.module('ambariAdminConsole')
 .factory('Auth',['$http', 'Settings', function($http, Settings) {
-  var ambari;
-  var currentUserName;
-  if (localStorage.ambari) {
-    ambari = JSON.parse(localStorage.ambari);
-    if (ambari && ambari.app && ambari.app.loginName) {
-      currentUserName = ambari.app.loginName;
-    }
-  }
+	var currentUserName = JSON.parse(localStorage.ambari).app.loginName;
   return {
     signout: function() {
       return $http({

http://git-wip-us.apache.org/repos/asf/ambari/blob/9db24dad/ambari-admin/src/main/resources/ui/admin-web/bower.json
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/bower.json b/ambari-admin/src/main/resources/ui/admin-web/bower.json
index dbc6ae3..896e5bd 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/bower.json
+++ b/ambari-admin/src/main/resources/ui/admin-web/bower.json
@@ -3,21 +3,14 @@
   "private": true,
   "dependencies": {
     "bootstrap": "~3.1.1",
-    "angular": "~1.2.25",
-    "angular-route": "~1.2.25",
+    "angular": "~1.2.18",
+    "angular-route": "~1.2.18",
     "angular-bootstrap": "~0.11.0",
-    "underscore": "~1.7.0",
     "restangular": "~1.4.0",
     "angular-bootstrap-toggle-switch": "~0.5.1",
-    "angular-animate": "~1.2.25",
+    "angular-animate": "~1.2.23",
     "angular-translate": "~2.2.0",
     "font-awesome": "~4.2.0"
   },
-  "devDependencies": {
-    "angular-mocks": "~1.2.25",
-    "commonjs": "~0.2.0",
-    "chai": "~1.8.0",
-    "mocha": "~1.14.0",
-    "sinon": "~1.10.3"
-  }
+  "devDependencies": {}
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/9db24dad/ambari-admin/src/main/resources/ui/admin-web/package.json
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/package.json b/ambari-admin/src/main/resources/ui/admin-web/package.json
index 06af9ae..0dc99e8 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/package.json
+++ b/ambari-admin/src/main/resources/ui/admin-web/package.json
@@ -4,12 +4,6 @@
   "dependencies": {
   },
   "devDependencies": {
-    "karma": "^0.12.16",
-    "karma-phantomjs-launcher": "~0.1",
-    "karma-chrome-launcher": "^0.1.4",
-    "karma-jasmine": "^0.1.5",
-    "protractor": "~1.0.0",
-    "http-server": "^0.6.1",
     "bower": "1.3.8",
     "gulp": "^3.6.0",
     "gulp-autoprefixer": "^0.0.7",
@@ -24,19 +18,6 @@
     "gulp-useref": "^0.4.2",
     "gulp-plumber": "*"
   },
-  "scripts": {
-    "postinstall": "bower install",
-    "prestart": "npm install",
-    "start": "http-server -a 0.0.0.0 -p 8000",
-    "pretest": "npm install",
-    "test": "node node_modules/karma/bin/karma start test/karma.conf.js",
-    "test-single-run": "node node_modules/karma/bin/karma start test/karma.conf.js  --single-run",
-    "preupdate-webdriver": "npm install",
-    "update-webdriver": "webdriver-manager update",
-    "preprotractor": "npm run update-webdriver",
-    "protractor": "protractor test/protractor-conf.js",
-    "update-index-async": "node -e \"require('shelljs/global'); sed('-i', /\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/,
'//@@NG_LOADER_START@@\\n' + cat('bower_components/angular-loader/angular-loader.min.js')
+ '\\n//@@NG_LOADER_END@@', 'app/index-async.html');\""
-  },
   "engines": {
     "node": ">=0.10.0"
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/9db24dad/ambari-admin/src/main/resources/ui/admin-web/test/e2e/signout.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/e2e/signout.js b/ambari-admin/src/main/resources/ui/admin-web/test/e2e/signout.js
deleted file mode 100644
index cb670ec..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/test/e2e/signout.js
+++ /dev/null
@@ -1,43 +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';
-describe('Ambari sign out from Admin view', function () {
-  describe('Admin view', function () {
-    var ptor = protractor.getInstance();
-    beforeEach(function () {
-      ptor.get('app/index.html');
-      ptor.waitForAngular();
-    });
-    it('should navigate to login page on clicking "Sign out" action', function () {
-      var userDropdownBtn = element(by.binding('currentUser'));
-      var signOutAction = element(by.css('[ng-click="signOut()"]'));
-      //Action-1: Click on user dropdown menu and
-      //Action-2: Click on SignOut action link
-      userDropdownBtn.click().then(function () {
-        signOutAction.click().then(function () {
-          //Validation
-          setTimeout(function () {
-            expect(ptor.getCurrentUrl()).toContain('#/login');
-          }, 3000);
-        });
-      });
-    });
-  });
-});
-
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/9db24dad/ambari-admin/src/main/resources/ui/admin-web/test/karma.conf.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/karma.conf.js b/ambari-admin/src/main/resources/ui/admin-web/test/karma.conf.js
deleted file mode 100644
index 1b815e5..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/test/karma.conf.js
+++ /dev/null
@@ -1,58 +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.
- */
-
-module.exports = function(config){
-  config.set({
-
-    basePath : '../',
-
-    files : [
-      'app/bower_components/angular/angular.js',
-      'app/bower_components/angular-animate/angular-animate.js',
-      'app/bower_components/angular-bootstrap/ui-bootstrap.js',
-      'app/bower_components/angular-bootstrap-toggle-switch/angular-toggle-switch.js',
-      'app/bower_components/angular-route/angular-route.js',
-      'app/bower_components/angular-translate/angular-translate.js',
-      'app/bower_components/underscore/underscore.js',
-      'app/bower_components/restangular/dist/restangular.js',
-      'app/bower_components/mocha/mocha.js',
-      'app/bower_components/chai/chai.js',
-      'app/bower_components/sinon/lib/sinon.js',
-      'app/bower_components/angular-mocks/angular-mocks.js',
-      'app/scripts/**/*.js',
-      'test/unit/**/*.js'
-    ],
-
-    autoWatch : true,
-
-    frameworks: ['jasmine'],
-
-    browsers: ['PhantomJS'],
-
-    plugins : [
-            'karma-jasmine',
-            'karma-phantomjs-launcher'
-            ],
-
-    junitReporter : {
-      outputFile: 'test_out/unit.xml',
-      suite: 'unit'
-    }
-
-  });
-};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9db24dad/ambari-admin/src/main/resources/ui/admin-web/test/protractor-conf.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/protractor-conf.js b/ambari-admin/src/main/resources/ui/admin-web/test/protractor-conf.js
deleted file mode 100644
index 18a32cb..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/test/protractor-conf.js
+++ /dev/null
@@ -1,51 +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.
- */
-
-exports.config = {
-  allScriptsTimeout: 11000,
-
-  specs: [
-    'e2e/*.js'
-  ],
-
-  capabilities: {
-    'browserName': 'chrome'
-  },
-
-  chromeOnly: true,
-
-  baseUrl: 'http://localhost:8000',
-
-  rootElement: 'body',
-
-  onPrepare: function() {
-
-  },
-
-
-  framework: 'jasmine',
-
-  jasmineNodeOpts: {
-    onComplete: null,
-    isVerbose: true,
-    showColors: true,
-    includeStackTrace: true,
-    defaultTimeoutInterval: 30000
-  }
-};
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/9db24dad/ambari-admin/src/main/resources/ui/admin-web/test/spec/test.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/spec/test.js b/ambari-admin/src/main/resources/ui/admin-web/test/spec/test.js
new file mode 100644
index 0000000..a43f4e1
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/test/spec/test.js
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+/* global describe, it */
+
+(function () {
+    'use strict';
+
+    describe('Give it some context', function () {
+        describe('maybe a bit more context here', function () {
+            it('should run here few assertions', function () {
+
+            });
+        });
+    });
+})();

http://git-wip-us.apache.org/repos/asf/ambari/blob/9db24dad/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/mainCtrl_test.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/mainCtrl_test.js
b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/mainCtrl_test.js
deleted file mode 100644
index c66d96e..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/mainCtrl_test.js
+++ /dev/null
@@ -1,54 +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('#Auth', function () {
-
-  describe('signout', function () {
-    var scope, ctrl, $httpBackend, $window, clusterService,deferred;
-    beforeEach(module('ambariAdminConsole', function($provide){
-      $provide.value('$window', {location: {pathname: 'http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/1.0.0/INSTANCE/#/'}});
-      localStorage.ambari = JSON.stringify({app: {authenticated: true, loginName: 'admin',
user: 'user'}});
-    }));
-    afterEach(function() {
-      $httpBackend.verifyNoOutstandingExpectation();
-      $httpBackend.verifyNoOutstandingRequest();
-    });
-    beforeEach(inject(function (_$httpBackend_, $rootScope, $controller, _$window_, _Cluster_,_$q_)
{
-      clusterService =  _Cluster_;
-      deferred = _$q_.defer();
-      spyOn(clusterService, 'getStatus').andReturn(deferred.promise);
-      deferred.resolve('c1');
-      $window = _$window_;
-      $httpBackend = _$httpBackend_;
-      $httpBackend.whenGET('/api/v1/logout').respond(200,{message: "successfully logged out"});
-      scope = $rootScope.$new();
-      scope.$apply();
-      ctrl = $controller('MainCtrl', {$scope: scope});
-    }));
-
-    it('should reset window.location and ambari localstorage', function () {
-      scope.signOut();
-      $httpBackend.flush();
-      chai.expect($window.location.pathname).to.be.empty;
-      var data = JSON.parse(localStorage.ambari);
-      chai.expect(data.app.authenticated).to.equal(undefined);
-      chai.expect(data.app.loginName).to.equal(undefined);
-      chai.expect(data.app.user).to.equal(undefined);
-    });
-  });
-});
\ No newline at end of file


Mime
View raw message