2022-03-16 06:35:32 +00:00
|
|
|
import { ResourceControlType } from '@/portainer/access-control/types';
|
|
|
|
|
2020-04-10 21:54:53 +00:00
|
|
|
angular.module('portainer.docker').controller('SecretController', [
|
|
|
|
'$scope',
|
|
|
|
'$transition$',
|
|
|
|
'$state',
|
|
|
|
'SecretService',
|
|
|
|
'Notifications',
|
|
|
|
function ($scope, $transition$, $state, SecretService, Notifications) {
|
2022-03-16 06:35:32 +00:00
|
|
|
$scope.resourceType = ResourceControlType.Secret;
|
|
|
|
|
|
|
|
$scope.onUpdateResourceControlSuccess = function () {
|
|
|
|
$state.reload();
|
|
|
|
};
|
|
|
|
|
2020-04-10 21:54:53 +00:00
|
|
|
$scope.removeSecret = function removeSecret(secretId) {
|
|
|
|
SecretService.remove(secretId)
|
|
|
|
.then(function success() {
|
2022-08-10 05:07:35 +00:00
|
|
|
Notifications.success('Success', 'Secret successfully removed');
|
2020-04-10 21:54:53 +00:00
|
|
|
$state.go('docker.secrets', {});
|
|
|
|
})
|
|
|
|
.catch(function error(err) {
|
|
|
|
Notifications.error('Failure', err, 'Unable to remove secret');
|
|
|
|
});
|
|
|
|
};
|
2017-05-27 07:23:49 +00:00
|
|
|
|
2020-04-10 21:54:53 +00:00
|
|
|
function initView() {
|
|
|
|
SecretService.secret($transition$.params().id)
|
|
|
|
.then(function success(data) {
|
|
|
|
$scope.secret = data;
|
|
|
|
})
|
|
|
|
.catch(function error(err) {
|
|
|
|
Notifications.error('Failure', err, 'Unable to retrieve secret details');
|
|
|
|
});
|
|
|
|
}
|
2017-05-27 07:23:49 +00:00
|
|
|
|
2020-04-10 21:54:53 +00:00
|
|
|
initView();
|
|
|
|
},
|
|
|
|
]);
|