Semaphore/public/js/routes/project.js
Matej Kramny 79a05b389f Project ui, ws
- [wip] ws support
2016-04-02 13:40:07 +01:00

104 lines
2.7 KiB
JavaScript

app.config(function ($stateProvider, $couchPotatoProvider) {
$stateProvider
.state('project', {
url: '/project/:project_id',
abstract: true,
templateUrl: '/tpl/projects/container.html',
controller: function ($scope, Project) {
$scope.project = Project;
},
resolve: {
Project: ['$http', '$stateParams', '$q', 'ProjectFactory', function ($http, params, $q, ProjectFactory) {
var d = $q.defer();
$http.get('/project/' + params.project_id)
.success(function (project) {
d.resolve(new ProjectFactory(project));
}).error(function () {
d.resolve(false);
});
return d.promise;
}]
}
})
.state('project.dashboard', {
url: '',
pageTitle: 'Project Dashboard',
templateUrl: '/tpl/projects/dashboard.html',
controller: 'ProjectDashboardCtrl',
resolve: {
$d: $couchPotatoProvider.resolveDependencies(['controllers/projects/dashboard'])
}
})
.state('project.users', {
url: '/users',
pageTitle: 'Users',
templateUrl: '/tpl/projects/users.html',
controller: 'ProjectUsersCtrl',
resolve: {
$d: $couchPotatoProvider.resolveDependencies(['controllers/projects/users'])
}
})
.state('project.templates', {
url: '/templates',
pageTitle: 'Templates',
templateUrl: '/tpl/projects/templates.html',
controller: 'ProjectTemplatesCtrl',
resolve: {
$d: $couchPotatoProvider.resolveDependencies(['controllers/projects/templates'])
}
})
.state('project.inventory', {
url: '/inventory',
pageTitle: 'Inventory',
templateUrl: '/tpl/projects/inventory.html',
controller: 'ProjectInventoryCtrl',
resolve: {
$d: $couchPotatoProvider.resolveDependencies(['controllers/projects/inventory'])
}
})
.state('project.environment', {
url: '/environment',
pageTitle: 'Environment',
templateUrl: '/tpl/projects/environment.html',
controller: 'ProjectEnvironmentCtrl',
resolve: {
$d: $couchPotatoProvider.resolveDependencies(['controllers/projects/environment'])
}
})
.state('project.keys', {
url: '/keys',
pageTitle: 'Keys',
templateUrl: '/tpl/projects/keys.html',
controller: 'ProjectKeysCtrl',
resolve: {
$d: $couchPotatoProvider.resolveDependencies(['controllers/projects/keys'])
}
})
.state('project.repositories', {
url: '/repositories',
pageTitle: 'Repositories',
templateUrl: '/tpl/projects/repositories.html',
controller: 'ProjectRepositoriesCtrl',
resolve: {
$d: $couchPotatoProvider.resolveDependencies(['controllers/projects/repositories'])
}
})
.state('project.schedule', {
url: '/schedule',
pageTitle: 'Template Schedule',
templateUrl: '/tpl/projects/schedule.html',
controller: 'ProjectScheduleCtrl',
resolve: {
$d: $couchPotatoProvider.resolveDependencies(['controllers/projects/schedule'])
}
});
});