diff options
author | Iftekharul Islam <iislam@us.ibm.com> | 2017-03-29 13:54:26 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-09-20 12:41:34 -0500 |
commit | bb5058e741e4f382bb17c050db35c9094b638c49 (patch) | |
tree | 4c6949f4712d9c3d2f8b89ac48f1e8b8d490e7e2 /app | |
parent | 3a0d471c48cb09ddd06c5288c21612bd127b60ac (diff) | |
download | phosphor-webui-bb5058e741e4f382bb17c050db35c9094b638c49.tar.gz phosphor-webui-bb5058e741e4f382bb17c050db35c9094b638c49.zip |
Added fake login page for testing and demo
Change-Id: Ife37444dcede67b54d1f257ee99322b22ac6b78c
Signed-off-by: Iftekharul Islam <iislam@us.ibm.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/common/services/userModel.js | 3 | ||||
-rw-r--r-- | app/common/styles/layout/content.scss | 12 | ||||
-rw-r--r-- | app/index.html | 6 | ||||
-rw-r--r-- | app/index.js | 7 | ||||
-rw-r--r-- | app/login/controllers/login-controller.js | 11 | ||||
-rw-r--r-- | app/login/index.js | 5 |
6 files changed, 26 insertions, 18 deletions
diff --git a/app/common/services/userModel.js b/app/common/services/userModel.js index e44ba8c..dba607d 100644 --- a/app/common/services/userModel.js +++ b/app/common/services/userModel.js @@ -15,6 +15,9 @@ window.angular && (function (angular) { .module('app.common.services') .service('userModel', ['APIUtils',function(APIUtils){ return { + fakeLogin: function(callback){ + sessionStorage.setItem('LOGIN_ID', 'FAKE_ID'); + }, login : function(username, password, callback){ APIUtils.login(username, password, function(response, error){ if(response && diff --git a/app/common/styles/layout/content.scss b/app/common/styles/layout/content.scss index 3517cb2..b06175b 100644 --- a/app/common/styles/layout/content.scss +++ b/app/common/styles/layout/content.scss @@ -1,17 +1,5 @@ // Content layout styles -// Page header -.page-header { - position: relative; - border-bottom: 1px solid $lightbg__grey; - margin: 2.625em 0 1.2em 0; - .h4 { - padding: 0; - margin: 0 0 .5em 0; - font-weight: bold; - } -} - .content__container { margin-left: $nav__toplvlWidth; padding: 1em .1em; diff --git a/app/index.html b/app/index.html index b6e0d3c..79dc11b 100644 --- a/app/index.html +++ b/app/index.html @@ -10,12 +10,12 @@ <!-- endbuild --> </head> -<body ng-style="dataService.bodyStyle" ng-attr-id="{{dataService.path == '/login' ? 'login': ''}}"> +<body ng-style="dataService.bodyStyle" ng-attr-id="{{!dataService.showNavigation ? 'login': ''}}"> <app-header ng-if="dataService.showNavigation" path="dataService.path"></app-header> - <app-navigation ng-if="dataService.showNavigation" path="dataService.path" show-navigation=" dataService.showNavigation"></app-navigation> + <app-navigation ng-if="dataService.showNavigation" path="dataService.path" show-navigation="dataService.showNavigation"></app-navigation> - <main ng-view ng-class="{'content__container': dataService.path != '/login', 'login__wrapper': dataService.path == '/login'}"> + <main ng-view ng-class="{'content__container': dataService.showNavigation, 'login__wrapper': !dataService.showNavigation}"> </main> <!-- build:js scripts/vendor.min.js --> diff --git a/app/index.js b/app/index.js index f54aea0..f799e29 100644 --- a/app/index.js +++ b/app/index.js @@ -66,7 +66,8 @@ window.angular && (function (angular) { $rootScope.$on('$locationChangeSuccess', function(event){ var path = $location.path(); dataService.path = path; - if(['/','/login','/logout'].indexOf(path) == -1){ + if(['/','/login','/logout'].indexOf(path) == -1 && + path.indexOf('/login') == -1){ dataService.showNavigation = true; }else{ dataService.showNavigation = false; @@ -74,6 +75,10 @@ window.angular && (function (angular) { }); $rootScope.$on('timedout-user', function(){ + if(sessionStorage.getItem('LOGIN_ID') == 'FAKE_ID'){ + return; + } + sessionStorage.removeItem('LOGIN_ID'); $location.path('/login'); }); diff --git a/app/login/controllers/login-controller.js b/app/login/controllers/login-controller.js index b1a0d45..900063a 100644 --- a/app/login/controllers/login-controller.js +++ b/app/login/controllers/login-controller.js @@ -17,10 +17,17 @@ window.angular && (function (angular) { '$window', 'APIUtils', 'dataService', - 'userModel', - function($scope, $window, APIUtils, dataService, userModel){ + 'userModel', + '$routeParams', + function($scope, $window, APIUtils, dataService, userModel, $routeParams){ $scope.dataService = dataService; + if($routeParams.fake_login && + $routeParams.fake_login === 'fake_login'){ + userModel.fakeLogin(); + $window.location.hash = '#/system-overview'; + } + $scope.tryLogin = function(username, password, event){ if(event.keyCode === 13){ $scope.login(username, password); diff --git a/app/login/index.js b/app/login/index.js index 7e86ac4..a12cb6c 100644 --- a/app/login/index.js +++ b/app/login/index.js @@ -18,6 +18,11 @@ window.angular && (function (angular) { // Route configuration .config(['$routeProvider', function ($routeProvider) { $routeProvider + .when('/login/:fake_login', { + 'templateUrl': 'login/controllers/login-controller.html', + 'controller': 'LoginController', + authenticated: false + }) .when('/login', { 'templateUrl': 'login/controllers/login-controller.html', 'controller': 'LoginController', |