#4995 feat(app): only use ui-view for routing #1232

Merged
alexm merged 5 commits from 4995-app_use_ui-view into dev 2022-12-28 12:47:44 +00:00
9 changed files with 60 additions and 62 deletions

View File

@ -8,9 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [2302.01] - 2023-01-12 ## [2302.01] - 2023-01-12
### Added ### Added
- [General](Inicio) Permite recuperar la contraseña
-
### Changed ### Changed
- Se ha eliminado la sección "Control clientes" dentro de Ticket
### Removed
- [Tickets](Control clientes) Eliminada sección

View File

@ -30,7 +30,7 @@ export default {
firstModuleRemovePinIcon: 'vn-home a:nth-child(1) vn-icon[icon="remove_circle"]' firstModuleRemovePinIcon: 'vn-home a:nth-child(1) vn-icon[icon="remove_circle"]'
}, },
recoverPassword: { recoverPassword: {
recoverPasswordButton: 'vn-login a[ui-sref="recoverPassword"]', recoverPasswordButton: 'vn-login a[ui-sref="recover-password"]',
email: 'vn-recover-password vn-textfield[ng-model="$ctrl.email"]', email: 'vn-recover-password vn-textfield[ng-model="$ctrl.email"]',
sendEmailButton: 'vn-recover-password vn-submit', sendEmailButton: 'vn-recover-password vn-submit',
}, },

View File

@ -1,8 +1,7 @@
import selectors from '../../helpers/selectors'; import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
// https://redmine.verdnatura.es/issues/4995 fix login describe('RecoverPassword path', async() => {
xdescribe('RecoverPassword path', async() => {
let browser; let browser;
let page; let page;
@ -11,7 +10,7 @@ xdescribe('RecoverPassword path', async() => {
page = browser.page; page = browser.page;
await page.waitToClick(selectors.recoverPassword.recoverPasswordButton); await page.waitToClick(selectors.recoverPassword.recoverPasswordButton);
await page.waitForState('recoverPassword'); await page.waitForState('recover-password');
}); });
afterAll(async() => { afterAll(async() => {

View File

@ -24,7 +24,7 @@ export default class Auth {
initialize() { initialize() {
let criteria = { let criteria = {
to: state => { to: state => {
const outLayout = ['login', 'recoverPassword', 'resetPassword']; const outLayout = ['login', 'recover-password', 'reset-password'];
return !outLayout.some(ol => ol == state.name); return !outLayout.some(ol => ol == state.name);
} }
}; };

View File

@ -1,9 +1,3 @@
<vn-layout <ui-view></ui-view>
ng-if="$ctrl.showLayout">
</vn-layout>
<ui-view
name="login"
ng-if="!$ctrl.showLayout">
</ui-view>
<vn-snackbar vn-id="snackbar"></vn-snackbar> <vn-snackbar vn-id="snackbar"></vn-snackbar>
<vn-debug-info></vn-debug-info> <vn-debug-info></vn-debug-info>

View File

@ -19,12 +19,6 @@ export default class App extends Component {
this.vnApp.logger = this; this.vnApp.logger = this;
} }
get showLayout() {
const state = this.$state.current.name || this.$location.$$path.substring(1).replace('/', '.');
const outLayout = ['login', 'recoverPassword', 'resetPassword', 'reset-password'];
return state && !outLayout.some(ol => ol == state);
}
$onDestroy() { $onDestroy() {
this.deregisterCallback(); this.deregisterCallback();
this.vnApp.logger = null; this.vnApp.logger = null;

View File

@ -1,32 +1,27 @@
<div class="box"> <vn-textfield
<img src="./logo.svg"/>
<form name="form" ng-submit="$ctrl.submit()">
<vn-textfield
label="User" label="User"
ng-model="$ctrl.user" ng-model="$ctrl.user"
vn-id="userField" vn-id="userField"
vn-focus> vn-focus>
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield
label="Password" label="Password"
ng-model="$ctrl.password" ng-model="$ctrl.password"
type="password"> type="password">
</vn-textfield> </vn-textfield>
<vn-check <vn-check
label="Do not close session" label="Do not close session"
ng-model="$ctrl.remember" ng-model="$ctrl.remember"
name="remember"> name="remember">
</vn-check> </vn-check>
<div class="footer"> <div class="footer">
<vn-submit label="Enter" ng-click="$ctrl.submit()"></vn-submit> <vn-submit label="Enter" ng-click="$ctrl.submit()"></vn-submit>
<div class="spinner-wrapper"> <div class="spinner-wrapper">
<vn-spinner enable="$ctrl.loading"></vn-spinner> <vn-spinner enable="$ctrl.loading"></vn-spinner>
</div> </div>
<!--<div class="vn-pt-lg"> <div class="vn-pt-lg">
<a ui-sref="recoverPassword" translate> <a ui-sref="recover-password" translate>
I do not remember my password I do not remember my password
</a> </a>
</div>-->
</div> </div>
</form>
</div> </div>

View File

@ -25,7 +25,7 @@ vn-recover-password{
} }
} }
vn-login{ vn-out-layout{
position: absolute; position: absolute;
height: 100%; height: 100%;
width: 100%; width: 100%;

View File

@ -3,27 +3,38 @@ import getMainRoute from 'core/lib/get-main-route';
config.$inject = ['$stateProvider', '$urlRouterProvider']; config.$inject = ['$stateProvider', '$urlRouterProvider'];
function config($stateProvider, $urlRouterProvider) { function config($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/'); $urlRouterProvider
.otherwise('/');
$stateProvider $stateProvider
.state('layout', {
abstract: true,
template: '<vn-layout></vn-layout>',
})
.state('outLayout', {
abstract: true,
template: '<vn-out-layout></vn-out-layout>',
})
.state('login', { .state('login', {
parent: 'outLayout',
url: '/login?continue', url: '/login?continue',
description: 'Login', description: 'Login',
views: { template: '<vn-login></vn-login>'
'login': {template: '<vn-login></vn-login>'},
}
}) })
.state('recoverPassword', { .state('recover-password', {
parent: 'outLayout',
url: '/recover-password', url: '/recover-password',
description: 'Recover-password', description: 'Recover password',
template: '<vn-recover-password>asd</vn-recover-password>' template: '<vn-recover-password></vn-recover-password>'
}) })
.state('resetPassword', { .state('reset-password', {
parent: 'outLayout',
url: '/reset-password', url: '/reset-password',
description: 'Reset-password', description: 'Reset password',
template: '<vn-reset-password></vn-reset-password>' template: '<vn-reset-password></vn-reset-password>'
}) })
.state('home', { .state('home', {
parent: 'layout',
url: '/', url: '/',
description: 'Home', description: 'Home',
template: '<vn-home></vn-home>' template: '<vn-home></vn-home>'
@ -54,6 +65,10 @@ function config($stateProvider, $urlRouterProvider) {
}; };
if (route.abstract) if (route.abstract)
configRoute.abstract = true; configRoute.abstract = true;
if (!route.state.includes('.'))
configRoute.parent = 'layout';
if (route.routeParams) if (route.routeParams)
configRoute.params = route.routeParams; configRoute.params = route.routeParams;