mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 05:45:22 +02:00
refactor(docker/stacks): migrate table to react [EE-4705] (#9956)
This commit is contained in:
parent
c3d266931f
commit
c8a1f0fa77
43 changed files with 1127 additions and 492 deletions
47
app/react/docker/images/image.service.ts
Normal file
47
app/react/docker/images/image.service.ts
Normal file
|
@ -0,0 +1,47 @@
|
|||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios from '@/portainer/services/axios';
|
||||
import { ServiceId } from '@/react/docker/services/types';
|
||||
|
||||
import { ContainerId } from '../containers/types';
|
||||
|
||||
import { ImageStatus } from './types';
|
||||
|
||||
export async function getContainerImagesStatus(
|
||||
environmentId: EnvironmentId,
|
||||
containerID: ContainerId,
|
||||
nodeName: string
|
||||
) {
|
||||
try {
|
||||
let headers = {};
|
||||
if (nodeName !== '') {
|
||||
headers = { 'X-PortainerAgent-Target': nodeName };
|
||||
}
|
||||
const { data } = await axios.get<ImageStatus>(
|
||||
`/docker/${environmentId}/containers/${containerID}/image_status`,
|
||||
{ headers }
|
||||
);
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
Status: 'unknown',
|
||||
Message: `Unable to retrieve image status for container: ${containerID}`,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getServiceImagesStatus(
|
||||
environmentId: EnvironmentId,
|
||||
serviceID: ServiceId
|
||||
) {
|
||||
try {
|
||||
const { data } = await axios.get<ImageStatus>(
|
||||
`/docker/${environmentId}/services/${serviceID}/image_status`
|
||||
);
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
Status: 'unknown',
|
||||
Message: `Unable to retrieve image status for service: ${serviceID}`,
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue