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',
|
2023-08-31 20:11:57 +00:00
|
|
|
'endpoint',
|
|
|
|
function ($scope, $transition$, $state, ConfigService, Notifications, endpoint) {
|
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) {
|
2023-08-31 20:11:57 +00:00
|
|
|
ConfigService.remove(endpoint.Id, configId)
|
2020-04-10 21:54:53 +00:00
|
|
|
.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() {
|
2023-08-31 20:11:57 +00:00
|
|
|
ConfigService.config(endpoint.Id, $transition$.params().id)
|
2020-04-10 21:54:53 +00:00
|
|
|
.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();
|
|
|
|
},
|
|
|
|
]);
|