summaryrefslogtreecommitdiffstats
path: root/app/login
diff options
context:
space:
mode:
authorIftekharul Islam <iislam@us.ibm.com>2017-03-24 15:28:25 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-09-20 12:41:33 -0500
commit99d199f300405c3700837a21ae97f6742c16b513 (patch)
tree4208e0d0697a889d29c6262353404a135cef011d /app/login
parent38f681feee9d576ad962aae5fa46ad24ccc02d29 (diff)
downloadphosphor-webui-99d199f300405c3700837a21ae97f6742c16b513.tar.gz
phosphor-webui-99d199f300405c3700837a21ae97f6742c16b513.zip
Major update to code structure
* Split files into independent files based on functionality. * Switch to bower/gulp for build. Change-Id: Ibc775dd9b7f6a0a49f63c22162b7582e781e2d9c Signed-off-by: Iftekharul Islam <iislam@us.ibm.com>
Diffstat (limited to 'app/login')
-rw-r--r--app/login/controllers/login-controller.html36
-rw-r--r--app/login/controllers/login-controller.js52
-rw-r--r--app/login/index.js28
-rw-r--r--app/login/styles/index.scss115
4 files changed, 231 insertions, 0 deletions
diff --git a/app/login/controllers/login-controller.html b/app/login/controllers/login-controller.html
new file mode 100644
index 0000000..a249726
--- /dev/null
+++ b/app/login/controllers/login-controller.html
@@ -0,0 +1,36 @@
+<div>
+ <div class="row">
+ <div class="columns large-6">
+ <img src="assets/images/logo.svg" class="login__logo" alt="IBM logo" role="img"/>
+ </div>
+ <div class="columns large-6">
+ </div>
+ </div>
+ <div class="row">
+ <div class="columns large-6 login__desc">
+ <h1>OpenBMC Advanced System Management</h1>
+ <ul class="login__server-info">
+ <li><p class="login__info-label">Build version</p><p>X.XX.XXX</p></li>
+ <li><p class="login__info-label">Server ID</p><p>XXXXXXXXXXXXXXXX</p></li>
+ <li><p class="login__info-label">Server model</p><p>Power XX-XXXXX</p></li>
+ <!-- ping server to see if powered on. Change status-light and txt accordingly. Status message is planned to be hardcoded message were isplay via local JS. -->
+ <li><p class="login__info-label">Server power</p><p class="status-light__disabled">Indeterminate</p></li>
+ <li><p class="login__info-label">Status message</p><!--<p>BMC was reset by user</p>--></li>
+ </ul>
+ </div>
+ <div class="columns large-6 disabled">
+ <form id="login__form" role="form" action="" >
+ <label for="username">Username</label>
+ <input type="text" id="username" name="username" required ng-model="username" ng-class="{error: error}" ng-keydown="tryLogin(username, password, $event)" ng-disabled="dataService.loading">
+
+ <label for="password">Password</label>
+ <input type="password" id="password" name="password" class="" required ng-model="password" ng-keydown="tryLogin(username, password, $event)" ng-disabled="dataService.loading">
+
+ <input id="login__submit" class="btn-primary submit" type="button" value="Log in" role="button" ng-click="login(username, password)" ng-class="{error: error}" ng-disabled="dataService.loading">
+
+ <p class="login__error-msg" role="alert" ng-if="error">Incorrect username or password</p>
+ <p class="login__error-msg" role="alert" ng-if="dataService.server_unreachable">Server Unreachable</p>
+ </form>
+ </div>
+ </div>
+</div> \ No newline at end of file
diff --git a/app/login/controllers/login-controller.js b/app/login/controllers/login-controller.js
new file mode 100644
index 0000000..b1a0d45
--- /dev/null
+++ b/app/login/controllers/login-controller.js
@@ -0,0 +1,52 @@
+/**
+ * Controller for the login page
+ *
+ * @module app/login/controllers/index
+ * @exports LoginController
+ * @name LoginController
+ * @version 0.1.0
+ */
+
+window.angular && (function (angular) {
+ 'use strict';
+
+ angular
+ .module('app.login')
+ .controller('LoginController', [
+ '$scope',
+ '$window',
+ 'APIUtils',
+ 'dataService',
+ 'userModel',
+ function($scope, $window, APIUtils, dataService, userModel){
+ $scope.dataService = dataService;
+
+ $scope.tryLogin = function(username, password, event){
+ if(event.keyCode === 13){
+ $scope.login(username, password);
+ }
+ };
+ $scope.login = function(username, password){
+ $scope.error = false;
+
+ if(!username || username == "" ||
+ !password || password == ""){
+ return false;
+ }else{
+ userModel.login(username, password, function(status, unreachable){
+ if(status){
+ $scope.$emit('user-logged-in',{});
+ $window.location.hash = '#/system-overview';
+ }else{
+ if(!unreachable){
+ $scope.error = true;
+ }
+ };
+ });
+ }
+ }
+ }
+ ]
+ );
+
+})(angular);
diff --git a/app/login/index.js b/app/login/index.js
new file mode 100644
index 0000000..7e86ac4
--- /dev/null
+++ b/app/login/index.js
@@ -0,0 +1,28 @@
+/**
+ * A module for the login
+ *
+ * @module app/login/index
+ * @exports app/login/index
+ * @version 0.0.1
+ */
+
+window.angular && (function (angular) {
+ 'use strict';
+
+ angular
+ .module('app.login', [
+ 'ngRoute',
+ 'app.constants',
+ 'app.common.services'
+ ])
+ // Route configuration
+ .config(['$routeProvider', function ($routeProvider) {
+ $routeProvider
+ .when('/login', {
+ 'templateUrl': 'login/controllers/login-controller.html',
+ 'controller': 'LoginController',
+ authenticated: false
+ });
+ }]);
+
+})(window.angular);
diff --git a/app/login/styles/index.scss b/app/login/styles/index.scss
new file mode 100644
index 0000000..088f42a
--- /dev/null
+++ b/app/login/styles/index.scss
@@ -0,0 +1,115 @@
+#login {
+ @include mediaQuery(medium) {
+ background: linear-gradient(to right, #FFFFFF 49.999%, #e6e9ed 50%);
+ @include fastTransition-all;
+ }
+}
+
+.login__wrapper {
+ position: relative;
+ padding-top: 1em;
+ color: $black;
+ .row {
+ max-width: 1040px;
+ }
+ @include mediaQuery(small) {
+ left: 50%;
+ top: 50%;
+ transform: translateY(-50%);
+ margin-left: -50%;
+ }
+ @include mediaQuery(medium) {
+ left: 0;
+ margin-left: 0;
+ }
+ .login__logo {
+ max-width: 200px;
+ display: block;
+ margin-bottom: 2em;
+ @include mediaQuery(small) {
+ margin-bottom: 4em;
+ }
+ }
+ @include fastTransition-all;
+}
+
+#login__form {
+ color: $black;
+ background: transparent;
+ padding: 1em 0;
+ display: block;
+ overflow: hidden;
+ @include mediaQuery(small) {
+ max-width: 50%;
+ }
+ @include mediaQuery(medium) {
+ padding: 0 0 0 5em;
+ max-width: 100%;
+ }
+ @include fastTransition-all;
+}
+
+.login__desc {
+ text-align: left;
+ h1 {
+ font-size: 2em;
+ margin-bottom: 0;
+ font-weight: bold;
+ @include mediaQuery(small) {
+ max-width: 50%;
+ }
+ @include mediaQuery(medium) {
+ max-width: 100%;
+ }
+ }
+}
+
+.login__server-info {
+ margin-top: 2em;
+ margin-left: 0;
+ padding-left: 0;
+ list-style-type: none;
+ @include mediaQuery(small) {
+ max-width: 50%;
+ }
+ @include mediaQuery(medium) {
+ max-width: 90%;
+ }
+ li {
+ padding: 1em 0;
+ border-top: 1px solid $lightgrey;
+ }
+ p {
+ margin-bottom: 0;
+ display: inline-block;
+ font-family: courier, helvetica, arial, sans-serif;
+ font-weight: 700;
+ }
+ .login__info-label {
+ display: inline-block;
+ min-width: 200px;
+ @include fontFamily;
+ }
+}
+
+.login__status {
+ color: $status-ok;
+ &.error {
+ color: $error-color;
+ }
+}
+
+.login__error-msg {
+ background: lighten($error-color, 20%);
+ padding: 1em;
+ text-align: center;
+ font-size: 1em;
+ border: 1px solid $error-color;
+ color: $black;
+ font-family: Courier, Helvetica, Arial, sans-serif;
+ font-weight: 700;
+
+ @include mediaQuery(medium) {
+ max-width: 100%;
+ }
+} \ No newline at end of file
OpenPOWER on IntegriCloud