Move states in separate files.

This commit is contained in:
Alexis Lahouze 2017-07-24 18:48:57 +02:00
parent 7b7f72bf1e
commit a7cee2891c
4 changed files with 41 additions and 26 deletions

View File

@ -0,0 +1,7 @@
// vim: set tw=80 ts=2 sw=2 sts=2 :
export const AccountListState = {
name: 'accounts',
url: '/accounts',
component: 'accountList'
}

View File

@ -1,7 +1,9 @@
// vim: set tw=80 ts=2 sw=2 sts=2 :
import { Level } from '@nsalaun/ng-logger';
var operationsTmpl = require('./operations/operations.html');
import { AccountListState } from './accounts/account.states';
import { OperationListState } from './operations/operation.states';
import { ScheduleListState } from './scheduler/schedule.states';
export default function AppConfig($uiRouterProvider) {
$uiRouterProvider.trace.enable(1);
@ -9,33 +11,11 @@ export default function AppConfig($uiRouterProvider) {
// Defining template and controller in function of route.
const $stateRegistry = $uiRouterProvider.stateRegistry;
$stateRegistry.register({
name: 'operations',
url: '/account/:accountId/operations',
templateUrl: operationsTmpl,
controller: 'OperationController',
controllerAs: 'operationsCtrl'
});
$stateRegistry.register(OperationListState);
$stateRegistry.register({
name: 'scheduler',
url: '/account/:accountId/scheduler',
component: 'scheduleComponent',
resolve: {
accountId: function($transition$) {
return $transition$.params().accountId;
},
$modal: function($modal) {
return $modal;
}
}
});
$stateRegistry.register(ScheduleListState);
$stateRegistry.register({
name: 'accounts',
url: '/accounts',
component: 'accountList',
});
$stateRegistry.register(AccountListState);
const $urlService = $uiRouterProvider.urlService;
$urlService.rules.otherwise({

View File

@ -0,0 +1,11 @@
// vim: set tw=80 ts=2 sw=2 sts=2 :
var operationsTmpl = require('./operations.html');
export const OperationListState = {
name: 'operations',
url: '/account/:accountId/operations',
templateUrl: operationsTmpl,
controller: 'OperationController',
controllerAs: 'operationsCtrl'
}

View File

@ -0,0 +1,17 @@
// vim: set tw=80 ts=2 sw=2 sts=2 :
import { ScheduleComponent } from './schedule.component';
export const ScheduleListState = {
name: 'scheduler',
url: '/account/:accountId/scheduler',
component: 'scheduleComponent',
resolve: {
accountId: function($transition$) {
return $transition$.params().accountId;
},
$modal: function($modal) {
return $modal;
}
}
}