2022-09-07 04:25:00 +00:00
|
|
|
import { ResourceControlType } from '@/react/portainer/access-control/types';
|
2022-03-16 06:35:32 +00:00
|
|
|
|
2023-11-15 07:33:29 +00:00
|
|
|
angular.module('portainer.docker').controller('SecretController', SecretController);
|
2022-03-16 06:35:32 +00:00
|
|
|
|
2023-11-15 07:33:29 +00:00
|
|
|
/* @ngInject */
|
|
|
|
function SecretController($scope, $transition$, $state, SecretService, Notifications, endpoint) {
|
|
|
|
$scope.resourceType = ResourceControlType.Secret;
|
|
|
|
$scope.endpoint = endpoint;
|
|
|
|
$scope.onUpdateResourceControlSuccess = function () {
|
|
|
|
$state.reload();
|
|
|
|
};
|
2022-03-16 06:35:32 +00:00
|
|
|
|
2023-11-15 07:33:29 +00:00
|
|
|
$scope.removeSecret = function removeSecret(secretId) {
|
|
|
|
SecretService.remove(secretId)
|
|
|
|
.then(function success() {
|
|
|
|
Notifications.success('Success', 'Secret successfully removed');
|
|
|
|
$state.go('docker.secrets', {});
|
|
|
|
})
|
|
|
|
.catch(function error(err) {
|
|
|
|
Notifications.error('Failure', err, 'Unable to remove secret');
|
|
|
|
});
|
|
|
|
};
|
2017-05-27 07:23:49 +00:00
|
|
|
|
2023-11-15 07:33:29 +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
|
|
|
|
2023-11-15 07:33:29 +00:00
|
|
|
initView();
|
|
|
|
}
|