You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/integrations/storidge/views/snapshots/inspect/snapshotController.js

45 lines
1.4 KiB

angular.module('portainer.integrations.storidge')
.controller('StoridgeSnapshotController', ['$scope', '$state', '$transition$', 'Notifications', 'ModalService', 'StoridgeSnapshotService',
function ($scope, $state, $transition$, Notifications, ModalService, StoridgeSnapshotService) {
$scope.removeSnapshot = function () {
ModalService.confirm({
title: 'Are you sure?',
message: 'Do you want really want to remove this snapshot?',
buttons: {
confirm: {
label: 'Remove',
className: 'btn-danger'
}
},
callback: function onConfirm(confirmed) {
if(!confirmed) { return; }
StoridgeSnapshotService.remove($scope.snapshot.Id)
.then(function () {
Notifications.success('Success', 'Snapshot removed');
$state.go('portainer.volumes.volume', {id: $scope.volumeId});
})
.catch(function error(err) {
Notifications.error('Failure', err, 'Unable to remove snapshot');
});
}
});
};
function initView() {
$scope.volumeId = $transition$.params().id;
$scope.snapshotId = $transition$.params().snapshotId;
StoridgeSnapshotService.snapshot($scope.snapshotId)
.then(function success(data) {
$scope.snapshot = data;
})
.catch(function error(err) {
Notifications.error('Failure', err, 'Unable to retrieve snapshot details');
});
}
initView();
}]);