mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 12:30:41 +01:00
Delete playbook
This commit is contained in:
parent
f5c9f996ef
commit
34cc4a7c7d
@ -13,11 +13,7 @@ var schema = mongoose.Schema({
|
||||
name: String,
|
||||
password: String,
|
||||
private_key: String,
|
||||
public_key: String,
|
||||
playbook: {
|
||||
type: ObjectId,
|
||||
ref: 'Playbook'
|
||||
},
|
||||
public_key: String
|
||||
});
|
||||
|
||||
schema.index({
|
||||
|
@ -20,6 +20,9 @@ html
|
||||
ul.nav
|
||||
h2.text-center: a(ui-sref="homepage") Semaphore
|
||||
button.btn.btn-block.btn-default(ui-sref="addPlaybook") Add Playbook
|
||||
button.btn.btn-block.btn-default(ui-sref="credentials.list") Credentials
|
||||
|
||||
br
|
||||
|
||||
li(ng-repeat="playbook in playbooks")
|
||||
a(ui-sref="playbook.view({ playbook_id: playbook._id })") {{ playbook.name }}
|
||||
|
@ -1,3 +1,4 @@
|
||||
h1 {{ playbook.data.name }}
|
||||
button.btn.btn-danger.pull-right(ng-click="delete()") Delete
|
||||
|
||||
pre: code: {{ playbook }}
|
@ -1,7 +1,16 @@
|
||||
define([
|
||||
'app'
|
||||
], function(app) {
|
||||
app.registerController('PlaybookCtrl', ['$scope', function($scope) {
|
||||
app.registerController('PlaybookCtrl', ['$scope', '$state', '$rootScope', '$http', function($scope, $state, $rootScope, $http) {
|
||||
console.log($scope.playbook);
|
||||
|
||||
$scope.delete = function () {
|
||||
$scope.playbook.delete();
|
||||
|
||||
$http.get('/playbooks').success(function(data, status) {
|
||||
$rootScope.playbooks = data;
|
||||
});
|
||||
$state.transitionTo('homepage');
|
||||
}
|
||||
}]);
|
||||
});
|
@ -22,10 +22,15 @@ define([
|
||||
$scope.playbook = playbook;
|
||||
},
|
||||
resolve: {
|
||||
playbook: function (Playbook, $stateParams, $q) {
|
||||
playbook: function (Playbook, $stateParams, $q, $state) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var playbook = new Playbook($stateParams.playbook_id, function (err, errStatus) {
|
||||
if (err && errStatus == 404) {
|
||||
$state.transitionTo('homepage');
|
||||
return deferred.reject();
|
||||
}
|
||||
|
||||
deferred.resolve(playbook);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user