2016-04-02 14:40:07 +02:00
|
|
|
define(function () {
|
2016-04-04 01:10:12 +02:00
|
|
|
app.registerController('ProjectKeysCtrl', ['$scope', '$http', '$uibModal', 'Project', function ($scope, $http, $modal, Project) {
|
|
|
|
$scope.reload = function () {
|
|
|
|
$http.get(Project.getURL() + '/keys').success(function (keys) {
|
|
|
|
$scope.keys = keys;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.remove = function (key) {
|
|
|
|
$http.delete(Project.getURL() + '/keys/' + key.id).success(function () {
|
|
|
|
$scope.reload();
|
|
|
|
}).error(function () {
|
|
|
|
swal('error', 'could not delete access key..', 'error');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.add = function () {
|
|
|
|
$modal.open({
|
2016-04-10 20:03:12 +02:00
|
|
|
templateUrl: '/tpl/projects/keys/add.html'
|
2016-04-04 15:44:34 +02:00
|
|
|
}).result.then(function (key) {
|
|
|
|
$http.post(Project.getURL() + '/keys', key).success(function () {
|
|
|
|
$scope.reload();
|
|
|
|
}).error(function (_, status) {
|
|
|
|
swal('error', 'could not add key:' + status, 'error');
|
|
|
|
});
|
2016-04-04 01:10:12 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.reload();
|
2016-04-02 14:40:07 +02:00
|
|
|
}]);
|
|
|
|
});
|