github.com/fanux/shipyard@v0.0.0-20161009071005-6515ce223235/controller/static/app/plugins/config.routes.js (about) 1 (function(){ 2 'use strict'; 3 4 angular 5 .module('shipyard.plugins') 6 .config(getRoutes); 7 8 getRoutes.$inject = ['$stateProvider', '$urlRouterProvider']; 9 10 function getRoutes($stateProvider, $urlRouterProvider) { 11 $stateProvider 12 .state('dashboard.plugins', { 13 url: '^/plugins', 14 templateUrl: 'app/plugins/plugins.html', 15 controller: 'pluginsController', 16 controllerAs: 'vm', 17 authenticate: true 18 }) 19 .state('dashboard.addPlugin', { 20 url: '^/plugins/add', 21 templateUrl: 'app/plugins/addPlugin.html', 22 controller: 'PluginAddController', 23 controllerAs: 'vm', 24 authenticate: true 25 }) 26 .state('dashboard.pdetail', { 27 url: '^/plugins/{id}', 28 templateUrl: 'app/plugins/pdetail.html', 29 controller: 'PluginController', 30 controllerAs: 'vm', 31 authenticate: true, 32 resolve: { 33 resolvedPlugin: ['PluginService', '$state', '$stateParams', function(PluginService, $state, $stateParams) { 34 return PluginService.inspect($stateParams.id).then(null, function(errorData) { 35 $state.go('error'); 36 }); 37 }] 38 } 39 }) 40 .state('dashboard.strategies', { 41 url: '^/plugins/{id}/strategies', 42 templateUrl: 'app/strategies/strategies.html', 43 controller: 'strategiesController', 44 controllerAs: 'vm', 45 authenticate: true 46 }) 47 .state('dashboard.addStrategy', { 48 url: '^/plugins/{id}/strategies/add', 49 templateUrl: 'app/strategies/addStrategy.html', 50 controller: 'StrategyAddController', 51 controllerAs: 'vm', 52 authenticate: true, 53 }) 54 .state('dashboard.sdetail', { 55 url: '^/plugins/{pn}/strategies/{id}', 56 templateUrl: 'app/strategies/sdetail.html', 57 controller: 'StrategyController', 58 controllerAs: 'vm', 59 authenticate: true, 60 resolve: { 61 resolvedStrategy: ['StrategyService', '$state', '$stateParams', function(StrategyService, $state, $stateParams) { 62 return StrategyService.inspect($stateParams.pn,$stateParams.id).then(null, function(errorData) { 63 $state.go('error'); 64 }); 65 }] 66 } 67 }) 68 .state('dashboard.sedit', { 69 url: '^/plugins/{pn}/strategies/{id}/edit', 70 templateUrl: 'app/strategies/sedit.html', 71 controller: 'StrategyController', 72 controllerAs: 'vm', 73 authenticate: true, 74 resolve: { 75 resolvedStrategy: ['StrategyService', '$state', '$stateParams', function(StrategyService, $state, $stateParams) { 76 return StrategyService.inspect($stateParams.pn,$stateParams.id).then(null, function(errorData) { 77 $state.go('error'); 78 }); 79 }] 80 } 81 }); 82 } 83 })();