TT#4711 Refactor ngcp-csc mockup login and change gitignore

Refactor ngcp-csc mockup login to use central store instead of inline, eliminate unneeded parts of if else in controller, add defaulCredential variable and remove some unnecessary requires.

Change-Id: I3844a036bf994d1759095b2121c0cfa3ca620f5d
changes/56/8956/2
Robert Axelsen 9 years ago
parent 75fce502ba
commit 8776eac375

9
.gitignore vendored

@ -1,3 +1,10 @@
build/
sass/example/
sass/example/bootstrap.js
sass/example/bootstrap.json
sass/example/bootstrap.jsonp
sass/example/example.css
bootstrap.json
classic.json
classic.jsonp
modern.json
modern.jsonp

@ -0,0 +1,30 @@
Ext.define('NgcpCsc.store.Languages', {
extend: 'Ext.data.Store',
storeId: 'Languages',
fields: [
{name: 'id', type: 'string'},
{name: 'language', type: 'string'}
],
data: [
{
id: "en",
language: 'English'
},{
id: "it",
language: 'Italian'
},{
id: "de",
language: 'German'
},{
id: "fr",
language: 'French'
},{
id: "sp",
language: 'Spanish'
}
]
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -16,7 +16,8 @@ Ext.define('NgcpCsc.Application', {
],
stores: [
'NavigationTree'
'NavigationTree',
'Languages'
],
launch: function () {

@ -2,11 +2,6 @@ Ext.define('NgcpCsc.view.login.Login', {
extend: 'Ext.window.Window',
xtype: 'ngcp-login',
requires: [
'NgcpCsc.view.login.LoginController',
'Ext.form.Panel'
],
controller: 'login',
bodyPadding: 10,
title: 'Login Window',
@ -45,24 +40,7 @@ Ext.define('NgcpCsc.view.login.Login', {
xtype: 'combo',
fieldLabel: 'Choose language',
padding: '0 0 0 15',
store: new Ext.data.Store({
data: [{
id: "en",
language: 'English'
},{
id: "it",
language: 'Italian'
},{
id: "de",
language: 'German'
},{
id: "fr",
language: 'French'
},{
id: "sp",
language: 'Spanish'
}]
}),
store: 'Languages',
queryMode: 'local',
valueField: 'id',
displayField: 'language',

@ -27,29 +27,20 @@ Ext.define('NgcpCsc.view.login.LoginController', {
onLoginClick: function () {
var inputUsername = this.getViewModel().get('username');
var inputPassword = this.getViewModel().get('password');
var defaultCredential = 'administrator';
languageSelected = localStorage.getItem('languageSelected') || 'en';
inputMessageComponent = this.getView().down('#login-message');
if (inputUsername === 'admin' && inputPassword === 'admin') {
if (inputUsername === defaultCredential && inputPassword === defaultCredential) {
this.getView().destroy();
Ext.create({
xtype: 'ngcp-main'
});
} else if (inputUsername === 'admin' && inputPassword !== 'admin') {
this.lookupReference('login-form').getForm().markInvalid([{
field: 'password',
message: 'Invalid password'
}]);
this.showMessage('Login failed, please verify username and password.');
} else if (inputUsername === '') {
} else if (inputUsername === '' && inputPassword === '' || inputUsername === '' ) {
this.showMessage('Please enter your username.');
} else if (inputPassword === '') {
this.showMessage('Please enter your password.');
} else if (inputUsername !== 'admin' && inputPassword !== '') {
this.lookupReference('login-form').getForm().markInvalid([{
field: 'username',
message: 'Invalid username'
}]);
} else if (inputUsername !== defaultCredential || inputPassword !== defaultCredential) {
this.showMessage('Login failed, please verify username and password.');
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,37 @@
<!DOCTYPE html>
<!--
Copyright (c) 2012-2013. Sencha Inc.
-->
<html>
<head>
<title>Ext JS Theme Harness</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<!--
Load all required links and scripts
-->
<script type="text/javascript" src="bootstrap.js"></script>
<style>
.widget-container {
margin: 10px;
width: 400px;
position: relative;
overflow: visible;
}
.x-slicer-target,
.x-slicer-target * {
opacity: 1;
}
/* ensure body does not overlap the rounded corners of framed panel/window when slicing */
.x-panel-body,
.x-window-body {
background: transparent;
}
</style>
</head>
<body></body>
</html>
Loading…
Cancel
Save