2022-09-07 04:25:00 +00:00
|
|
|
import { ResourceControlType } from '@/react/portainer/access-control/types';
|
2022-03-16 06:35:32 +00:00
|
|
|
|
2020-04-10 21:54:53 +00:00
|
|
|
angular.module('portainer.docker').controller('ConfigController', [
|
|
|
|
'$scope',
|
|
|
|
'$transition$',
|
|
|
|
'$state',
|
|
|
|
'ConfigService',
|
|
|
|
'Notifications',
|
|
|
|
function ($scope, $transition$, $state, ConfigService, Notifications) {
|
2022-03-16 06:35:32 +00:00
|
|
|
$scope.resourceType = ResourceControlType.Config;
|
|
|
|
|
|
|
|
$scope.onUpdateResourceControlSuccess = function () {
|
|
|
|
$state.reload();
|
|
|
|
};
|
|
|
|
|
2020-04-10 21:54:53 +00:00
|
|
|
$scope.removeConfig = function removeConfig(configId) {
|
|
|
|
ConfigService.remove(configId)
|
|
|
|
.then(function success() {
|
2022-08-10 05:07:35 +00:00
|
|
|
Notifications.success('Success', 'Configuration successfully removed');
|
2020-04-10 21:54:53 +00:00
|
|
|
$state.go('docker.configs', {});
|
|
|
|
})
|
|
|
|
.catch(function error(err) {
|
|
|
|
Notifications.error('Failure', err, 'Unable to remove config');
|
|
|
|
});
|
|
|
|
};
|
2017-11-06 08:47:31 +00:00
|
|
|
|
2020-04-10 21:54:53 +00:00
|
|
|
function initView() {
|
|
|
|
ConfigService.config($transition$.params().id)
|
|
|
|
.then(function success(data) {
|
|
|
|
$scope.config = data;
|
|
|
|
})
|
|
|
|
.catch(function error(err) {
|
|
|
|
Notifications.error('Failure', err, 'Unable to retrieve config details');
|
|
|
|
});
|
|
|
|
}
|
2017-11-06 08:47:31 +00:00
|
|
|
|
2020-04-10 21:54:53 +00:00
|
|
|
initView();
|
|
|
|
},
|
|
|
|
]);
|