1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 07:19:41 +02:00
portainer/app/docker/services/nodeService.js
LP B ac5491e864
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
feat(app): limit the docker API version supported by the frontend (#12295)
2024-10-08 17:13:14 +02:00

43 lines
1.5 KiB
JavaScript

import { getNode } from '@/react/docker/proxy/queries/nodes/useNode';
import { getNodes } from '@/react/docker/proxy/queries/nodes/useNodes';
import { updateNode } from '@/react/docker/proxy/queries/nodes/useUpdateNodeMutation';
import { NodeViewModel } from '../models/node';
angular.module('portainer.docker').factory('NodeService', NodeServiceFactory);
/* @ngInject */
function NodeServiceFactory(AngularToReact) {
const { useAxios, injectEnvironmentId } = AngularToReact;
return {
nodes: useAxios(injectEnvironmentId(nodesAngularJS)), // macvlan form + services list + service create + service edit + swarm visualizer + stack edit
node: useAxios(injectEnvironmentId(nodeAngularJS)), // node browser + node details
updateNode: useAxios(injectEnvironmentId(updateNodeAngularJS)), // swarm node details panel
};
/**
* @param {EnvironmentId} environmentId
* @param {NodeId} id
*/
async function nodeAngularJS(environmentId, id) {
const data = await getNode(environmentId, id);
return new NodeViewModel(data);
}
/**
* @param {EnvironmentId} environmentId
*/
async function nodesAngularJS(environmentId) {
const data = await getNodes(environmentId);
return data.map((n) => new NodeViewModel(n));
}
/**
* @param {EnvironmentId} environmentId
* @param {NodeSpec & { Id: string; Version: number }} nodeConfig
*/
async function updateNodeAngularJS(environmentId, nodeConfig) {
return updateNode(environmentId, nodeConfig.Id, nodeConfig, nodeConfig.Version);
}
}