ffffng/app/scripts/controllers/deleteNodeCtrl.js

28 lines
856 B
JavaScript
Raw Permalink Normal View History

2016-05-16 18:27:03 +02:00
'use strict';
angular.module('ffffng')
.controller('DeleteNodeCtrl', function ($scope, Navigator, NodeService, config, ConfirmDeletionDialog) {
$scope.config = config;
$scope.token = undefined;
$scope.deleted = false;
$scope.onSubmitToken = function (token) {
$scope.token = token;
return NodeService.getNode(token)
.then(function (response) {
var node = response.data;
2016-05-16 18:27:03 +02:00
ConfirmDeletionDialog.open(node).result.then(function () {
NodeService.deleteNode(token)
.then(function () {
2016-05-16 18:27:03 +02:00
$scope.deleted = true;
$scope.hostname = node.hostname;
});
});
});
};
$scope.cancel = function () {
Navigator.home();
};
});