mirror of
https://github.com/portainer/portainer.git
synced 2025-07-29 10:19:41 +02:00
feat(app): limit the docker API version supported by the frontend (#12295)
Some checks failed
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
ci / build_images (map[arch:arm platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Has been cancelled
/ triage (push) Has been cancelled
Lint / Run linters (push) Has been cancelled
Test / test-client (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:linux]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
Test / test-server (map[arch:arm64 platform:linux]) (push) Has been cancelled
ci / build_manifests (push) Has been cancelled
Some checks failed
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
ci / build_images (map[arch:arm platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Has been cancelled
/ triage (push) Has been cancelled
Lint / Run linters (push) Has been cancelled
Test / test-client (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:linux]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
Test / test-server (map[arch:arm64 platform:linux]) (push) Has been cancelled
ci / build_manifests (push) Has been cancelled
This commit is contained in:
parent
8cbd23c059
commit
ac5491e864
227 changed files with 4702 additions and 3411 deletions
|
@ -1,66 +1,37 @@
|
|||
import { getConfig } from '@/react/docker/configs/queries/useConfig';
|
||||
import { getConfigs } from '@/react/docker/configs/queries/useConfigs';
|
||||
|
||||
import { deleteConfig } from '@/react/docker/configs/queries/useDeleteConfigMutation';
|
||||
import { createConfig } from '@/react/docker/configs/queries/useCreateConfigMutation';
|
||||
import { ConfigViewModel } from '../models/config';
|
||||
|
||||
angular.module('portainer.docker').factory('ConfigService', [
|
||||
'$q',
|
||||
'Config',
|
||||
function ConfigServiceFactory($q, Config) {
|
||||
'use strict';
|
||||
var service = {};
|
||||
angular.module('portainer.docker').factory('ConfigService', ConfigServiceFactory);
|
||||
|
||||
service.config = function (environmentId, configId) {
|
||||
var deferred = $q.defer();
|
||||
/* @ngInspect */
|
||||
function ConfigServiceFactory(AngularToReact) {
|
||||
const { useAxios } = AngularToReact;
|
||||
|
||||
Config.get({ id: configId, environmentId })
|
||||
.$promise.then(function success(data) {
|
||||
var config = new ConfigViewModel(data);
|
||||
deferred.resolve(config);
|
||||
})
|
||||
.catch(function error(err) {
|
||||
deferred.reject({ msg: 'Unable to retrieve config details', err: err });
|
||||
});
|
||||
return {
|
||||
configs: useAxios(listConfigsAngularJS), // config list + service create + service edit
|
||||
config: useAxios(getConfigAngularJS), // config create + config edit
|
||||
remove: useAxios(deleteConfig), // config list + config edit
|
||||
create: useAxios(createConfig), // config create
|
||||
};
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
/**
|
||||
* @param {EnvironmentId} environmentId
|
||||
*/
|
||||
async function listConfigsAngularJS(environmentId) {
|
||||
const data = await getConfigs(environmentId);
|
||||
return data.map((c) => new ConfigViewModel(c));
|
||||
}
|
||||
|
||||
service.configs = function (environmentId) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
Config.query({ environmentId })
|
||||
.$promise.then(function success(data) {
|
||||
var configs = data.map(function (item) {
|
||||
return new ConfigViewModel(item);
|
||||
});
|
||||
deferred.resolve(configs);
|
||||
})
|
||||
.catch(function error(err) {
|
||||
deferred.reject({ msg: 'Unable to retrieve configs', err: err });
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
service.remove = function (environmentId, configId) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
Config.remove({ environmentId, id: configId })
|
||||
.$promise.then(function success(data) {
|
||||
if (data.message) {
|
||||
deferred.reject({ msg: data.message });
|
||||
} else {
|
||||
deferred.resolve();
|
||||
}
|
||||
})
|
||||
.catch(function error(err) {
|
||||
deferred.reject({ msg: 'Unable to remove config', err: err });
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
service.create = function (environmentId, config) {
|
||||
return Config.create({ environmentId }, config).$promise;
|
||||
};
|
||||
|
||||
return service;
|
||||
},
|
||||
]);
|
||||
/**
|
||||
* @param {EnvironmentId} environmentId
|
||||
* @param {ConfigId} configId
|
||||
*/
|
||||
async function getConfigAngularJS(environmentId, configId) {
|
||||
const data = await getConfig(environmentId, configId);
|
||||
return new ConfigViewModel(data);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue