mirror of
https://github.com/portainer/portainer.git
synced 2025-08-01 20:05:23 +02:00
refactor(app): move storidge to new 'integrations' module (#2905)
* refactor(app): move storidge to new 'integrations' module * style(storidge): revert TODO note removal
This commit is contained in:
parent
67de71a18f
commit
144e0ae07e
59 changed files with 32 additions and 29 deletions
107
app/integrations/storidge/views/nodes/inspect/nodeController.js
Normal file
107
app/integrations/storidge/views/nodes/inspect/nodeController.js
Normal file
|
@ -0,0 +1,107 @@
|
|||
angular.module('portainer.integrations.storidge')
|
||||
.controller('StoridgeNodeController', ['$scope', '$state', '$transition$', 'Notifications', 'StoridgeNodeService', 'ModalService',
|
||||
function ($scope, $state, $transition$, Notifications, StoridgeNodeService, ModalService) {
|
||||
|
||||
$scope.removeNodeAction = function(selectedItems) {
|
||||
ModalService.confirm({
|
||||
title: 'Are you sure?',
|
||||
message: 'Do you want really want to remove the node from the cluster?',
|
||||
buttons: {
|
||||
confirm: {
|
||||
label: 'Remove',
|
||||
className: 'btn-danger'
|
||||
}
|
||||
},
|
||||
callback: function onConfirm(confirmed) {
|
||||
if(!confirmed) { return; }
|
||||
remove(selectedItems);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function remove() {
|
||||
StoridgeNodeService.remove($scope.node.Name)
|
||||
.then(function success() {
|
||||
Notifications.success('Node successfully removed', $scope.node.Name);
|
||||
$state.go('storidge.cluster');
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to remove node');
|
||||
});
|
||||
}
|
||||
|
||||
$scope.cordonNodeAction = function(selectedItems) {
|
||||
ModalService.confirm({
|
||||
title: 'Are you sure?',
|
||||
message: 'Do you want really want to put the node in maintenance mode?',
|
||||
buttons: {
|
||||
confirm: {
|
||||
label: 'Enter maintenance',
|
||||
className: 'btn-danger'
|
||||
}
|
||||
},
|
||||
callback: function onConfirm(confirmed) {
|
||||
if(!confirmed) { return; }
|
||||
cordonNode(selectedItems);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function cordonNode() {
|
||||
StoridgeNodeService.cordon($scope.node.Name)
|
||||
.then(function success() {
|
||||
Notifications.success('Node successfully put in maintenance');
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to put node in maintenance mode');
|
||||
})
|
||||
.finally(function final() {
|
||||
$state.reload();
|
||||
});
|
||||
}
|
||||
|
||||
$scope.uncordonNodeAction = function(selectedItems) {
|
||||
ModalService.confirm({
|
||||
title: 'Are you sure?',
|
||||
message: 'Do you want really want to bring the nodes out of maintenance mode?',
|
||||
buttons: {
|
||||
confirm: {
|
||||
label: 'Exit maintenance',
|
||||
className: 'btn-danger'
|
||||
}
|
||||
},
|
||||
callback: function onConfirm(confirmed) {
|
||||
if(!confirmed) { return; }
|
||||
uncordonNode(selectedItems);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function uncordonNode() {
|
||||
StoridgeNodeService.uncordon($scope.node.Name)
|
||||
.then(function success() {
|
||||
Notifications.success('Node successfully bringed back');
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to put node out of maintenance mode');
|
||||
})
|
||||
.finally(function final() {
|
||||
$state.reload();
|
||||
});
|
||||
}
|
||||
|
||||
function initView() {
|
||||
$scope.name = $transition$.params().name;
|
||||
|
||||
StoridgeNodeService.node($scope.name)
|
||||
.then(function success(data) {
|
||||
$scope.node = data;
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to retrieve node details');
|
||||
});
|
||||
}
|
||||
|
||||
initView();
|
||||
|
||||
}]);
|
Loading…
Add table
Add a link
Reference in a new issue