mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-09-30 08:01:02 +00:00
@@ -56,6 +56,26 @@ export namespace Container {
|
||||
name: string;
|
||||
state: string;
|
||||
}
|
||||
export interface ContainerFileReq {
|
||||
containerID: string;
|
||||
path: string;
|
||||
}
|
||||
export interface ContainerFileInfo {
|
||||
name: string;
|
||||
path: string;
|
||||
isDir: boolean;
|
||||
isLink: boolean;
|
||||
linkTo: string;
|
||||
size: number;
|
||||
mode: string;
|
||||
modTime: string;
|
||||
}
|
||||
export interface ContainerFileContent {
|
||||
content: string;
|
||||
size: number;
|
||||
truncated: boolean;
|
||||
isBinary: boolean;
|
||||
}
|
||||
export interface ResourceLimit {
|
||||
cpu: number;
|
||||
memory: number;
|
||||
|
||||
@@ -15,6 +15,30 @@ export const listContainerByImage = (image: string) => {
|
||||
export const loadContainerUsers = (name: string) => {
|
||||
return http.post<Array<string>>(`/containers/users`, { name: name });
|
||||
};
|
||||
export const listContainerFiles = (params: Container.ContainerFileReq) => {
|
||||
return http.post<Array<Container.ContainerFileInfo>>(`/containers/files/search`, params, TimeoutEnum.T_40S);
|
||||
};
|
||||
export const uploadContainerFile = (params: FormData) => {
|
||||
return http.upload(`/containers/files/upload`, params, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
timeout: TimeoutEnum.T_5M,
|
||||
});
|
||||
};
|
||||
export const getContainerFileContent = (params: Container.ContainerFileReq) => {
|
||||
return http.post<Container.ContainerFileContent>(`/containers/files/content`, params, TimeoutEnum.T_40S);
|
||||
};
|
||||
export const getContainerFileSize = (params: Container.ContainerFileReq) => {
|
||||
return http.post<number>(`/containers/files/size`, params, TimeoutEnum.T_40S);
|
||||
};
|
||||
export const deleteContainerFile = (params: { containerID: string; paths: string[] }) => {
|
||||
return http.post(`/containers/files/del`, params, TimeoutEnum.T_40S);
|
||||
};
|
||||
export const downloadContainerFile = (params: { containerID: string; path: string }) => {
|
||||
return http.download<BlobPart>(`/containers/files/download`, params, {
|
||||
responseType: 'blob',
|
||||
timeout: TimeoutEnum.T_40S,
|
||||
});
|
||||
};
|
||||
export const loadContainerStatus = () => {
|
||||
return http.get<Container.ContainerStatus>(`/containers/status`);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user