2016-03-18 23:03:28 +01:00
|
|
|
app.config(function($stateProvider, $couchPotatoProvider) {
|
|
|
|
$stateProvider.state('playbooks', {
|
|
|
|
url: '/playbooks',
|
|
|
|
pageTitle: 'Playbooks',
|
|
|
|
templateUrl: '/public/html/playbook/list.html',
|
|
|
|
controller: 'PlaybooksCtrl',
|
|
|
|
resolve: {
|
|
|
|
dummy: $couchPotatoProvider.resolve(['controllers/playbook/list'])
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('addPlaybook', {
|
|
|
|
url: '/add',
|
|
|
|
pageTitle: 'Add Playbook',
|
|
|
|
templateUrl: "/public/html/playbook/add.html",
|
|
|
|
controller: 'AddPlaybookCtrl',
|
|
|
|
resolve: {
|
|
|
|
dummy: $couchPotatoProvider.resolve(['controllers/playbook/add'])
|
|
|
|
}
|
|
|
|
})
|
2014-08-25 01:02:34 +02:00
|
|
|
|
2016-03-18 23:03:28 +01:00
|
|
|
.state('playbook', {
|
|
|
|
abstract: true,
|
|
|
|
url: '/playbook/:playbook_id',
|
|
|
|
controller: 'PlaybookCtrl',
|
|
|
|
templateUrl: '/public/html/playbook/view.html',
|
|
|
|
resolve: {
|
|
|
|
dummy: $couchPotatoProvider.resolve(['controllers/playbook/playbook']),
|
|
|
|
playbook: function (Playbook, $stateParams, $q, $state) {
|
|
|
|
var deferred = $q.defer();
|
2014-08-25 01:02:34 +02:00
|
|
|
|
2016-03-18 23:03:28 +01:00
|
|
|
var playbook = new Playbook($stateParams.playbook_id, function (err, errStatus) {
|
|
|
|
if (err && errStatus == 404) {
|
|
|
|
$state.transitionTo('homepage');
|
|
|
|
return deferred.reject();
|
|
|
|
}
|
2015-01-30 16:41:49 +01:00
|
|
|
|
2016-03-18 23:03:28 +01:00
|
|
|
deferred.resolve(playbook);
|
|
|
|
});
|
2014-08-25 01:02:34 +02:00
|
|
|
|
2016-03-18 23:03:28 +01:00
|
|
|
return deferred.promise;
|
2014-08-25 01:02:34 +02:00
|
|
|
}
|
2016-03-18 23:03:28 +01:00
|
|
|
}
|
|
|
|
})
|
2014-08-25 01:02:34 +02:00
|
|
|
|
2016-03-18 23:03:28 +01:00
|
|
|
.state('playbook.edit', {
|
|
|
|
url: '/edit',
|
|
|
|
templateUrl: "/public/html/playbook/add.html",
|
|
|
|
controller: 'EditPlaybookCtrl',
|
|
|
|
resolve: {
|
|
|
|
dummy: $couchPotatoProvider.resolve(['controllers/playbook/edit'])
|
|
|
|
}
|
|
|
|
})
|
2015-03-17 01:21:16 +01:00
|
|
|
|
2016-03-18 23:03:28 +01:00
|
|
|
.state('playbook.tasks', {
|
|
|
|
url: '/tasks',
|
|
|
|
templateUrl: "/public/html/playbook/tasks.html",
|
|
|
|
controller: 'PlaybookTasksCtrl',
|
|
|
|
resolve: {
|
|
|
|
dummy: $couchPotatoProvider.resolve(['controllers/playbook/tasks'])
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('playbook.jobs', {
|
|
|
|
url: '/jobs',
|
|
|
|
templateUrl: "/public/html/playbook/jobs.html",
|
|
|
|
controller: 'PlaybookJobsCtrl',
|
|
|
|
resolve: {
|
|
|
|
dummy: $couchPotatoProvider.resolve(['controllers/playbook/jobs'])
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('playbook.hosts', {
|
|
|
|
url: '/hosts',
|
|
|
|
templateUrl: "/public/html/playbook/hosts.html",
|
|
|
|
controller: 'PlaybookHostsCtrl',
|
|
|
|
resolve: {
|
|
|
|
dummy: $couchPotatoProvider.resolve(['controllers/playbook/hosts'])
|
|
|
|
}
|
2014-08-24 23:00:05 +02:00
|
|
|
})
|
2016-03-18 23:03:28 +01:00
|
|
|
});
|