mirror of
https://github.com/portainer/portainer.git
synced 2025-08-07 14:55:27 +02:00
fix(kubernetes): remove unique check from kubernetes stacks [EE-6170] (#10542)
This commit is contained in:
parent
8ee718f808
commit
26036c05f2
6 changed files with 164 additions and 52 deletions
|
@ -1,6 +1,7 @@
|
|||
import angular from 'angular';
|
||||
|
||||
angular.module('portainer.app').factory('Stack', StackFactory);
|
||||
angular.module('portainer.app').factory('StackByName', StackByNameFactory);
|
||||
|
||||
/* @ngInject */
|
||||
function StackFactory($resource, API_ENDPOINT_STACKS) {
|
||||
|
@ -23,3 +24,13 @@ function StackFactory($resource, API_ENDPOINT_STACKS) {
|
|||
}
|
||||
);
|
||||
}
|
||||
|
||||
function StackByNameFactory($resource, API_ENDPOINT_STACKS) {
|
||||
return $resource(
|
||||
API_ENDPOINT_STACKS + '/name/:name',
|
||||
{},
|
||||
{
|
||||
remove: { method: 'DELETE', params: { name: '@name', external: '@external', endpointId: '@endpointId', namespace: '@namespace' } },
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -6,12 +6,13 @@ angular.module('portainer.app').factory('StackService', [
|
|||
'$q',
|
||||
'$async',
|
||||
'Stack',
|
||||
'StackByName',
|
||||
'FileUploadService',
|
||||
'StackHelper',
|
||||
'ServiceService',
|
||||
'ContainerService',
|
||||
'SwarmService',
|
||||
function StackServiceFactory($q, $async, Stack, FileUploadService, StackHelper, ServiceService, ContainerService, SwarmService) {
|
||||
function StackServiceFactory($q, $async, Stack, StackByName, FileUploadService, StackHelper, ServiceService, ContainerService, SwarmService) {
|
||||
'use strict';
|
||||
var service = {
|
||||
updateGit,
|
||||
|
@ -221,6 +222,19 @@ angular.module('portainer.app').factory('StackService', [
|
|||
return deferred.promise;
|
||||
};
|
||||
|
||||
service.removeKubernetesStacksByName = function (name, namespace, external, endpointId) {
|
||||
var deferred = $q.defer();
|
||||
StackByName.remove({ name: name, external: external, endpointId: endpointId, namespace: namespace })
|
||||
.$promise.then(function success() {
|
||||
deferred.resolve();
|
||||
})
|
||||
.catch(function error(err) {
|
||||
deferred.reject({ msg: 'Unable to remove the stack', err: err });
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
service.associate = function (stack, endpointId, orphanedRunning) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue