ffffng/app/scripts/controllers/deleteNodeCtrl.js

27 lines
816 B
JavaScript
Raw 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)
.success(function (node) {
ConfirmDeletionDialog.open(node).result.then(function () {
NodeService.deleteNode(token)
.success(function () {
$scope.deleted = true;
$scope.hostname = node.hostname;
});
});
});
};
$scope.cancel = function () {
Navigator.home();
};
});