feat:对接ACS容器和虚拟机
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
import {http2} from "@/utils/request.js";
|
||||
export const getFileList = (data) => {
|
||||
return http2.get(`/v1/file/list?container_id=${data.container_id}&path=${data.path}`)
|
||||
}
|
||||
/** 读取文件内容 */
|
||||
export const readFile = (data) => {
|
||||
return http2.post(`/v1/file/read`,data, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
})
|
||||
}
|
||||
/*删除文件或文件夹 */
|
||||
export const deleteFile = (data) => {
|
||||
return http2.post(`/v1/file/delete`,data, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
})
|
||||
}
|
||||
/*写入文件 */
|
||||
export const writeFile = (data) => {
|
||||
return http2.post(`/v1/file/write`,data, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
})
|
||||
}
|
||||
/*创建文件夹 */
|
||||
export const createFolder = (data) => {
|
||||
return http2.post(`/v1/file/mkdir`,data, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
})
|
||||
}
|
||||
/**上传文件 */
|
||||
export const uploadFile = (data) => {
|
||||
return http2.post(`/v1/file/upload_file`,data, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
})
|
||||
}
|
||||
/**下载文件链接 */
|
||||
export const downloadFile = (data) => {
|
||||
return http2.post(`/v1/file/get_down_link`,data, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
})
|
||||
}
|
||||
/**压缩文件 */
|
||||
export const compressFile = (data) => {
|
||||
return http2.post(`/v1/file/zip_file`,data, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
})
|
||||
}
|
||||
/**解压文件 */
|
||||
export const decompressFile = (data) => {
|
||||
return http2.post(`/v1/file/unzip_file`,data, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
})
|
||||
}
|
||||
+12
-1
@@ -53,6 +53,16 @@ export const selectServerPlan = data => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**删除容器网络 */
|
||||
export const deleteContainerNetwork = data => {
|
||||
return http2.post("/v1/user/container/delete_connect", data, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**修改套餐信息 */
|
||||
export const editServerPlan = data => {
|
||||
return http2.post("/v1/admin/container_plan/update_server_plan", data, {
|
||||
@@ -275,7 +285,7 @@ export const getInstanceConsole = data => {
|
||||
};
|
||||
/**查询容器所有卷信息 */
|
||||
export const getVolumeList = data => {
|
||||
return http2.get(`/v1/admin/volume/get_volume_list?container_id=${data}`);
|
||||
return http2.get(`/v1/admin/volume/get_volume_list?instance_id=${data.instance_id}&page=${data.page}&count=${data.count}`);
|
||||
};
|
||||
/**查询虚拟机所有卷信息 */
|
||||
export const getInstanceVolumeList = data => {
|
||||
@@ -307,6 +317,7 @@ export const deleteVolume = data => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**获取容器网络信息 */
|
||||
export const getNetworkList = data => {
|
||||
return http2.get(
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
import type { VNode } from "vue";
|
||||
import { type MessageHandler, ElMessage } from "element-plus";
|
||||
|
||||
const isFunction = (val: unknown): val is Function => typeof val === 'function';
|
||||
|
||||
type messageStyle = "el" | "antd";
|
||||
type messageTypes = "info" | "success" | "warning" | "error";
|
||||
|
||||
interface MessageParams {
|
||||
/** 消息类型,可选 `info` 、`success` 、`warning` 、`error` ,默认 `info` */
|
||||
type?: messageTypes;
|
||||
/** 自定义图标,该属性会覆盖 `type` 的图标 */
|
||||
icon?: any;
|
||||
/** 是否将 `message` 属性作为 `HTML` 片段处理,默认 `false` */
|
||||
dangerouslyUseHTMLString?: boolean;
|
||||
/** 消息风格,可选 `el` 、`antd` ,默认 `antd` */
|
||||
customClass?: messageStyle;
|
||||
/** 显示时间,单位为毫秒。设为 `0` 则不会自动关闭,`element-plus` 默认是 `3000` ,平台改成默认 `2000` */
|
||||
duration?: number;
|
||||
/** 是否显示关闭按钮,默认值 `false` */
|
||||
showClose?: boolean;
|
||||
|
||||
/** `Message` 距离窗口顶部的偏移量,默认 `20` */
|
||||
offset?: number;
|
||||
/** 设置组件的根元素,默认 `document.body` */
|
||||
appendTo?: string | HTMLElement;
|
||||
/** 合并内容相同的消息,不支持 `VNode` 类型的消息,默认值 `false` */
|
||||
grouping?: boolean;
|
||||
/** 关闭时的回调函数, 参数为被关闭的 `message` 实例 */
|
||||
onClose?: Function | null;
|
||||
}
|
||||
|
||||
/** 用法非常简单,参考 src/views/components/message/index.vue 文件 */
|
||||
|
||||
/**
|
||||
* `Message` 消息提示函数
|
||||
*/
|
||||
const message = (
|
||||
message: string | VNode | (() => VNode),
|
||||
params?: MessageParams
|
||||
): MessageHandler => {
|
||||
if (!params) {
|
||||
return ElMessage({
|
||||
message,
|
||||
customClass: "pure-message"
|
||||
});
|
||||
} else {
|
||||
const {
|
||||
icon,
|
||||
type = "info",
|
||||
dangerouslyUseHTMLString = false,
|
||||
customClass = "antd",
|
||||
duration = 2000,
|
||||
showClose = false,
|
||||
|
||||
offset = 20,
|
||||
appendTo = document.body,
|
||||
grouping = false,
|
||||
onClose
|
||||
} = params;
|
||||
|
||||
return ElMessage({
|
||||
message,
|
||||
type,
|
||||
icon,
|
||||
dangerouslyUseHTMLString,
|
||||
duration,
|
||||
showClose,
|
||||
offset,
|
||||
appendTo,
|
||||
grouping,
|
||||
// 全局搜 pure-message 即可知道该类的样式位置
|
||||
customClass: customClass === "antd" ? "pure-message" : "",
|
||||
onClose: () => (isFunction(onClose) ? onClose() : null)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 关闭所有 `Message` 消息提示函数
|
||||
*/
|
||||
const closeAllMessage = (): void => ElMessage.closeAll();
|
||||
|
||||
export { message, closeAllMessage };
|
||||
@@ -106,7 +106,7 @@ class Request {
|
||||
// 创建默认实例
|
||||
const request = new Request({
|
||||
baseURL: baseUrl,
|
||||
timeout: 30000,
|
||||
timeout: 50000,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export const FileName = (data) =>{
|
||||
let name = data.split("/").pop()
|
||||
return name
|
||||
}
|
||||
+2270
File diff suppressed because it is too large
Load Diff
+4958
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user