fix 替换前端 api ts :any

This commit is contained in:
bwcx_jzy 2023-04-12 13:24:50 +08:00
parent d7f5ec59c6
commit 11942ae876
No known key found for this signature in database
GPG Key ID: E187D6E9DDDE8C53
46 changed files with 2152 additions and 2164 deletions

View File

@ -1,5 +1,5 @@
import axios from "./config";
import { loadRouterBase } from "./config";
import axios from './config'
import { loadRouterBase } from './config'
/**
*
@ -8,12 +8,12 @@ import { loadRouterBase } from "./config";
* backupType: 备份类型{0: 全量, 1: 部分}
* } params
*/
export function getBackupList(params) {
export function getBackupList(params: any) {
return axios({
url: "/system/backup/list",
method: "post",
data: params,
});
url: '/system/backup/list',
method: 'post',
data: params
})
}
/**
@ -21,9 +21,9 @@ export function getBackupList(params) {
*/
export function getTableNameList() {
return axios({
url: "/system/backup/table-name-list",
method: "post",
});
url: '/system/backup/table-name-list',
method: 'post'
})
}
/**
@ -32,16 +32,16 @@ export function getTableNameList() {
*/
export function createBackup(tableNameList) {
const data = {
tableNameList,
};
tableNameList
}
return axios({
url: "/system/backup/create",
method: "post",
url: '/system/backup/create',
method: 'post',
headers: {
"Content-Type": "application/json",
'Content-Type': 'application/json'
},
data,
});
data
})
}
/**
@ -50,10 +50,10 @@ export function createBackup(tableNameList) {
*/
export function deleteBackup(id) {
return axios({
url: "/system/backup/delete",
method: "post",
data: { id },
});
url: '/system/backup/delete',
method: 'post',
data: { id }
})
}
/**
@ -63,11 +63,11 @@ export function deleteBackup(id) {
*/
export function restoreBackup(id) {
return axios({
url: "/system/backup/restore",
method: "post",
url: '/system/backup/restore',
method: 'post',
timeout: 0,
data: { id },
});
data: { id }
})
}
/**
@ -76,9 +76,9 @@ export function restoreBackup(id) {
* @returns
*/
export function downloadBackupFile(id) {
return loadRouterBase("/system/backup/download", {
id: id,
});
return loadRouterBase('/system/backup/download', {
id: id
})
}
/**
@ -90,36 +90,36 @@ export function downloadBackupFile(id) {
*/
export function uploadBackupFile(formData) {
return axios({
url: "/system/backup/upload",
url: '/system/backup/upload',
headers: {
"Content-Type": "multipart/form-data;charset=UTF-8",
'Content-Type': 'multipart/form-data;charset=UTF-8'
},
method: "post",
method: 'post',
// 0 表示无超时时间
timeout: 0,
data: formData,
});
data: formData
})
}
export const backupTypeArray = [
{ key: 0, value: "全量备份", disabled: false },
{ key: 1, value: "部分备份", disabled: false },
{ key: 2, value: "导入备份", disabled: true },
{ key: 3, value: "自动备份", disabled: true },
];
{ key: 0, value: '全量备份', disabled: false },
{ key: 1, value: '部分备份', disabled: false },
{ key: 2, value: '导入备份', disabled: true },
{ key: 3, value: '自动备份', disabled: true }
]
export const arrayToMap = (arra) => {
let obj = {};
let obj = {}
arra.forEach((value) => {
obj[value.key] = value.value;
});
return obj;
};
obj[value.key] = value.value
})
return obj
}
export const backupTypeMap = arrayToMap(backupTypeArray);
export const backupTypeMap = arrayToMap(backupTypeArray)
export const backupStatusMap = {
0: "处理中",
1: "处理成功",
2: "处理失败",
};
0: '处理中',
1: '处理成功',
2: '处理失败'
}

View File

@ -1,5 +1,5 @@
import axios from "./config";
import { loadRouterBase } from "./config";
import axios from './config'
import { loadRouterBase } from './config'
/**
*
@ -7,15 +7,15 @@ import { loadRouterBase } from "./config";
* group: 分组名称
* } params
*/
export function getBuildList(params, loading) {
export function getBuildList(params: any, loading: boolean) {
return axios({
url: "/build/list",
method: "post",
url: '/build/list',
method: 'post',
data: params,
headers: {
loading: loading === false ? "no" : "",
},
});
loading: loading === false ? 'no' : ''
}
})
}
/**
@ -24,12 +24,12 @@ export function getBuildList(params, loading) {
*
* } params
*/
export function getBuildGet(params) {
export function getBuildGet(params: any) {
return axios({
url: "/build/get",
method: "get",
params,
});
url: '/build/get',
method: 'get',
params
})
}
/**
@ -37,9 +37,9 @@ export function getBuildGet(params) {
*/
export function getBuildGroupAll() {
return axios({
url: "/build/list_group_all",
method: "get",
});
url: '/build/list_group_all',
method: 'get'
})
}
/**
@ -48,16 +48,16 @@ export function getBuildGroupAll() {
* repositoryId: 仓库id
* } params
*/
export function getBranchList(params) {
export function getBranchList(params: any) {
return axios({
url: "/build/branch-list",
method: "post",
url: '/build/branch-list',
method: 'post',
timeout: 0,
data: params,
headers: {
loadingTip: "正在加载项目分支",
},
});
loadingTip: '正在加载项目分支'
}
})
}
/**
@ -75,7 +75,7 @@ export function getBranchList(params) {
* repostitoryId: 仓库信息
* } params
*/
export function editBuild(params) {
export function editBuild(params: any) {
const data = {
id: params.id,
name: params.name,
@ -92,37 +92,37 @@ export function editBuild(params) {
webhook: params.webhook,
autoBuildCron: params.autoBuildCron,
buildMode: params.buildMode,
aliasCode: params.aliasCode,
};
aliasCode: params.aliasCode
}
return axios({
url: "/build/edit",
method: "post",
data,
});
url: '/build/edit',
method: 'post',
data
})
}
/**
*
* @param {*} id
*/
export function deleteBuild(id) {
export function deleteBuild(id: string) {
return axios({
url: "/build/delete",
method: "post",
data: { id },
});
url: '/build/delete',
method: 'post',
data: { id }
})
}
/**
*
* @param {*} id
*/
export function getTriggerUrl(data) {
export function getTriggerUrl(data: any) {
return axios({
url: "/build/trigger/url",
method: "post",
data: data,
});
url: '/build/trigger/url',
method: 'post',
data: data
})
}
// /**
@ -141,12 +141,12 @@ export function getTriggerUrl(data) {
*
* @param {*} id
*/
export function clearBuid(id) {
export function clearBuid(id: string) {
return axios({
url: "/build/clean-source",
method: "post",
data: { id },
});
url: '/build/clean-source',
method: 'post',
data: { id }
})
}
/**
@ -157,40 +157,40 @@ export function clearBuid(id) {
* line: 需要获取的行号 1
* }
*/
export function loadBuildLog(params) {
export function loadBuildLog(params: any) {
return axios({
url: "/build/manage/get-now-log",
method: "post",
url: '/build/manage/get-now-log',
method: 'post',
data: params,
headers: {
tip: "no",
loading: "no",
},
});
tip: 'no',
loading: 'no'
}
})
}
/**
*
* @param {*} id
*/
export function startBuild(data) {
export function startBuild(data: any) {
return axios({
url: "/build/manage/start",
method: "post",
data: data,
});
url: '/build/manage/start',
method: 'post',
data: data
})
}
/**
*
* @param {*} id
*/
export function stopBuild(id) {
export function stopBuild(id: string) {
return axios({
url: "/build/manage/cancel",
method: "post",
data: { id },
});
url: '/build/manage/cancel',
method: 'post',
data: { id }
})
}
/**
@ -200,43 +200,43 @@ export function stopBuild(id) {
* status: 状态
* } params
*/
export function geteBuildHistory(params) {
export function geteBuildHistory(params: any) {
return axios({
url: "/build/history/history_list.json",
method: "post",
data: params,
});
url: '/build/history/history_list.json',
method: 'post',
data: params
})
}
/**
*
* @param {*} logId
*/
export function downloadBuildLog(logId) {
return loadRouterBase("/build/history/download_log.html", {
logId: logId,
});
export function downloadBuildLog(logId: string) {
return loadRouterBase('/build/history/download_log.html', {
logId: logId
})
}
/**
*
* @param {*} logId
*/
export function downloadBuildFile(logId) {
return loadRouterBase("/build/history/download_file.html", {
logId: logId,
});
export function downloadBuildFile(logId: string) {
return loadRouterBase('/build/history/download_file.html', {
logId: logId
})
}
/**
*
* @param {*} logId
*/
export function downloadBuildFileByBuild(id, numberId) {
return loadRouterBase("/build/history/download_file_by_build", {
export function downloadBuildFileByBuild(id: string, numberId: string) {
return loadRouterBase('/build/history/download_file_by_build', {
buildId: id,
buildNumberId: numberId,
});
buildNumberId: numberId
})
}
/**
@ -244,75 +244,75 @@ export function downloadBuildFileByBuild(id, numberId) {
* @param {*} logId
* @returns
*/
export function rollback(logId) {
export function rollback(logId: string) {
return axios({
url: "/build/manage/reRelease",
method: "post",
data: { logId },
});
url: '/build/manage/reRelease',
method: 'post',
data: { logId }
})
}
/**
*
* @param {*} logId
*/
export function deleteBuildHistory(logId) {
export function deleteBuildHistory(logId: string) {
return axios({
url: "/build/history/delete_log.json",
method: "post",
data: { logId },
});
url: '/build/history/delete_log.json',
method: 'post',
data: { logId }
})
}
export function sortItem(params) {
export function sortItem(params: any) {
return axios({
url: "/build/sort-item",
method: "get",
params: params,
});
url: '/build/sort-item',
method: 'get',
params: params
})
}
export const statusMap = {
1: "构建中",
2: "构建完成",
3: "构建失败",
4: "发布中",
5: "发布成功",
6: "发布失败",
7: "取消构建",
8: "构建中断",
9: "队列等待",
10: "异常关闭",
};
1: '构建中',
2: '构建完成',
3: '构建失败',
4: '发布中',
5: '发布成功',
6: '发布失败',
7: '取消构建',
8: '构建中断',
9: '队列等待',
10: '异常关闭'
}
export const statusColor = {
1: "orange",
2: "green",
3: "red",
4: "orange",
5: "green",
6: "red",
7: "",
8: "blue",
9: "orange",
10: "red",
};
1: 'orange',
2: 'green',
3: 'red',
4: 'orange',
5: 'green',
6: 'red',
7: '',
8: 'blue',
9: 'orange',
10: 'red'
}
export const releaseMethodMap = {
0: "不发布",
1: "节点分发",
2: "项目",
3: "SSH",
4: "本地命令",
5: "Docker镜像",
};
0: '不发布',
1: '节点分发',
2: '项目',
3: 'SSH',
4: '本地命令',
5: 'Docker镜像'
}
export const triggerBuildTypeMap = {
0: "手动",
1: "触发器",
2: "定时",
};
0: '手动',
1: '触发器',
2: '定时'
}
export const buildModeMap = {
0: "本地构建",
1: "容器构建",
};
0: '本地构建',
1: '容器构建'
}

View File

@ -18,7 +18,7 @@
// * group: 分组名称
// * } params
// */
// export function getBuildList(params) {
// export function getBuildList(params:any) {
// return axios({
// url: '/build/list_data.json',
// method: 'post',
@ -34,7 +34,7 @@
// * userPwd: 密码
// * } params
// */
// export function getBranchList(params) {
// export function getBranchList(params:any) {
// return axios({
// url: '/build/branchList.json',
// method: 'post',
@ -59,7 +59,7 @@
// * repoType: 仓库类型 0: GIT | 1: SVN
// * } params
// */
// export function editBuild(params) {
// export function editBuild(params:any) {
// const data = {
// id: params.id,
// name: params.name,
@ -145,7 +145,7 @@
// * line: 需要获取的行号 1 开始
// * }
// */
// export function loadBuildLog(params) {
// export function loadBuildLog(params:any) {
// return axios({
// url: '/build/getNowLog.json',
// method: 'post',
@ -188,7 +188,7 @@
// * status: 状态
// * } params
// */
// export function geteBuildHistory(params) {
// export function geteBuildHistory(params:any) {
// return axios({
// url: '/build/history_list.json',
// method: 'post',
@ -242,4 +242,4 @@
// 1: '节点分发',
// 2: '项目',
// 3: 'SSH'
// }
// }

View File

@ -1,122 +1,122 @@
import axios, { loadRouterBase } from "./config";
import axios, { loadRouterBase } from './config'
// 命令列表
export function getCommandList(params) {
export function getCommandList(params: any) {
return axios({
url: "/node/ssh_command/list",
method: "post",
data: params,
});
url: '/node/ssh_command/list',
method: 'post',
data: params
})
}
// 编辑命令
export function editCommand(params) {
export function editCommand(params: any) {
return axios({
url: "/node/ssh_command/edit",
method: "post",
url: '/node/ssh_command/edit',
method: 'post',
headers: {
"Content-Type": "application/json",
'Content-Type': 'application/json'
},
data: params,
});
data: params
})
}
// 删除命令
export function deleteCommand(id) {
export function deleteCommand(id: string) {
return axios({
url: "/node/ssh_command/del",
method: "post",
data: { id },
});
url: '/node/ssh_command/del',
method: 'post',
data: { id }
})
}
// 删除命令
export function executeBatch(param) {
export function executeBatch(param: any) {
return axios({
url: "/node/ssh_command/batch",
method: "post",
data: param,
});
url: '/node/ssh_command/batch',
method: 'post',
data: param
})
}
// 命令日志列表
export function getCommandLogList(params) {
export function getCommandLogList(params: any) {
return axios({
url: "/node/ssh_command_log/list",
method: "post",
data: params,
});
url: '/node/ssh_command_log/list',
method: 'post',
data: params
})
}
// 命令日志批次列表
export function getCommandLogBarchList(params) {
export function getCommandLogBarchList(params: any) {
return axios({
url: "/node/ssh_command_log/batch_list",
method: "get",
params: params,
});
url: '/node/ssh_command_log/batch_list',
method: 'get',
params: params
})
}
// 删除命令执行记录
export function deleteCommandLog(id) {
export function deleteCommandLog(id: string) {
return axios({
url: "/node/ssh_command_log/del",
method: "post",
data: { id },
});
url: '/node/ssh_command_log/del',
method: 'post',
data: { id }
})
}
// 命令日志信息
export function getCommandLogInfo(params) {
export function getCommandLogInfo(params: any) {
return axios({
url: "/node/ssh_command_log/log",
method: "post",
url: '/node/ssh_command_log/log',
method: 'post',
data: params,
headers: {
loading: "no",
},
});
loading: 'no'
}
})
}
/**
*
* @param {*} logId
*/
export function downloadLog(logId) {
return loadRouterBase("/node/ssh_command_log/download_log", {
logId: logId,
});
export function downloadLog(logId: string) {
return loadRouterBase('/node/ssh_command_log/download_log', {
logId: logId
})
}
export function syncToWorkspace(params) {
export function syncToWorkspace(params: any) {
return axios({
url: "/node/ssh_command/sync-to-workspace",
method: "get",
params: params,
});
url: '/node/ssh_command/sync-to-workspace',
method: 'get',
params: params
})
}
/**
*
* @param {*} id
*/
export function getTriggerUrl(data) {
export function getTriggerUrl(data: any) {
return axios({
url: "/node/ssh_command/trigger-url",
method: "post",
data: data,
});
url: '/node/ssh_command/trigger-url',
method: 'post',
data: data
})
}
export const statusMap = {
0: "执行中",
1: "执行结束",
2: "执行错误",
3: "会话异常",
};
0: '执行中',
1: '执行结束',
2: '执行错误',
3: '会话异常'
}
export const triggerExecTypeMap = {
0: "手动",
1: "自动",
2: "触发器",
};
0: '手动',
1: '自动',
2: '触发器'
}

View File

@ -1,4 +1,4 @@
import { IResponse } from './../interface/request.d'
import { IResponse } from '@/interface/request'
import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
import { NO_NOTIFY_KEY, TOKEN_HEADER_KEY, CACHE_WORKSPACE_ID } from '@/utils/const'
import { refreshToken } from './user/user'

View File

@ -1,44 +1,44 @@
import axios from "./config";
import axios from './config'
// 分发列表
export function getDishPatchList(data, loading) {
export function getDishPatchList(data: any, loading: boolean) {
return axios({
url: "/outgiving/dispatch-list",
method: "post",
url: '/outgiving/dispatch-list',
method: 'post',
data: data,
headers: {
loading: loading === false ? "no" : "",
},
});
loading: loading === false ? 'no' : ''
}
})
}
// 分发列表
export function getDishPatchListAll() {
return axios({
url: "/outgiving/dispatch-list-all",
method: "get",
});
url: '/outgiving/dispatch-list-all',
method: 'get'
})
}
// 分发节点项目状态
export function getDispatchProject(id, loading) {
export function getDispatchProject(id: string, loading: boolean) {
return axios({
url: "/outgiving/getItemData.json",
method: "post",
url: '/outgiving/getItemData.json',
method: 'post',
data: { id },
timeout: 0,
headers: {
loading: loading === false ? "no" : "",
},
});
loading: loading === false ? 'no' : ''
}
})
}
// reqId
export function getReqId() {
return axios({
url: "/outgiving/get-reqId",
method: "get",
});
url: '/outgiving/get-reqId',
method: 'get'
})
}
/**
@ -52,12 +52,12 @@ export function getReqId() {
* afterOpt: 发布后操作
* } params
*/
export function editDispatch(params) {
export function editDispatch(params: any) {
return axios({
url: "/outgiving/save",
method: "post",
data: params,
});
url: '/outgiving/save',
method: 'post',
data: params
})
}
/**
@ -80,12 +80,12 @@ export function editDispatch(params) {
* xxx_javaCopyIds: xxx ID xxx_jvm_${ID} | xxx_args_${ID}
* } params
*/
export function editDispatchProject(params) {
export function editDispatchProject(params: any) {
return axios({
url: "/outgiving/save_project",
method: "post",
data: params,
});
url: '/outgiving/save_project',
method: 'post',
data: params
})
}
/**
@ -97,28 +97,28 @@ export function editDispatchProject(params) {
* file: 文件 multipart/form-data
* } formData
*/
export function uploadDispatchFile(formData) {
export function uploadDispatchFile(formData: FormData) {
return axios({
url: "/outgiving/upload-sharding",
url: '/outgiving/upload-sharding',
headers: {
"Content-Type": "multipart/form-data;charset=UTF-8",
loading: "no",
'Content-Type': 'multipart/form-data;charset=UTF-8',
loading: 'no'
},
method: "post",
method: 'post',
// 0 表示无超时时间
timeout: 0,
data: formData,
});
data: formData
})
}
export function uploadDispatchFileMerge(params) {
export function uploadDispatchFileMerge(params: any) {
return axios({
url: "/outgiving/upload-sharding-merge",
method: "post",
url: '/outgiving/upload-sharding-merge',
method: 'post',
data: params,
// 0 表示无超时时间
timeout: 0,
});
timeout: 0
})
}
/**
@ -131,48 +131,48 @@ export function uploadDispatchFileMerge(params) {
* unzip
* } params
*/
export function remoteDownload(params) {
export function remoteDownload(params: any) {
return axios({
url: "/outgiving/remote_download",
method: "post",
data: params,
});
url: '/outgiving/remote_download',
method: 'post',
data: params
})
}
/**
*
* @param {*} id ID
*/
export function releaseDelDisPatch(id) {
export function releaseDelDisPatch(id: string) {
return axios({
url: "/outgiving/release_del.json",
method: "post",
data: { id },
});
url: '/outgiving/release_del.json',
method: 'post',
data: { id }
})
}
/**
*
* @param {*} id ID
*/
export function delDisPatchProject(data) {
export function delDisPatchProject(data: any) {
return axios({
url: "/outgiving/delete_project",
method: "post",
data: data,
});
url: '/outgiving/delete_project',
method: 'post',
data: data
})
}
/**
*
* @param {*} id ID
*/
export function unbindOutgiving(id) {
export function unbindOutgiving(id: string) {
return axios({
url: "/outgiving/unbind.json",
method: "get",
params: { id },
});
url: '/outgiving/unbind.json',
method: 'get',
params: { id }
})
}
/**
@ -184,91 +184,91 @@ export function unbindOutgiving(id) {
* time: 时间区间 2021-01-04 00:00:00 ~ 2021-01-12 00:00:00
* } params
*/
export function getDishPatchLogList(params) {
export function getDishPatchLogList(params: any) {
return axios({
url: "/outgiving/log_list_data.json",
method: "post",
data: params,
});
url: '/outgiving/log_list_data.json',
method: 'post',
data: params
})
}
// 获取分发白名单数据
export function getDispatchWhiteList() {
return axios({
url: "/outgiving/white-list",
method: "post",
});
url: '/outgiving/white-list',
method: 'post'
})
}
/**
*
* @param {*} params
*/
export function editDispatchWhiteList(params) {
export function editDispatchWhiteList(params: any) {
return axios({
url: "/outgiving/whitelistDirectory_submit",
method: "post",
data: params,
});
url: '/outgiving/whitelistDirectory_submit',
method: 'post',
data: params
})
}
/**
*
* @param {*} id ID
*/
export function cancelOutgiving(data) {
export function cancelOutgiving(data: any) {
return axios({
url: "/outgiving/cancel",
method: "post",
data,
});
url: '/outgiving/cancel',
method: 'post',
data
})
}
export function removeProject(params) {
export function removeProject(params: any) {
return axios({
url: "/outgiving/remove-project",
method: "get",
params: params,
});
url: '/outgiving/remove-project',
method: 'get',
params: params
})
}
export function saveDispatchProjectConfig(data) {
export function saveDispatchProjectConfig(data: any) {
return axios({
url: "/outgiving/config-project",
method: "post",
url: '/outgiving/config-project',
method: 'post',
data,
headers: {
"Content-Type": "application/json",
},
});
'Content-Type': 'application/json'
}
})
}
export const afterOptList = [
{ title: "不做任何操作", value: 0 },
{ title: "并发执行", value: 1 },
{ title: "完整顺序执行(有执行失败将结束本次)", value: 2 },
{ title: "顺序执行(有执行失败将继续)", value: 3 },
];
{ title: '不做任何操作', value: 0 },
{ title: '并发执行', value: 1 },
{ title: '完整顺序执行(有执行失败将结束本次)', value: 2 },
{ title: '顺序执行(有执行失败将继续)', value: 3 }
]
export const afterOptListSimple = [
{ title: "不做任何操作", value: 0 },
{ title: "执行重启", value: 1 },
];
{ title: '不做任何操作', value: 0 },
{ title: '执行重启', value: 1 }
]
export const dispatchStatusMap = {
0: "未分发",
1: "分发中",
2: "分发成功",
3: "分发失败",
4: "系统取消分发",
5: "准备分发",
6: "手动取消分发",
};
0: '未分发',
1: '分发中',
2: '分发成功',
3: '分发失败',
4: '系统取消分发',
5: '准备分发',
6: '手动取消分发'
}
export const statusMap = {
0: "未分发",
1: "分发中",
2: "分发结束",
3: "取消分发",
4: "分发失败",
};
0: '未分发',
1: '分发中',
2: '分发结束',
3: '取消分发',
4: '分发失败'
}

View File

@ -1,15 +1,15 @@
import axios from "./config";
import axios from './config'
/**
*
* @param {JSON} params
*/
export function dockerList(params) {
export function dockerList(params: any) {
return axios({
url: "/docker/list",
method: "post",
data: params,
});
url: '/docker/list',
method: 'post',
data: params
})
}
/**
@ -18,18 +18,18 @@ export function dockerList(params) {
*/
export function apiVersions() {
return axios({
url: "/docker/api-versions",
method: "get",
data: {},
});
url: '/docker/api-versions',
method: 'get',
data: {}
})
}
export function editDocker(data) {
export function editDocker(data: any) {
return axios({
url: "/docker/edit",
method: "post",
data: data,
});
url: '/docker/edit',
method: 'post',
data: data
})
}
/**
@ -38,12 +38,12 @@ export function editDocker(data) {
* id: docker ID
* } params
*/
export function deleteDcoker(params) {
export function deleteDcoker(params: any) {
return axios({
url: "/docker/del",
method: "get",
params,
});
url: '/docker/del',
method: 'get',
params
})
}
/**
@ -52,13 +52,13 @@ export function deleteDcoker(params) {
*/
export function dockerContainerList(urlPrefix, params) {
return axios({
url: urlPrefix + "/container/list",
method: "post",
url: urlPrefix + '/container/list',
method: 'post',
data: params,
headers: {
loading: "no",
},
});
loading: 'no'
}
})
}
/**
@ -67,13 +67,13 @@ export function dockerContainerList(urlPrefix, params) {
*/
export function dockerContainerListCompose(urlPrefix, params) {
return axios({
url: urlPrefix + "/container/list-compose",
method: "post",
url: urlPrefix + '/container/list-compose',
method: 'post',
data: params,
headers: {
loading: "no",
},
});
loading: 'no'
}
})
}
/**
@ -82,10 +82,10 @@ export function dockerContainerListCompose(urlPrefix, params) {
*/
export function dockerInfo(urlPrefix, params) {
return axios({
url: urlPrefix + "/container/info",
method: "get",
params: params,
});
url: urlPrefix + '/container/info',
method: 'get',
params: params
})
}
/**
@ -94,11 +94,11 @@ export function dockerInfo(urlPrefix, params) {
*/
export function dockerPrune(urlPrefix, params) {
return axios({
url: urlPrefix + "/container/prune",
method: "post",
url: urlPrefix + '/container/prune',
method: 'post',
data: params,
timeout: 0,
});
timeout: 0
})
}
/**
@ -107,10 +107,10 @@ export function dockerPrune(urlPrefix, params) {
*/
export function dockerContainerRemove(urlPrefix, params) {
return axios({
url: urlPrefix + "/container/remove",
method: "get",
params: params,
});
url: urlPrefix + '/container/remove',
method: 'get',
params: params
})
}
/**
@ -119,10 +119,10 @@ export function dockerContainerRemove(urlPrefix, params) {
*/
export function dockerContainerRestart(urlPrefix, params) {
return axios({
url: urlPrefix + "/container/restart",
method: "get",
params: params,
});
url: urlPrefix + '/container/restart',
method: 'get',
params: params
})
}
/**
@ -131,10 +131,10 @@ export function dockerContainerRestart(urlPrefix, params) {
*/
export function dockerContainerStart(urlPrefix, params) {
return axios({
url: urlPrefix + "/container/start",
method: "get",
params: params,
});
url: urlPrefix + '/container/start',
method: 'get',
params: params
})
}
/**
@ -143,10 +143,10 @@ export function dockerContainerStart(urlPrefix, params) {
*/
export function dockerContainerStop(urlPrefix, params) {
return axios({
url: urlPrefix + "/container/stop",
method: "get",
params: params,
});
url: urlPrefix + '/container/stop',
method: 'get',
params: params
})
}
/**
@ -155,14 +155,14 @@ export function dockerContainerStop(urlPrefix, params) {
*/
export function dockerContainerStats(urlPrefix, params) {
return axios({
url: urlPrefix + "/container/stats",
method: "get",
url: urlPrefix + '/container/stats',
method: 'get',
params: params,
headers: {
// tip: "no",
loading: "no",
},
});
loading: 'no'
}
})
}
/**
@ -171,10 +171,10 @@ export function dockerContainerStats(urlPrefix, params) {
*/
export function dockerInspectContainer(urlPrefix, params) {
return axios({
url: urlPrefix + "/container/inspect-container",
method: "get",
params: params,
});
url: urlPrefix + '/container/inspect-container',
method: 'get',
params: params
})
}
/**
@ -184,13 +184,13 @@ export function dockerInspectContainer(urlPrefix, params) {
*/
export function dockerUpdateContainer(urlPrefix, params) {
return axios({
url: urlPrefix + "/container/update-container",
method: "post",
url: urlPrefix + '/container/update-container',
method: 'post',
headers: {
"Content-Type": "application/json",
'Content-Type': 'application/json'
},
data: params,
});
data: params
})
}
/**
@ -199,10 +199,10 @@ export function dockerUpdateContainer(urlPrefix, params) {
*/
export function dockerImagesList(urlPrefix, params) {
return axios({
url: urlPrefix + "/images/list",
method: "post",
data: params,
});
url: urlPrefix + '/images/list',
method: 'post',
data: params
})
}
/**
@ -211,10 +211,10 @@ export function dockerImagesList(urlPrefix, params) {
*/
export function dockerImageRemove(urlPrefix, params) {
return axios({
url: urlPrefix + "/images/remove",
method: "get",
params: params,
});
url: urlPrefix + '/images/remove',
method: 'get',
params: params
})
}
/**
@ -223,10 +223,10 @@ export function dockerImageRemove(urlPrefix, params) {
*/
export function dockerImageInspect(urlPrefix, params) {
return axios({
url: urlPrefix + "/images/inspect",
method: "get",
params: params,
});
url: urlPrefix + '/images/inspect',
method: 'get',
params: params
})
}
/**
@ -235,13 +235,13 @@ export function dockerImageInspect(urlPrefix, params) {
*/
export function dockerImageCreateContainer(urlPrefix, params) {
return axios({
url: urlPrefix + "/images/create-container",
method: "post",
url: urlPrefix + '/images/create-container',
method: 'post',
headers: {
"Content-Type": "application/json",
'Content-Type': 'application/json'
},
data: params,
});
data: params
})
}
/**
@ -250,10 +250,10 @@ export function dockerImageCreateContainer(urlPrefix, params) {
*/
export function dockerImagePullImage(urlPrefix, params) {
return axios({
url: urlPrefix + "/images/pull-image",
method: "get",
params: params,
});
url: urlPrefix + '/images/pull-image',
method: 'get',
params: params
})
}
/**
@ -262,14 +262,14 @@ export function dockerImagePullImage(urlPrefix, params) {
*/
export function dockerImagePullImageLog(urlPrefix, params) {
return axios({
url: urlPrefix + "/images/pull-image-log",
method: "get",
url: urlPrefix + '/images/pull-image-log',
method: 'get',
params: params,
headers: {
// tip: "no",
loading: "no",
},
});
loading: 'no'
}
})
}
/**
@ -278,10 +278,10 @@ export function dockerImagePullImageLog(urlPrefix, params) {
*/
export function dockerVolumesList(urlPrefix, params) {
return axios({
url: urlPrefix + "/volumes/list",
method: "post",
data: params,
});
url: urlPrefix + '/volumes/list',
method: 'post',
data: params
})
}
/**
@ -290,10 +290,10 @@ export function dockerVolumesList(urlPrefix, params) {
*/
export function dockerVolumesRemove(urlPrefix, params) {
return axios({
url: urlPrefix + "/volumes/remove",
method: "get",
params: params,
});
url: urlPrefix + '/volumes/remove',
method: 'get',
params: params
})
}
/**
@ -302,16 +302,16 @@ export function dockerVolumesRemove(urlPrefix, params) {
*/
export function dockerNetworksList(urlPrefix, params) {
return axios({
url: urlPrefix + "/networks/list",
method: "post",
data: params,
});
url: urlPrefix + '/networks/list',
method: 'post',
data: params
})
}
export function syncToWorkspace(params) {
export function syncToWorkspace(params: any) {
return axios({
url: "/docker/sync-to-workspace",
method: "get",
params: params,
});
url: '/docker/sync-to-workspace',
method: 'get',
params: params
})
}

View File

@ -1,31 +1,31 @@
import axios from "./config";
import axios from './config'
/**
*
* @param {JSON} params
*/
export function dockerSwarmList(params) {
export function dockerSwarmList(params: any) {
return axios({
url: "/docker/swarm/list",
method: "post",
data: params,
});
url: '/docker/swarm/list',
method: 'post',
data: params
})
}
export function dockerSwarmListAll(params) {
export function dockerSwarmListAll(params: any) {
return axios({
url: "/docker/swarm/list-all",
method: "get",
params: params,
});
url: '/docker/swarm/list-all',
method: 'get',
params: params
})
}
export function editDockerSwarm(data) {
export function editDockerSwarm(data: any) {
return axios({
url: "/docker/swarm/edit",
method: "post",
data: data,
});
url: '/docker/swarm/edit',
method: 'post',
data: data
})
}
/**
@ -34,123 +34,123 @@ export function editDockerSwarm(data) {
* id: docker ID
* } params
*/
export function delSwarm(params) {
export function delSwarm(params: any) {
return axios({
url: "/docker/swarm/del",
method: "get",
params,
});
url: '/docker/swarm/del',
method: 'get',
params
})
}
/**
*
* @param {JSON} params
*/
export function dockerSwarmNodeList(urlPrefix, params) {
export function dockerSwarmNodeList(urlPrefix: string, params: any) {
return axios({
url: urlPrefix + "/docker/swarm/node-list",
method: "post",
url: urlPrefix + '/docker/swarm/node-list',
method: 'post',
data: params,
headers: {
loading: "no",
},
});
loading: 'no'
}
})
}
/**
*
* @param {JSON} params
*/
export function dockerSwarmNodeUpdate(urlPrefix, params) {
export function dockerSwarmNodeUpdate(urlPrefix: string, params: any) {
return axios({
url: urlPrefix + "/docker/swarm/update",
method: "post",
data: params,
});
url: urlPrefix + '/docker/swarm/update',
method: 'post',
data: params
})
}
/**
*
* @param {JSON} params
*/
export function dockerSwarmServicesList(urlPrefix, params) {
export function dockerSwarmServicesList(urlPrefix: string, params: any) {
return axios({
url: urlPrefix + "/docker/swarm-service/list",
method: "post",
url: urlPrefix + '/docker/swarm-service/list',
method: 'post',
data: params,
headers: {
loading: "no",
},
});
loading: 'no'
}
})
}
/**
*
* @param {JSON} params
*/
export function dockerSwarmServicesTaskList(urlPrefix, params) {
export function dockerSwarmServicesTaskList(urlPrefix: string, params: any) {
return axios({
url: urlPrefix + "/docker/swarm-service/task-list",
method: "post",
url: urlPrefix + '/docker/swarm-service/task-list',
method: 'post',
data: params,
headers: {
loading: "no",
},
});
loading: 'no'
}
})
}
/**
*
* @param {JSON} params
*/
export function dockerSwarmServicesDel(urlPrefix, params) {
export function dockerSwarmServicesDel(urlPrefix: string, params: any) {
return axios({
url: urlPrefix + "/docker/swarm-service/del",
method: "get",
params: params,
});
url: urlPrefix + '/docker/swarm-service/del',
method: 'get',
params: params
})
}
/**
*
* @param {JSON} params
*/
export function dockerSwarmServicesEdit(urlPrefix, params) {
export function dockerSwarmServicesEdit(urlPrefix: string, params: any) {
return axios({
url: urlPrefix + "/docker/swarm-service/edit",
method: "post",
url: urlPrefix + '/docker/swarm-service/edit',
method: 'post',
data: params,
headers: {
"Content-Type": "application/json",
},
});
'Content-Type': 'application/json'
}
})
}
/**
*
* @param {JSON} params
*/
export function dockerSwarmServicesStartLog(urlPrefix, params) {
export function dockerSwarmServicesStartLog(urlPrefix: string, params: any) {
return axios({
url: urlPrefix + "/docker/swarm-service/start-log",
method: "get",
params: params,
});
url: urlPrefix + '/docker/swarm-service/start-log',
method: 'get',
params: params
})
}
/**
*
* @param {JSON} params
*/
export function dockerSwarmServicesPullLog(urlPrefix, params) {
export function dockerSwarmServicesPullLog(urlPrefix: string, params: any) {
return axios({
url: urlPrefix + "/docker/swarm-service/pull-log",
method: "get",
url: urlPrefix + '/docker/swarm-service/pull-log',
method: 'get',
params: params,
headers: {
loading: "no",
},
});
loading: 'no'
}
})
}
/**
@ -187,19 +187,19 @@ export function dockerSwarmServicesPullLog(urlPrefix, params) {
<a-select-option key="ORPHANED"></a-select-option>
*/
export const TASK_STATE = {
NEW: "新建状态",
NEW: '新建状态',
// ALLOCATED: "已分配",
PENDING: "待处理",
ASSIGNED: "已分配",
ACCEPTED: "处理中",
PREPARING: "准备中",
READY: "准备",
STARTING: "开始执行任务",
RUNNING: "执行任务中",
COMPLETE: "执行成功",
SHUTDOWN: "停止",
FAILED: "执行失败",
REJECTED: "拒绝",
REMOVE: "移除",
ORPHANED: "已失联",
};
PENDING: '待处理',
ASSIGNED: '已分配',
ACCEPTED: '处理中',
PREPARING: '准备中',
READY: '准备',
STARTING: '开始执行任务',
RUNNING: '执行任务中',
COMPLETE: '执行成功',
SHUTDOWN: '停止',
FAILED: '执行失败',
REJECTED: '拒绝',
REMOVE: '移除',
ORPHANED: '已失联'
}

View File

@ -1,4 +1,4 @@
import axios from "./config";
import axios from './config'
/**
*
@ -6,39 +6,39 @@ import axios from "./config";
*/
export function listExtConf() {
return axios({
url: "/system/ext-conf/list",
method: "get",
});
url: '/system/ext-conf/list',
method: 'get'
})
}
export function getItem(params) {
export function getItem(params: any) {
return axios({
url: "/system/ext-conf/get-item",
method: "get",
params: params,
});
url: '/system/ext-conf/get-item',
method: 'get',
params: params
})
}
export function getDefaultItem(params) {
export function getDefaultItem(params: any) {
return axios({
url: "/system/ext-conf/get-default-item",
method: "get",
params: params,
});
url: '/system/ext-conf/get-default-item',
method: 'get',
params: params
})
}
export function saveItem(params) {
export function saveItem(params: any) {
return axios({
url: "/system/ext-conf/save-item",
method: "post",
data: params,
});
url: '/system/ext-conf/save-item',
method: 'post',
data: params
})
}
export function addItem(params) {
export function addItem(params: any) {
return axios({
url: "/system/ext-conf/add-item",
method: "get",
params: params,
});
url: '/system/ext-conf/add-item',
method: 'get',
params: params
})
}

View File

@ -16,7 +16,7 @@ external.interceptors.response.use(
}
);
export function executionRequest(url, param) {
export function executionRequest(url:string, param:any) {
return external({
url: url,
method: "get",

View File

@ -1,92 +1,92 @@
import axios from "@/api/config";
import axios from '@/api/config'
// 文件列表
export function fileStorageList(params) {
export function fileStorageList(params: any) {
return axios({
url: "/file-storage/list",
method: "post",
data: params,
});
url: '/file-storage/list',
method: 'post',
data: params
})
}
export function uploadFile(formData) {
return axios({
url: "/file-storage/upload-sharding",
url: '/file-storage/upload-sharding',
headers: {
"Content-Type": "multipart/form-data;charset=UTF-8",
loading: "no",
'Content-Type': 'multipart/form-data;charset=UTF-8',
loading: 'no'
},
method: "post",
method: 'post',
// 0 表示无超时时间
timeout: 0,
data: formData,
});
data: formData
})
}
export function uploadFileMerge(params) {
export function uploadFileMerge(params: any) {
return axios({
url: "/file-storage/upload-sharding-merge",
method: "post",
url: '/file-storage/upload-sharding-merge',
method: 'post',
data: params,
// 0 表示无超时时间
timeout: 0,
});
timeout: 0
})
}
// 修改文件
export function fileEdit(params) {
export function fileEdit(params: any) {
return axios({
url: "/file-storage/edit",
method: "post",
data: params,
});
url: '/file-storage/edit',
method: 'post',
data: params
})
}
// 下载远程文件
export function remoteDownload(params) {
export function remoteDownload(params: any) {
return axios({
url: "/file-storage/remote-download",
method: "post",
data: params,
});
url: '/file-storage/remote-download',
method: 'post',
data: params
})
}
// 判断文件是否存在
export function hasFile(params) {
export function hasFile(params: any) {
return axios({
url: "/file-storage/has-file",
method: "get",
params: params,
});
url: '/file-storage/has-file',
method: 'get',
params: params
})
}
// 判断文件是否存在
export function delFile(params) {
export function delFile(params: any) {
return axios({
url: "/file-storage/del",
method: "get",
params: params,
});
url: '/file-storage/del',
method: 'get',
params: params
})
}
// 下载 url
export function triggerUrl(params) {
export function triggerUrl(params: any) {
return axios({
url: "/file-storage/trigger-url",
method: "get",
params: params,
});
url: '/file-storage/trigger-url',
method: 'get',
params: params
})
}
export const sourceMap = {
0: "上传",
1: "构建",
2: "下载",
3: "证书",
};
0: '上传',
1: '构建',
2: '下载',
3: '证书'
}
export const statusMap = {
0: "下载中",
1: "下载成功",
2: "下载异常",
};
0: '下载中',
1: '下载成功',
2: '下载异常'
}

View File

@ -1,79 +1,79 @@
import axios from "@/api/config";
import axios from '@/api/config'
// 任务列表
export function fileReleaseTaskLog(params) {
export function fileReleaseTaskLog(params: any) {
return axios({
url: "/file-storage/release-task/list",
method: "post",
data: params,
});
url: '/file-storage/release-task/list',
method: 'post',
data: params
})
}
// 添加发布任务
export function addReleaseTask(params) {
export function addReleaseTask(params: any) {
return axios({
url: "/file-storage/release-task/add-task",
method: "post",
data: params,
});
url: '/file-storage/release-task/add-task',
method: 'post',
data: params
})
}
// 重新发布任务
export function reReleaseTask(params) {
export function reReleaseTask(params: any) {
return axios({
url: "/file-storage/release-task/re-task",
method: "post",
data: params,
});
url: '/file-storage/release-task/re-task',
method: 'post',
data: params
})
}
// 取消任务
export function cancelReleaseTask(params) {
export function cancelReleaseTask(params: any) {
return axios({
url: "/file-storage/release-task/cancel-task",
method: "get",
params: params,
});
url: '/file-storage/release-task/cancel-task',
method: 'get',
params: params
})
}
// 删除任务
export function deleteReleaseTask(params) {
export function deleteReleaseTask(params: any) {
return axios({
url: "/file-storage/release-task/delete",
method: "get",
params: params,
});
url: '/file-storage/release-task/delete',
method: 'get',
params: params
})
}
// 任务详情
export function taskDetails(params) {
export function taskDetails(params: any) {
return axios({
url: "/file-storage/release-task/details",
method: "get",
params: params,
});
url: '/file-storage/release-task/details',
method: 'get',
params: params
})
}
export function taskLogInfoList(params) {
export function taskLogInfoList(params: any) {
return axios({
url: "/file-storage/release-task/log-list",
method: "get",
url: '/file-storage/release-task/log-list',
method: 'get',
params: params,
headers: {
loading: "no",
},
});
loading: 'no'
}
})
}
export const statusMap = {
0: "等待开始",
1: "进行中",
2: "任务结束",
3: "发布失败",
4: "取消任务",
};
0: '等待开始',
1: '进行中',
2: '任务结束',
3: '发布失败',
4: '取消任务'
}
export const taskTypeMap = {
0: "SSH",
1: "节点",
};
0: 'SSH',
1: '节点'
}

View File

@ -1,14 +1,14 @@
import axios from "./config";
import axios from './config'
// 检查是否需要初始化系统
export function checkSystem() {
return axios({
url: "/check-system",
method: "post",
url: '/check-system',
method: 'post',
headers: {
loading: "no",
},
});
loading: 'no'
}
})
}
/**
@ -18,10 +18,10 @@ export function checkSystem() {
* userPwd: 初始密码
* } params
*/
export function initInstall(params) {
export function initInstall(params: any) {
return axios({
url: "/install_submit.json",
method: "post",
data: params,
});
url: '/install_submit.json',
method: 'post',
data: params
})
}

View File

@ -1,12 +1,12 @@
import axios from "./config";
import axios from './config'
// 日志搜索列表
export function getLogReadList(params) {
export function getLogReadList(params: any) {
return axios({
url: "/log-read/list",
method: "post",
data: params,
});
url: '/log-read/list',
method: 'post',
data: params
})
}
/**
@ -18,26 +18,26 @@ export function getLogReadList(params) {
*
* } params
*/
export function editLogRead(params) {
export function editLogRead(params: any) {
return axios({
url: "/log-read/save.json",
method: "post",
url: '/log-read/save.json',
method: 'post',
data: params,
headers: {
"Content-Type": "application/json",
},
});
'Content-Type': 'application/json'
}
})
}
export function updateCache(params) {
export function updateCache(params: any) {
return axios({
url: "/log-read/update-cache.json",
method: "post",
url: '/log-read/update-cache.json',
method: 'post',
data: params,
headers: {
"Content-Type": "application/json",
},
});
'Content-Type': 'application/json'
}
})
}
/**
@ -46,8 +46,8 @@ export function updateCache(params) {
*/
export function deleteLogRead(id) {
return axios({
url: "/log-read/del.json",
method: "post",
data: { id },
});
url: '/log-read/del.json',
method: 'post',
data: { id }
})
}

View File

@ -20,7 +20,7 @@ export function getSystemMenu() {
*
* @param {String} nodeId
*/
export function getNodeMenu(nodeId) {
export function getNodeMenu(nodeId:string) {
return axios({
url: "/menus_data.json",
method: "post",

View File

@ -1,12 +1,12 @@
import axios from "./config";
import axios from './config'
// 监控列表
export function getMonitorList(params) {
export function getMonitorList(params: any) {
return axios({
url: "/monitor/getMonitorList",
method: "post",
data: params,
});
url: '/monitor/getMonitorList',
method: 'post',
data: params
})
}
/**
@ -21,12 +21,12 @@ export function getMonitorList(params) {
* notifyUser: 报警联系人
* } params
*/
export function editMonitor(params) {
export function editMonitor(params: any) {
return axios({
url: "/monitor/updateMonitor",
method: "post",
data: params,
});
url: '/monitor/updateMonitor',
method: 'post',
data: params
})
}
/**
@ -37,12 +37,12 @@ export function editMonitor(params) {
* type: status | restart
* } params
*/
export function changeMonitorStatus(params) {
export function changeMonitorStatus(params: any) {
return axios({
url: "/monitor/changeStatus",
method: "post",
data: params,
});
url: '/monitor/changeStatus',
method: 'post',
data: params
})
}
/**
@ -51,10 +51,10 @@ export function changeMonitorStatus(params) {
*/
export function deleteMonitor(id) {
return axios({
url: "/monitor/deleteMonitor",
method: "post",
data: { id },
});
url: '/monitor/deleteMonitor',
method: 'post',
data: { id }
})
}
/**
@ -66,12 +66,12 @@ export function deleteMonitor(id) {
* notifyStatus: 通知状态
* } params
*/
export function getMonitorLogList(params) {
export function getMonitorLogList(params: any) {
return axios({
url: "/monitor/list_data.json",
method: "post",
data: params,
});
url: '/monitor/list_data.json',
method: 'post',
data: params
})
}
/**
@ -79,9 +79,9 @@ export function getMonitorLogList(params) {
*/
export function getMonitorOperateLogList() {
return axios({
url: "/monitor_user_opt/list_data",
method: "post",
});
url: '/monitor_user_opt/list_data',
method: 'post'
})
}
/**
@ -90,9 +90,9 @@ export function getMonitorOperateLogList() {
*/
export function getMonitorOperateTypeList() {
return axios({
url: "/monitor_user_opt/type_data",
method: "post",
});
url: '/monitor_user_opt/type_data',
method: 'post'
})
}
/**
@ -107,12 +107,12 @@ export function getMonitorOperateTypeList() {
* } params
* @returns
*/
export function editMonitorOperate(params) {
export function editMonitorOperate(params: any) {
return axios({
url: "/monitor_user_opt/update",
method: "post",
data: params,
});
url: '/monitor_user_opt/update',
method: 'post',
data: params
})
}
/**
@ -122,15 +122,15 @@ export function editMonitorOperate(params) {
*/
export function deleteMonitorOperate(id) {
return axios({
url: "/monitor_user_opt/delete",
method: "post",
data: { id },
});
url: '/monitor_user_opt/delete',
method: 'post',
data: { id }
})
}
export const notifyStyle = {
0: "钉钉",
1: "邮箱",
2: "企业微信",
3: "webhook",
};
0: '钉钉',
1: '邮箱',
2: '企业微信',
3: 'webhook'
}

View File

@ -1,17 +1,17 @@
import axios from "./config";
import { loadRouterBase } from "./config";
import axios from './config'
import { loadRouterBase } from './config'
/**
* Nginx
* @param {
* nodeId: 节点 ID
* } params
*/
export function getNginxDirectoryList(params) {
export function getNginxDirectoryList(params: any) {
return axios({
url: "/node/system/nginx/tree.json",
method: "post",
data: params,
});
url: '/node/system/nginx/tree.json',
method: 'post',
data: params
})
}
/**
@ -22,12 +22,12 @@ export function getNginxDirectoryList(params) {
* name: 子级目录
* } params
*/
export function getNginxFileList(params) {
export function getNginxFileList(params: any) {
return axios({
url: "/node/system/nginx/list_data.json",
method: "post",
data: params,
});
url: '/node/system/nginx/list_data.json',
method: 'post',
data: params
})
}
/**
@ -40,12 +40,12 @@ export function getNginxFileList(params) {
* context: 内容
* } params
*/
export function editNginxConfig(params) {
export function editNginxConfig(params: any) {
return axios({
url: "/node/system/nginx/updateNgx",
method: "post",
data: params,
});
url: '/node/system/nginx/updateNgx',
method: 'post',
data: params
})
}
/**
@ -56,12 +56,12 @@ export function editNginxConfig(params) {
* name: 文件名称
* } params
*/
export function deleteNginxConfig(params) {
export function deleteNginxConfig(params: any) {
return axios({
url: "/node/system/nginx/delete",
method: "post",
data: params,
});
url: '/node/system/nginx/delete',
method: 'post',
data: params
})
}
/**
@ -70,12 +70,12 @@ export function deleteNginxConfig(params) {
* nodeId: 节点 ID
* } params
*/
export function loadNginxWhiteList(params) {
export function loadNginxWhiteList(params: any) {
return axios({
url: "/node/system/nginx/white-list",
method: "post",
data: params,
});
url: '/node/system/nginx/white-list',
method: 'post',
data: params
})
}
/**
@ -86,12 +86,12 @@ export function loadNginxWhiteList(params) {
* name: 文件名称
* } params
*/
export function loadNginxConfig(params) {
export function loadNginxConfig(params: any) {
return axios({
url: "/node/system/nginx/load-config",
method: "post",
data: params,
});
url: '/node/system/nginx/load-config',
method: 'post',
data: params
})
}
/**
@ -100,12 +100,12 @@ export function loadNginxConfig(params) {
* nodeId: 节点 ID
* } params
*/
export function loadNginxData(params) {
export function loadNginxData(params: any) {
return axios({
url: "/node/system/nginx/status",
method: "post",
data: params,
});
url: '/node/system/nginx/status',
method: 'post',
data: params
})
}
/**
@ -115,12 +115,12 @@ export function loadNginxData(params) {
* command: 命令 {open || reload || stop}
* } params
*/
export function doNginxCommand(params) {
export function doNginxCommand(params: any) {
return axios({
url: `/node/system/nginx/${params.command}`,
method: "post",
data: params,
});
method: 'post',
data: params
})
}
/**
@ -130,12 +130,12 @@ export function doNginxCommand(params) {
* name: Nginx
* } params
*/
export function editNginxServerName(params) {
export function editNginxServerName(params: any) {
return axios({
url: "/node/system/nginx/updateConf",
method: "post",
data: params,
});
url: '/node/system/nginx/updateConf',
method: 'post',
data: params
})
}
/***************************** */
@ -146,12 +146,12 @@ export function editNginxServerName(params) {
* nodeId: 节点 ID
* } params
*/
export function getCertList(params) {
export function getCertList(params: any) {
return axios({
url: "/node/system/certificate/getCertList",
method: "post",
data: params,
});
url: '/node/system/certificate/getCertList',
method: 'post',
data: params
})
}
/**
@ -161,12 +161,12 @@ export function getCertList(params) {
* id: 证书 ID
* } params
*/
export function deleteCert(params) {
export function deleteCert(params: any) {
return axios({
url: "/node/system/certificate/delete",
method: "post",
data: params,
});
url: '/node/system/certificate/delete',
method: 'post',
data: params
})
}
/**
@ -176,6 +176,6 @@ export function deleteCert(params) {
* id: 证书 ID
* } params
*/
export function downloadCert(params) {
return loadRouterBase("/node/system/certificate/export", params);
export function downloadCert(params: any) {
return loadRouterBase('/node/system/certificate/export', params)
}

View File

@ -1,4 +1,4 @@
import axios from "./config";
import axios from './config'
/************************** */
@ -6,53 +6,53 @@ import axios from "./config";
* script
* @param {String} nodeId ID
*/
export function getScriptList(params) {
export function getScriptList(params: any) {
return axios({
url: "/node/script/list",
method: "post",
data: params,
});
url: '/node/script/list',
method: 'post',
data: params
})
}
/**
* script
*/
export function getScriptListAll(params) {
export function getScriptListAll(params: any) {
return axios({
url: "/node/script/list_all",
method: "post",
data: params,
});
url: '/node/script/list_all',
method: 'post',
data: params
})
}
// 脚本模版日志列表
export function getScriptLogList(params) {
export function getScriptLogList(params: any) {
return axios({
url: "/node/script_log/list",
method: "post",
data: params,
});
url: '/node/script_log/list',
method: 'post',
data: params
})
}
// 删除执行记录
export function scriptDel(params) {
export function scriptDel(params: any) {
return axios({
url: "/node/script_log/del",
method: "post",
data: params,
});
url: '/node/script_log/del',
method: 'post',
data: params
})
}
//执行记录 详情
export function scriptLog(params) {
export function scriptLog(params: any) {
return axios({
url: "/node/script_log/log",
method: "post",
url: '/node/script_log/log',
method: 'post',
data: params,
headers: {
tip: "no",
},
});
tip: 'no'
}
})
}
/**
@ -64,45 +64,45 @@ export function scriptLog(params) {
* params.name
* params.context
*/
export function editScript(params) {
export function editScript(params: any) {
return axios({
url: "/node/script/save.json",
method: "post",
data: params,
});
url: '/node/script/save.json',
method: 'post',
data: params
})
}
export function itemScript(params) {
export function itemScript(params: any) {
return axios({
url: "/node/script/item.json",
method: "get",
params: params,
});
url: '/node/script/item.json',
method: 'get',
params: params
})
}
export function syncScript(params) {
export function syncScript(params: any) {
return axios({
url: "/node/script/sync",
method: "get",
params: params,
});
url: '/node/script/sync',
method: 'get',
params: params
})
}
export const triggerExecTypeMap = {
0: "手动",
1: "自动",
2: "触发器",
};
0: '手动',
1: '自动',
2: '触发器'
}
/**
*
* @param {*} id
*/
export function getTriggerUrl(data) {
export function getTriggerUrl(data: any) {
return axios({
url: "/node/script/trigger-url",
method: "post",
data: data,
});
url: '/node/script/trigger-url',
method: 'post',
data: data
})
}
/**
@ -111,19 +111,19 @@ export function getTriggerUrl(data) {
* params.nodeId ID
* params.id ID
*/
export function deleteScript(params) {
export function deleteScript(params: any) {
return axios({
url: "/node/script/del.json",
method: "post",
data: params,
});
url: '/node/script/del.json',
method: 'post',
data: params
})
}
// 删除节点脚本模版缓存
export function delAllCache() {
return axios({
url: "/node/script/clear_all",
method: "get",
params: {},
});
url: '/node/script/clear_all',
method: 'get',
params: {}
})
}

View File

@ -1,5 +1,5 @@
import axios from "./config";
import { loadRouterBase } from "./config";
import axios from './config'
import { loadRouterBase } from './config'
/**
*
@ -8,23 +8,23 @@ import { loadRouterBase } from "./config";
* id: 项目ID
* }
*/
export function listBackup(params) {
export function listBackup(params: any) {
return axios({
url: "/node/manage/file/list-backup",
method: "post",
data: params,
});
url: '/node/manage/file/list-backup',
method: 'post',
data: params
})
}
export function backupFileList(params) {
export function backupFileList(params: any) {
return axios({
url: "/node/manage/file/backup-item-files",
method: "post",
url: '/node/manage/file/backup-item-files',
method: 'post',
headers: {
loading: "no",
loading: 'no'
},
data: params,
});
data: params
})
}
/**
@ -36,8 +36,8 @@ export function backupFileList(params) {
* filename: 文件名称
* } params
*/
export function backupDownloadProjectFile(params) {
return loadRouterBase("/node/manage/file/backup-download", params);
export function backupDownloadProjectFile(params: any) {
return loadRouterBase('/node/manage/file/backup-download', params)
}
/**
@ -50,12 +50,12 @@ export function backupDownloadProjectFile(params) {
*
* } params
*/
export function backupDeleteProjectFile(params) {
export function backupDeleteProjectFile(params: any) {
return axios({
url: "/node/manage/file/backup-delete",
method: "post",
data: params,
});
url: '/node/manage/file/backup-delete',
method: 'post',
data: params
})
}
/**
@ -68,10 +68,10 @@ export function backupDeleteProjectFile(params) {
*
* } params
*/
export function backupRecoverProjectFile(params) {
export function backupRecoverProjectFile(params: any) {
return axios({
url: "/node/manage/file/backup-recover",
method: "post",
data: params,
});
url: '/node/manage/file/backup-recover',
method: 'post',
data: params
})
}

View File

@ -1,8 +1,8 @@
/**
* api
*/
import axios from "./config";
import { loadRouterBase } from "./config";
import axios from './config'
import { loadRouterBase } from './config'
/**
*
@ -11,12 +11,12 @@ import { loadRouterBase } from "./config";
* group: 分组名称
* }
*/
export function getProjectList(params) {
export function getProjectList(params: any) {
return axios({
url: "/node/manage/get_project_info",
method: "post",
data: params,
});
url: '/node/manage/get_project_info',
method: 'post',
data: params
})
}
/**
@ -26,17 +26,17 @@ export function getProjectList(params) {
* ids: 项目 ID ["id1", "id2"]
* }
*/
export function getRuningProjectInfo(params, noTip) {
export function getRuningProjectInfo(params:any, noTip:string) {
return axios({
url: "/node/manage/getProjectPort",
method: "post",
url: '/node/manage/getProjectPort',
method: 'post',
data: params,
timeout: 0,
headers: {
loading: "no",
tip: noTip ? "no" : "",
},
});
loading: 'no',
tip: noTip ? 'no' : ''
}
})
}
/**
@ -44,16 +44,16 @@ export function getRuningProjectInfo(params, noTip) {
* @param {*} params
* @returns
*/
export function getRuningProjectCopyInfo(params) {
export function getRuningProjectCopyInfo(params: any) {
return axios({
url: "/node/manage/getProjectCopyPort",
method: "post",
url: '/node/manage/getProjectCopyPort',
method: 'post',
data: params,
timeout: 0,
headers: {
loading: "no",
},
});
loading: 'no'
}
})
}
/**
@ -63,24 +63,24 @@ export function getRuningProjectCopyInfo(params) {
* id: 项目 ID
* } params
*/
export function getProjectData(params) {
export function getProjectData(params: any) {
return axios({
url: "/node/manage/getProjectData.json",
method: "post",
data: params,
});
url: '/node/manage/getProjectData.json',
method: 'post',
data: params
})
}
/**
*
* @param {String} nodeId ID
*/
export function getProjectAccessList(nodeId) {
export function getProjectAccessList(nodeId:string) {
return axios({
url: "/node/manage/project-access-list",
method: "post",
data: { nodeId },
});
url: '/node/manage/project-access-list',
method: 'post',
data: { nodeId }
})
}
/**
@ -101,7 +101,7 @@ export function getProjectAccessList(nodeId) {
* args_xxn: 副本 n args
* }
*/
export function editProject(params, replicaParams) {
export function editProject(params:any, replicaParams:any) {
const data = {
nodeId: params.nodeId,
id: params.id,
@ -119,13 +119,13 @@ export function editProject(params, replicaParams) {
logPath: params.logPath,
autoStart: params.autoStart,
dslContent: params.dslContent,
...replicaParams,
};
...replicaParams
}
return axios({
url: "/node/manage/saveProject",
method: "post",
data,
});
url: '/node/manage/saveProject',
method: 'post',
data
})
}
/**
@ -136,20 +136,20 @@ export function editProject(params, replicaParams) {
* copyId: copyId
* } params
*/
export function deleteProject(params) {
export function deleteProject(params: any) {
return axios({
url: "/node/manage/deleteProject",
method: "post",
data: params,
});
url: '/node/manage/deleteProject',
method: 'post',
data: params
})
}
export function releaseOutgiving(params) {
export function releaseOutgiving(params: any) {
return axios({
url: "/node/manage/release-outgiving",
method: "post",
data: params,
});
url: '/node/manage/release-outgiving',
method: 'post',
data: params
})
}
/**
@ -159,15 +159,15 @@ export function releaseOutgiving(params) {
* id: 项目 ID
* } params
*/
export function getFileList(params) {
export function getFileList(params: any) {
return axios({
url: "/node/manage/file/getFileList",
method: "post",
url: '/node/manage/file/getFileList',
method: 'post',
headers: {
loading: "no",
loading: 'no'
},
data: params,
});
data: params
})
}
/**
@ -179,8 +179,8 @@ export function getFileList(params) {
* filename: 文件名称
* } params
*/
export function downloadProjectFile(params) {
return loadRouterBase("/node/manage/file/download", params);
export function downloadProjectFile(params: any) {
return loadRouterBase('/node/manage/file/download', params)
// return axios({
// url: "/node/manage/file/download",
// method: "get",
@ -190,29 +190,29 @@ export function downloadProjectFile(params) {
// });
}
export function readFile(formData) {
export function readFile(formData:any) {
return axios({
url: "/node/manage/file/read_file",
method: "get",
params: formData,
});
url: '/node/manage/file/read_file',
method: 'get',
params: formData
})
}
export function remoteDownload(formData) {
export function remoteDownload(formData:any) {
return axios({
url: "/node/manage/file/remote_download",
method: "get",
url: '/node/manage/file/remote_download',
method: 'get',
timeout: 0,
params: formData,
});
params: formData
})
}
export function updateFile(formData) {
export function updateFile(formData:any) {
return axios({
url: "/node/manage/file/update_config_file",
method: "post",
data: formData,
});
url: '/node/manage/file/update_config_file',
method: 'post',
data: formData
})
}
/**
@ -226,18 +226,18 @@ export function updateFile(formData) {
* clearType: {clear: 清空文件夹, noClear: 不清空} *
* } formData
*/
export function uploadProjectFile(formData) {
export function uploadProjectFile(formData:FormData) {
return axios({
url: "/node/manage/file/upload-sharding",
url: '/node/manage/file/upload-sharding',
headers: {
"Content-Type": "multipart/form-data;charset=UTF-8",
loading: "no",
'Content-Type': 'multipart/form-data;charset=UTF-8',
loading: 'no'
},
method: "post",
method: 'post',
// 0 表示无超时时间
timeout: 0,
data: formData,
});
data: formData
})
}
/**
@ -251,15 +251,15 @@ export function uploadProjectFile(formData) {
* clearType: {clear: 清空文件夹, noClear: 不清空} *
* } formData
*/
export function shardingMerge(formData) {
export function shardingMerge(formData:any) {
return axios({
url: "/node/manage/file/sharding-merge",
url: '/node/manage/file/sharding-merge',
headers: {},
method: "post",
method: 'post',
// 0 表示无超时时间
timeout: 0,
data: formData,
});
data: formData
})
}
/**
@ -272,40 +272,40 @@ export function shardingMerge(formData) {
* type: {clear: 清空, noclear: 不清空} levelName filename
* } params
*/
export function deleteProjectFile(params) {
export function deleteProjectFile(params: any) {
return axios({
url: "/node/manage/file/deleteFile",
method: "post",
data: params,
});
url: '/node/manage/file/deleteFile',
method: 'post',
data: params
})
}
/**
*
* @param {String} nodeId ID
*/
export function getRecoverList(nodeId) {
export function getRecoverList(nodeId:string) {
return axios({
url: "/node/manage/recover/recover-list",
method: "post",
data: { nodeId },
});
url: '/node/manage/recover/recover-list',
method: 'post',
data: { nodeId }
})
}
/**
*
* @param {
* nodeId: 节点 ID
* id: 项目 ID
* } params
*/
export function getRecoverData(params) {
return axios({
url: "/node/manage/recover/data.json",
method: "post",
data: params,
});
}
// /**
// * 获取回收项目信息
// * @param {
// * nodeId: 节点 ID
// * id: 项目 ID
// * } params
// */
// export function getRecoverData(params: any) {
// return axios({
// url: '/node/manage/recover/data.json',
// method: 'post',
// data: params
// })
// }
/**
*
@ -315,15 +315,15 @@ export function getRecoverData(params) {
* copyId: copyId
* } params
*/
export function getProjectLogSize(params) {
export function getProjectLogSize(params: any) {
return axios({
url: "/node/manage/log/logSize",
method: "post",
url: '/node/manage/log/logSize',
method: 'post',
data: params,
headers: {
loading: "no",
},
});
loading: 'no'
}
})
}
/**
@ -334,8 +334,8 @@ export function getProjectLogSize(params) {
* copyId: copyId
* } params
*/
export function downloadProjectLogFile(params) {
return loadRouterBase("/node/manage/log/export.html", params);
export function downloadProjectLogFile(params: any) {
return loadRouterBase('/node/manage/log/export.html', params)
}
/**
@ -345,12 +345,12 @@ export function downloadProjectLogFile(params) {
* id: 项目 ID
* } params
*/
export function getLogBackList(params) {
export function getLogBackList(params: any) {
return axios({
url: "/node/manage/log/log-back-list",
method: "post",
data: params,
});
url: '/node/manage/log/log-back-list',
method: 'post',
data: params
})
}
/**
@ -362,8 +362,8 @@ export function getLogBackList(params) {
* key: 文件名
* } params
*/
export function downloadProjectLogBackFile(params) {
return loadRouterBase("/node/manage/log/logBack_download", params);
export function downloadProjectLogBackFile(params: any) {
return loadRouterBase('/node/manage/log/logBack_download', params)
}
/**
@ -375,12 +375,12 @@ export function downloadProjectLogBackFile(params) {
* name: 文件名
* } params
*/
export function deleteProjectLogBackFile(params) {
export function deleteProjectLogBackFile(params: any) {
return axios({
url: "/node/manage/log/logBack_delete",
method: "post",
data: params,
});
url: '/node/manage/log/logBack_delete',
method: 'post',
data: params
})
}
/**
@ -391,13 +391,13 @@ export function deleteProjectLogBackFile(params) {
* copyId: copyId
* } params
*/
export function getInternalData(params) {
export function getInternalData(params: any) {
return axios({
url: "/node/manage/getInternalData",
method: "post",
url: '/node/manage/getInternalData',
method: 'post',
timeout: 0,
data: params,
});
data: params
})
}
// /**
@ -406,7 +406,7 @@ export function getInternalData(params) {
// * nodeId: 节点 ID
// * } params
// */
// export function getThreadInfo(params) {
// export function getThreadInfo(params:any) {
// return axios({
// url: "/node/manage/threadInfos",
// method: "post",
@ -423,7 +423,7 @@ export function getInternalData(params) {
// * copyId: copyId
// * } params
// */
// export function exportStack(params) {
// export function exportStack(params:any) {
// return axios({
// url: "/node/manage/stack",
// method: "get",
@ -441,7 +441,7 @@ export function getInternalData(params) {
// * copyId: copyId
// * } params
// */
// export function exportRam(params) {
// export function exportRam(params:any) {
// return axios({
// url: "/node/manage/ram",
// method: "get",
@ -458,12 +458,12 @@ export function getInternalData(params) {
* id: 项目 ID
* } params
*/
export function getProjectReplicaList(params) {
export function getProjectReplicaList(params: any) {
return axios({
url: "/node/manage/project_copy_list",
method: "post",
data: params,
});
url: '/node/manage/project_copy_list',
method: 'post',
data: params
})
}
// /**
@ -473,7 +473,7 @@ export function getProjectReplicaList(params) {
// * newLib: 新目录地址
// * } params
// */
// export function nodeJudgeLibExist(params) {
// export function nodeJudgeLibExist(params:any) {
// return axios({
// url: "/node/manage/judge_lib.json",
// method: "post",
@ -492,16 +492,16 @@ export function getProjectReplicaList(params) {
* copyId: 副本id
* } params
*/
export function restartProject(params) {
export function restartProject(params: any) {
return axios({
url: "/node/manage/restart",
method: "post",
url: '/node/manage/restart',
method: 'post',
data: params,
headers: {
loading: "no",
tip: "no",
},
});
loading: 'no',
tip: 'no'
}
})
}
/**
@ -512,16 +512,16 @@ export function restartProject(params) {
* copyId: 副本id
* } params
*/
export function startProject(params) {
export function startProject(params: any) {
return axios({
url: "/node/manage/start",
method: "post",
url: '/node/manage/start',
method: 'post',
data: params,
headers: {
loading: "no",
tip: "no",
},
});
loading: 'no',
tip: 'no'
}
})
}
/**
@ -532,28 +532,28 @@ export function startProject(params) {
* copyId: 副本id
* } params
*/
export function stopProject(params) {
export function stopProject(params: any) {
return axios({
url: "/node/manage/stop",
method: "post",
url: '/node/manage/stop',
method: 'post',
data: params,
headers: {
loading: "no",
tip: "no",
},
});
loading: 'no',
tip: 'no'
}
})
}
/**
*
* @param {*} id
*/
export function getProjectTriggerUrl(data) {
export function getProjectTriggerUrl(data:any) {
return axios({
url: "/node/project-trigger-url",
method: "post",
data: data,
});
url: '/node/project-trigger-url',
method: 'post',
data: data
})
}
/**
@ -561,12 +561,12 @@ export function getProjectTriggerUrl(data) {
* @param params
* @returns {id, path, name,unFolder} params x
*/
export function newFileFolder(params) {
export function newFileFolder(params: any) {
return axios({
url: "/node/manage/file/new_file_folder",
method: "get",
params,
});
url: '/node/manage/file/new_file_folder',
method: 'get',
params
})
}
/**
@ -574,12 +574,12 @@ export function newFileFolder(params) {
* @param params
* @returns {id, levelName, filename,newname} params x
*/
export function renameFileFolder(params) {
export function renameFileFolder(params: any) {
return axios({
url: "/node/manage/file/rename_file_folder",
method: "get",
params,
});
url: '/node/manage/file/rename_file_folder',
method: 'get',
params
})
}
/**
@ -587,51 +587,51 @@ export function renameFileFolder(params) {
*/
export function getProjectGroupAll() {
return axios({
url: "/node/list-project-group-all",
method: "get",
});
url: '/node/list-project-group-all',
method: 'get'
})
}
/**
*
*/
export const runModeList = ["Dsl", "ClassPath", "Jar", "JarWar", "JavaExtDirsCp", "File"];
export const runModeList = ['Dsl', 'ClassPath', 'Jar', 'JarWar', 'JavaExtDirsCp', 'File']
/**
* java
*/
export const javaModes = ["ClassPath", "Jar", "JarWar", "JavaExtDirsCp"];
export const javaModes = ['ClassPath', 'Jar', 'JarWar', 'JavaExtDirsCp']
/**
*
*/
export const noFileModes = ["ClassPath", "Jar", "JarWar", "JavaExtDirsCp", "Dsl"];
export const noFileModes = ['ClassPath', 'Jar', 'JarWar', 'JavaExtDirsCp', 'Dsl']
/*
*
*
*/
export function importTemplate(data) {
return loadRouterBase("/node/manage/import-template", data);
export function importTemplate(data:any) {
return loadRouterBase('/node/manage/import-template', data)
}
/*
*
*
*/
export function exportData(data) {
return loadRouterBase("/node/manage/export-data", data);
export function exportData(data:any) {
return loadRouterBase('/node/manage/export-data', data)
}
// 导入数据
export function importData(formData) {
export function importData(formData:FormData) {
return axios({
url: "/node/manage/import-data",
url: '/node/manage/import-data',
headers: {
"Content-Type": "multipart/form-data;charset=UTF-8",
'Content-Type': 'multipart/form-data;charset=UTF-8'
},
method: "post",
method: 'post',
// 0 表示无超时时间
timeout: 0,
data: formData,
});
data: formData
})
}

View File

@ -3,38 +3,38 @@ import { parseTime, formatPercent2, renderSize, formatDuration } from '@/utils/c
// import echarts from "echarts";
// 获取机器信息
export function machineInfo(params) {
export function machineInfo(params: any) {
return axios({
url: '/node/machine-info',
method: 'get',
params: params,
headers: {
loading: 'no',
},
loading: 'no'
}
})
}
// 机器文件系统
export function machineDiskInfo(params) {
export function machineDiskInfo(params: any) {
return axios({
url: '/node/disk-info',
method: 'get',
params,
headers: {
loading: 'no',
},
loading: 'no'
}
})
}
// 机器硬件硬盘
export function machineHwDiskInfo(params) {
export function machineHwDiskInfo(params: any) {
return axios({
url: '/node/hw-disk-info',
method: 'get',
params,
headers: {
loading: 'no',
},
loading: 'no'
}
})
}
@ -43,7 +43,7 @@ const defaultData = {
// text: "系统 Top 监控",
},
tooltip: {
trigger: 'axis',
trigger: 'axis'
},
legend: {
// data: legends,
@ -53,11 +53,11 @@ const defaultData = {
left: '1%',
right: '2%',
bottom: '1%',
containLabel: true,
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
boundaryGap: false
// data: scales,
},
calculable: true,
@ -69,7 +69,7 @@ const defaultData = {
// },
// max: 100,
// },
dataZoom: [{ type: 'inside' }, { type: 'slider' }],
dataZoom: [{ type: 'inside' }, { type: 'slider' }]
// series: series,
}
@ -78,42 +78,42 @@ const defaultData = {
* @param { JSON } data
* @returns
*/
export function generateNodeTopChart(data) {
export function generateNodeTopChart(params: any) {
const cpuItem = {
name: 'cpu占用',
type: 'line',
data: [],
showSymbol: false,
// 设置折线为曲线
smooth: true,
smooth: true
}
const diskItem = {
name: '磁盘占用',
type: 'line',
data: [],
showSymbol: false,
smooth: true,
smooth: true
}
const memoryItem = {
name: '内存占用',
type: 'line',
data: [],
showSymbol: false,
smooth: true,
smooth: true
}
const virtualMemory = {
name: '虚拟内存占用',
type: 'line',
data: [],
showSymbol: false,
smooth: true,
smooth: true
}
const swapMemory = {
name: '交互内存占用',
type: 'line',
data: [],
showSymbol: false,
smooth: true,
smooth: true
}
const scales = []
for (var i = data.length - 1; i >= 0; i--) {
@ -136,31 +136,31 @@ export function generateNodeTopChart(data) {
// 指定图表的配置项和数据
return Object.assign({}, defaultData, {
legend: {
data: legends,
data: legends
},
xAxis: {
data: scales,
data: scales
},
yAxis: {
type: 'value',
axisLabel: {
// 设置y轴数值为%
formatter: '{value} %',
formatter: '{value} %'
},
max: 100,
max: 100
},
tooltip: {
trigger: 'axis',
show: true,
formatter: function (params) {
formatter: function (params: any) {
var html = params[0].name + '<br>'
for (var i = 0; i < params.length; i++) {
html += params[i].marker + params[i].seriesName + ':' + formatPercent2(params[i].value) + '<br>'
}
return html
},
}
},
series: series,
series: series
})
}
@ -169,21 +169,21 @@ export function generateNodeTopChart(data) {
* @param { JSON } data
* @returns
*/
export function generateNodeNetChart(data) {
export function generateNodeNetChart(params: any) {
const rxItem = {
name: '接收',
type: 'line',
data: [],
showSymbol: false,
// 设置折线为曲线
smooth: true,
smooth: true
}
const txItem = {
name: '发送',
type: 'line',
data: [],
showSymbol: false,
smooth: true,
smooth: true
}
const scales = []
for (var i = data.length - 1; i >= 0; i--) {
@ -203,10 +203,10 @@ export function generateNodeNetChart(data) {
// 指定图表的配置项和数据
return Object.assign({}, defaultData, {
legend: {
data: legends,
data: legends
},
xAxis: {
data: scales,
data: scales
},
yAxis: {
type: 'value',
@ -215,21 +215,21 @@ export function generateNodeNetChart(data) {
// formatter: "{value} bit/s",
formatter: (value) => {
return renderSize(value)
},
},
}
}
},
tooltip: {
trigger: 'axis',
show: true,
formatter: function (params) {
formatter: function (params: any) {
var html = params[0].name + '<br>'
for (var i = 0; i < params.length; i++) {
html += params[i].marker + params[i].seriesName + ':' + renderSize(params[i].value) + '/s <br>'
}
return html
},
}
},
series: series,
series: series
})
}
@ -238,14 +238,14 @@ export function generateNodeNetChart(data) {
* @param { JSON } data
* @returns
*/
export function generateNodeNetworkTimeChart(data) {
export function generateNodeNetworkTimeChart(params: any) {
const dataArray = {
name: '网络延迟',
type: 'line',
data: [],
showSymbol: false,
// 设置折线为曲线
smooth: true,
smooth: true
}
const scales = []
for (var i = data.length - 1; i >= 0; i--) {
@ -262,10 +262,10 @@ export function generateNodeNetworkTimeChart(data) {
// 指定图表的配置项和数据
return Object.assign({}, defaultData, {
legend: {
data: legends,
data: legends
},
xAxis: {
data: scales,
data: scales
},
yAxis: {
type: 'value',
@ -273,21 +273,21 @@ export function generateNodeNetworkTimeChart(data) {
// formatter: "{value} ms",
formatter: (value) => {
return formatDuration(value)
},
},
}
}
},
tooltip: {
trigger: 'axis',
show: true,
formatter: function (params) {
formatter: function (params: any) {
var html = params[0].name + '<br>'
for (var i = 0; i < params.length; i++) {
html += params[i].marker + params[i].seriesName + ':' + formatDuration(params[i].value) + ' <br>'
}
return html
},
}
},
series: series,
series: series
})
}
@ -319,13 +319,13 @@ export function drawChart(data, domId, parseFn) {
// };
// 机器网络
export function machineNetworkInterfaces(params) {
export function machineNetworkInterfaces(params: any) {
return axios({
url: '/node/network-interfaces',
method: 'get',
params,
headers: {
loading: 'no',
},
loading: 'no'
}
})
}

View File

@ -1,15 +1,15 @@
import axios from "./config";
import axios from './config'
/**
* white list data
* @param {nodeId} nodeId
*/
export function getWhiteList(data) {
export function getWhiteList(data: any) {
return axios({
url: "/node/system/white-list",
method: "post",
data: data,
});
url: '/node/system/white-list',
method: 'post',
data: data
})
}
/**
@ -21,10 +21,10 @@ export function getWhiteList(data) {
* nginx: Nginx
* } params
*/
export function editWhiteList(params) {
export function editWhiteList(params: any) {
return axios({
url: "/node/system/whitelistDirectory_submit",
method: "post",
data: params,
});
url: '/node/system/whitelistDirectory_submit',
method: 'post',
data: params
})
}

View File

@ -1,46 +1,46 @@
import axios from "./config";
import axios from './config'
// node 列表
export function getNodeList(params) {
export function getNodeList(params: any) {
return axios({
url: "/node/list_data.json",
method: "post",
params: params,
});
url: '/node/list_data.json',
method: 'post',
params: params
})
}
// node 列表 all
export function getNodeListAll() {
return axios({
url: "/node/list_data_all.json",
method: "get",
});
url: '/node/list_data_all.json',
method: 'get'
})
}
// node 列表 根据 工作空间ID
export function getNodeListByWorkspace(params) {
export function getNodeListByWorkspace(params: any) {
return axios({
url: "/node/list_data_by_workspace_id.json",
method: "get",
params: params,
});
url: '/node/list_data_by_workspace_id.json',
method: 'get',
params: params
})
}
// node group all
export function getNodeGroupAll() {
return axios({
url: "/node/list_group_all.json",
method: "get",
});
url: '/node/list_group_all.json',
method: 'get'
})
}
// 节点和版本信息
export function getNodeListWithVersion(params) {
export function getNodeListWithVersion(params: any) {
return axios({
url: "/node/list_data_with_version",
method: "get",
params: params,
});
url: '/node/list_data_with_version',
method: 'get',
params: params
})
}
// // node 状态
@ -53,74 +53,74 @@ export function getNodeListWithVersion(params) {
// }
// 节点 + 项目列表
export function getNodeProjectList(params) {
export function getNodeProjectList(params: any) {
return axios({
url: "/node/node_project_list",
method: "post",
params: params,
});
url: '/node/node_project_list',
method: 'post',
params: params
})
}
// 节点 + 项目列表
export function getProjectList(params) {
export function getProjectList(params: any) {
return axios({
url: "/node/project_list",
method: "post",
params: params,
});
url: '/node/project_list',
method: 'post',
params: params
})
}
// 节点 + 项目列表
export function getProjectListAll() {
return axios({
url: "/node/project_list_all",
method: "get",
params: {},
});
url: '/node/project_list_all',
method: 'get',
params: {}
})
}
// 同步节点项目
export function syncProject(nodeId) {
export function syncProject(nodeId: string) {
return axios({
url: "/node/sync_project",
method: "get",
params: { nodeId: nodeId },
});
url: '/node/sync_project',
method: 'get',
params: { nodeId: nodeId }
})
}
export function syncToWorkspace(params) {
export function syncToWorkspace(params: any) {
return axios({
url: "/node/sync-to-workspace",
method: "get",
params: params,
});
url: '/node/sync-to-workspace',
method: 'get',
params: params
})
}
//
export function sortItem(params) {
export function sortItem(params: any) {
return axios({
url: "/node/sort-item",
method: "get",
params: params,
});
url: '/node/sort-item',
method: 'get',
params: params
})
}
// 删除节点项目缓存
export function delAllProjectCache() {
return axios({
url: "/node/clear_all_project",
method: "get",
params: {},
});
url: '/node/clear_all_project',
method: 'get',
params: {}
})
}
// 项目排序
export function sortItemProject(params) {
export function sortItemProject(params: any) {
return axios({
url: "/node/project-sort-item",
method: "get",
params: params,
});
url: '/node/project-sort-item',
method: 'get',
params: params
})
}
/**
@ -140,7 +140,7 @@ export function sortItemProject(params) {
* type: add || update
* } params
*/
export function editNode(params) {
export function editNode(params: any) {
const data = {
id: params.id,
name: params.name,
@ -155,31 +155,31 @@ export function editNode(params) {
loginPwd: params.loginPwd,
type: params.type,
httpProxy: params.httpProxy,
httpProxyType: params.httpProxyType,
};
httpProxyType: params.httpProxyType
}
return axios({
url: "/node/save.json",
method: "post",
data,
});
url: '/node/save.json',
method: 'post',
data
})
}
// 删除 node
export function deleteNode(id) {
export function deleteNode(id: string) {
return axios({
url: "/node/del.json",
method: "post",
data: { id },
});
url: '/node/del.json',
method: 'post',
data: { id }
})
}
// 解绑 node
export function unbind(id) {
export function unbind(id: string) {
return axios({
url: "/node/unbind.json",
method: "get",
params: { id },
});
url: '/node/unbind.json',
method: 'get',
params: { id }
})
}
// // 节点 top 命令
@ -195,29 +195,29 @@ export function unbind(id) {
// }
// 获取进程列表
export function getProcessList(data) {
export function getProcessList(data: any) {
return axios({
url: "/node/processList",
method: "post",
url: '/node/processList',
method: 'post',
data: data,
timeout: 0,
headers: {
loading: "no",
tip: "no",
},
});
loading: 'no',
tip: 'no'
}
})
}
/**
*
* @param {nodeId, pid} params
*/
export function killPid(params) {
export function killPid(params: any) {
return axios({
url: "/node/kill.json",
method: "post",
data: params,
});
url: '/node/kill.json',
method: 'post',
data: params
})
}
/**
@ -227,15 +227,15 @@ export function killPid(params) {
* time: 时间段yyyy-MM-dd HH:mm:ss ~ yyyy-MM-dd HH:mm:ss
* } params
*/
export function nodeMonitorData(params, loading) {
export function nodeMonitorData(params: any, loading: boolean) {
return axios({
url: "/node/node_monitor_data.json",
method: "post",
url: '/node/node_monitor_data.json',
method: 'post',
data: params,
headers: {
loading: loading === false ? "no" : "",
},
});
loading: loading === false ? 'no' : ''
}
})
}
/**
@ -245,32 +245,32 @@ export function nodeMonitorData(params, loading) {
* nodeId: 节点 ID
* } formData
*/
export function uploadAgentFile(formData) {
export function uploadAgentFile(formData: FormData) {
return axios({
url: "/node/upload-agent-sharding",
url: '/node/upload-agent-sharding',
headers: {
"Content-Type": "multipart/form-data;charset=UTF-8",
loading: "no",
'Content-Type': 'multipart/form-data;charset=UTF-8',
loading: 'no'
},
method: "post",
method: 'post',
// 0 表示无超时时间
timeout: 0,
data: formData,
});
data: formData
})
}
/**
*
* @returns json
*/
export function uploadAgentFileMerge(data) {
export function uploadAgentFileMerge(data: any) {
return axios({
url: "/node/upload-agent-sharding-merge",
method: "post",
url: '/node/upload-agent-sharding-merge',
method: 'post',
data: data,
// 0 表示无超时时间
timeout: 0,
});
timeout: 0
})
}
/**
@ -279,10 +279,10 @@ export function uploadAgentFileMerge(data) {
*/
export function checkVersion() {
return axios({
url: "/node/check_version.json",
method: "get",
data: {},
});
url: '/node/check_version.json',
method: 'get',
data: {}
})
}
/**
@ -291,10 +291,10 @@ export function checkVersion() {
*/
export function fastInstall() {
return axios({
url: "/node/fast_install.json",
method: "get",
data: {},
});
url: '/node/fast_install.json',
method: 'get',
data: {}
})
}
/**
@ -302,15 +302,15 @@ export function fastInstall() {
* @param {JSON} params
* @returns
*/
export function pullFastInstallResult(params) {
export function pullFastInstallResult(params: any) {
return axios({
url: "/node/pull_fast_install_result.json",
method: "get",
url: '/node/pull_fast_install_result.json',
method: 'get',
params: params,
headers: {
loading: "no",
},
});
loading: 'no'
}
})
}
/**
@ -318,12 +318,12 @@ export function pullFastInstallResult(params) {
* @param {Json} params
* @returns
*/
export function confirmFastInstall(params) {
export function confirmFastInstall(params: any) {
return axios({
url: "/node/confirm_fast_install.json",
method: "get",
params: params,
});
url: '/node/confirm_fast_install.json',
method: 'get',
params: params
})
}
/**
@ -332,10 +332,10 @@ export function confirmFastInstall(params) {
*/
export function downloadRemote() {
return axios({
url: "/node/download_remote.json",
method: "get",
url: '/node/download_remote.json',
method: 'get',
// 0 表示无超时时间
timeout: 0,
data: {},
});
data: {}
})
}

View File

@ -1,10 +1,10 @@
import axios from './config';
import axios from './config'
// 操作日志列表
export function getOperationLogList(params) {
export function getOperationLogList(params: any) {
return axios({
url: '/user/log/list_data.json',
method: 'post',
data: params
})
}
}

View File

@ -1,4 +1,4 @@
import axios from "./config";
import axios from './config'
/**
*
@ -14,12 +14,12 @@ import axios from "./config";
* @param {String} params.gitUrl
* @return {axios} axios
*/
export function getRepositoryList(params) {
export function getRepositoryList(params: any) {
return axios({
url: "/build/repository/list",
method: "post",
data: params,
});
url: '/build/repository/list',
method: 'post',
data: params
})
}
/**
@ -27,12 +27,12 @@ export function getRepositoryList(params) {
*
* @return {axios} axios
*/
export function getRepositoryInfo(params) {
export function getRepositoryInfo(params: any) {
return axios({
url: "/build/repository/get",
method: "get",
params,
});
url: '/build/repository/get',
method: 'get',
params
})
}
/**
@ -49,12 +49,12 @@ export function getRepositoryInfo(params) {
* @param {String} params.rsaPub
* @return {axios} axios
*/
export function editRepository(params) {
export function editRepository(params: any) {
return axios({
url: "/build/repository/edit",
method: "post",
data: params,
});
url: '/build/repository/edit',
method: 'post',
data: params
})
}
/**
@ -65,12 +65,12 @@ export function editRepository(params) {
* @param {Boolean} params.isRealDel
* @return {axios} axios
*/
export function deleteRepository(params) {
export function deleteRepository(params: any) {
return axios({
url: "/build/repository/delete",
method: "post",
data: params,
});
url: '/build/repository/delete',
method: 'post',
data: params
})
}
/**
* restHideField by id
@ -79,31 +79,31 @@ export function deleteRepository(params) {
*/
export function restHideField(id) {
return axios({
url: "/build/repository/rest_hide_field",
method: "post",
data: { id },
});
url: '/build/repository/rest_hide_field',
method: 'post',
data: { id }
})
}
export function authorizeRepos(param) {
return axios({
url: "/build/repository/authorize_repos",
method: "get",
params: param,
});
url: '/build/repository/authorize_repos',
method: 'get',
params: param
})
}
export function providerInfo() {
return axios({
url: "/build/repository/provider_info",
method: "get",
});
url: '/build/repository/provider_info',
method: 'get'
})
}
export function sortItem(params) {
export function sortItem(params: any) {
return axios({
url: "/build/repository/sort-item",
method: "get",
params: params,
});
url: '/build/repository/sort-item',
method: 'get',
params: params
})
}

View File

@ -3,8 +3,8 @@ import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, In
import { NO_NOTIFY_KEY, TOKEN_HEADER_KEY, CACHE_WORKSPACE_ID } from '@/utils/const'
import { refreshToken } from './user/user'
import { notification } from 'ant-design-vue'
import appStore from '@/stores/app'
import useUserStore from '@/stores/user'
import { useAppStore } from '@/stores/app'
import { useUserStore } from '@/stores/user'
import { useMenuStore } from '@/stores/menu'
const _window = window as any
@ -21,14 +21,15 @@ const instance: AxiosInstance = axios.create({
timeout: apiTimeout || delTimeout,
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
},
responseType: 'json',
responseType: 'json'
})
// 请求拦截
instance.interceptors.request.use((config: InternalAxiosRequestConfig) => {
const { headers } = config
const appStore = useAppStore()
const accessToken = localStorage.getItem('accessToken')
headers['Authorization'] = accessToken ? 'Bearer ' + accessToken : ''
headers[TOKEN_HEADER_KEY] = userStore.token
@ -52,19 +53,19 @@ instance.interceptors.response.use(
if (!error.response) {
notification.error({
message: 'Network Error No response',
description: '网络开了小差!请重试...:' + error,
description: '网络开了小差!请重试...:' + error
})
} else if (!error.response.config.headers[NO_NOTIFY_KEY]) {
const { status, statusText, data } = error.response
if (!status) {
notification.error({
message: 'Network Error',
description: '网络开了小差!请重试...:' + error,
description: '网络开了小差!请重试...:' + error
})
} else {
notification.error({
message: '状态码错误 ' + status,
description: (statusText || '') + (data || ''),
description: (statusText || '') + (data || '')
})
}
}
@ -88,7 +89,7 @@ async function request<T = any>(arg: string | AxiosRequestConfig, config?: Axios
typeof arg === 'string'
? {
url: arg,
...config,
...config
}
: arg
const response = await instance.request<IResponse<T>>(options)
@ -103,7 +104,7 @@ async function request<T = any>(arg: string | AxiosRequestConfig, config?: Axios
if (data.code === 801) {
notification.info({
message: '登录信息过期,尝试自动续签...',
description: '如果不需要自动续签,请修改配置文件。该续签将不会影响页面。',
description: '如果不需要自动续签,请修改配置文件。该续签将不会影响页面。'
})
redoRequest(response.config)
return Promise.reject(data)
@ -119,7 +120,7 @@ async function request<T = any>(arg: string | AxiosRequestConfig, config?: Axios
if (data.code === 999) {
notification.error({
message: '禁止访问',
description: '禁止访问,当前IP限制访问',
description: '禁止访问,当前IP限制访问'
})
window.location.href = _window.routerBase + '/system/ipAccess'
return Promise.reject(data)
@ -131,7 +132,7 @@ async function request<T = any>(arg: string | AxiosRequestConfig, config?: Axios
if (!response.config.headers[NO_NOTIFY_KEY]) {
notification.error({
message: '提示信息 ' + (pro ? '' : response.config.url),
description: data.msg,
description: data.msg
})
console.error(response.config.url, data)
}
@ -157,7 +158,7 @@ async function redoRequest(config: AxiosRequestConfig) {
function toLogin(res: IResponse<any>, response: AxiosResponse<IResponse<any>>) {
notification.warn({
message: '提示信息 ' + (pro ? '' : response.config.url),
description: res.msg,
description: res.msg
})
userStore.logOut()

View File

@ -18,7 +18,7 @@
// }
// // 编辑角色
// export function editRole(params) {
// export function editRole(params:any) {
// return axios({
// url: '/user/role/save.json',
// method: 'post',
@ -48,9 +48,9 @@
// * @param {
// * id: 角色 ID
// * dynamic: dynamic
// * } params
// * } params
// */
// export function getRoleDynamicList(params) {
// export function getRoleDynamicList(params:any) {
// return axios({
// url: '/user/role/getDynamic.json',
// method: 'post',
@ -64,13 +64,13 @@
// * @param {
// * id: 角色 ID
// * dynamic: dynamic
// * } params
// * } params
// */
// export function editRoleDynamic(params) {
// export function editRoleDynamic(params:any) {
// return axios({
// url: '/user/role/saveDynamic.json',
// method: 'post',
// timeout: 0,
// data: params
// })
// }
// }

View File

@ -1,14 +1,14 @@
import axios from "./config";
import axios from './config'
/**
* script
*/
export function getScriptList(params) {
export function getScriptList(params: any) {
return axios({
url: "/script/list",
method: "post",
data: params,
});
url: '/script/list',
method: 'post',
data: params
})
}
/**
@ -16,12 +16,12 @@ export function getScriptList(params) {
* @param {Json} params
* @returns
*/
export function editScript(params) {
export function editScript(params: any) {
return axios({
url: "/script/save.json",
method: "post",
data: params,
});
url: '/script/save.json',
method: 'post',
data: params
})
}
/**
@ -30,12 +30,12 @@ export function editScript(params) {
* params.id ID
*/
export function deleteScript(params) {
export function deleteScript(params: any) {
return axios({
url: "/script/del.json",
method: "post",
data: params,
});
url: '/script/del.json',
method: 'post',
data: params
})
}
/**
@ -44,74 +44,74 @@ export function deleteScript(params) {
* params.id ID
*/
export function unbindScript(params) {
export function unbindScript(params: any) {
return axios({
url: "/script/unbind.json",
method: "get",
params: params,
});
url: '/script/unbind.json',
method: 'get',
params: params
})
}
// 脚本模版日志列表
export function getScriptLogList(params) {
export function getScriptLogList(params: any) {
return axios({
url: "/script_log/list",
method: "post",
data: params,
});
url: '/script_log/list',
method: 'post',
data: params
})
}
// 删除执行记录
export function scriptDel(params) {
export function scriptDel(params: any) {
return axios({
url: "/script_log/del_log",
method: "post",
data: params,
});
url: '/script_log/del_log',
method: 'post',
data: params
})
}
//执行记录 详情
export function scriptLog(params) {
export function scriptLog(params: any) {
return axios({
url: "/script_log/log",
method: "post",
url: '/script_log/log',
method: 'post',
data: params,
headers: {
tip: "no",
},
});
tip: 'no'
}
})
}
export function syncToWorkspace(params) {
export function syncToWorkspace(params: any) {
return axios({
url: "/script/sync-to-workspace",
method: "get",
params: params,
});
url: '/script/sync-to-workspace',
method: 'get',
params: params
})
}
export function getScriptItem(params) {
export function getScriptItem(params: any) {
return axios({
url: "/script/get",
method: "get",
params: params,
});
url: '/script/get',
method: 'get',
params: params
})
}
/**
*
* @param {*} id
*/
export function getTriggerUrl(data) {
export function getTriggerUrl(data: any) {
return axios({
url: "/script/trigger-url",
method: "post",
data: data,
});
url: '/script/trigger-url',
method: 'post',
data: data
})
}
export const triggerExecTypeMap = {
0: "手动",
1: "自动",
2: "触发器",
};
0: '手动',
1: '自动',
2: '触发器'
}

View File

@ -1,5 +1,5 @@
import axios from "./config";
import { loadRouterBase } from "./config";
import axios from './config'
import { loadRouterBase } from './config'
/**
* SSH
@ -10,41 +10,41 @@ import { loadRouterBase } from "./config";
* path: 父级目录
* } formData
*/
export function uploadFile(baseUrl, formData) {
export function uploadFile(baseUrl: string, formData: FormData) {
return axios({
url: baseUrl + "upload",
url: baseUrl + 'upload',
headers: {
"Content-Type": "multipart/form-data;charset=UTF-8",
'Content-Type': 'multipart/form-data;charset=UTF-8'
},
method: "post",
method: 'post',
// 0 表示无超时时间
timeout: 0,
data: formData,
});
data: formData
})
}
/**
*
* @param {String} id
*/
export function getRootFileList(baseUrl, id) {
export function getRootFileList(baseUrl: string, id: string) {
return axios({
url: baseUrl + "root_file_data.json",
method: "post",
data: { id },
});
url: baseUrl + 'root_file_data.json',
method: 'post',
data: { id }
})
}
/**
*
* @param {id, path, children} params
*/
export function getFileList(baseUrl, params) {
export function getFileList(baseUrl: string, params: any) {
return axios({
url: baseUrl + "list_file_data.json",
method: "post",
data: params,
});
url: baseUrl + 'list_file_data.json',
method: 'post',
data: params
})
}
/**
@ -52,44 +52,44 @@ export function getFileList(baseUrl, params) {
* blob blob
* @param {id, path, name} params
*/
export function downloadFile(baseUrl, params) {
return loadRouterBase(baseUrl + "download.html", params);
export function downloadFile(baseUrl: string, params: any) {
return loadRouterBase(baseUrl + 'download.html', params)
}
/**
*
* @param {id, path, name} params x
*/
export function deleteFile(baseUrl, params) {
export function deleteFile(baseUrl: string, params: any) {
return axios({
url: baseUrl + "delete.json",
method: "post",
data: params,
});
url: baseUrl + 'delete.json',
method: 'post',
data: params
})
}
/**
*
* @param {id, path, name} params x
*/
export function readFile(baseUrl, params) {
export function readFile(baseUrl: string, params: any) {
return axios({
url: baseUrl + "read_file_data.json",
method: "post",
data: params,
});
url: baseUrl + 'read_file_data.json',
method: 'post',
data: params
})
}
/**
*
* @param {id, path, name,content} params x
*/
export function updateFileData(baseUrl, params) {
export function updateFileData(baseUrl: string, params: any) {
return axios({
url: baseUrl + "update_file_data.json",
method: "post",
data: params,
});
url: baseUrl + 'update_file_data.json',
method: 'post',
data: params
})
}
/**
@ -97,12 +97,12 @@ export function updateFileData(baseUrl, params) {
* @param params
* @returns {id, path, name,unFolder} params x
*/
export function newFileFolder(baseUrl, params) {
export function newFileFolder(baseUrl: string, params: any) {
return axios({
url: baseUrl + "new_file_folder.json",
method: "post",
data: params,
});
url: baseUrl + 'new_file_folder.json',
method: 'post',
data: params
})
}
/**
@ -110,10 +110,10 @@ export function newFileFolder(baseUrl, params) {
* @param params
* @returns {id, levelName, filename,newname} params x
*/
export function renameFileFolder(baseUrl, params) {
export function renameFileFolder(baseUrl: string, params: any) {
return axios({
url: baseUrl + "rename.json",
method: "post",
data: params,
});
url: baseUrl + 'rename.json',
method: 'post',
data: params
})
}

View File

@ -1,46 +1,46 @@
import axios from "./config";
import axios from './config'
// ssh 列表
export function getSshList(params) {
export function getSshList(params: any) {
return axios({
url: "/node/ssh/list_data.json",
method: "post",
data: params,
});
url: '/node/ssh/list_data.json',
method: 'post',
data: params
})
}
// ssh group all
export function getSshGroupAll() {
return axios({
url: "/node/ssh/list-group-all",
method: "get",
});
url: '/node/ssh/list-group-all',
method: 'get'
})
}
// 查询单个 ssh
export function getItem(params) {
export function getItem(params: any) {
return axios({
url: "/node/ssh/get-item.json",
method: "get",
params: params,
});
url: '/node/ssh/get-item.json',
method: 'get',
params: params
})
}
// 根据 nodeId 查询列表
export function getSshListAll() {
return axios({
url: "/node/ssh/list_data_all.json",
method: "get",
});
url: '/node/ssh/list_data_all.json',
method: 'get'
})
}
// ssh 操作日志列表
export function getSshOperationLogList(params) {
export function getSshOperationLogList(params: any) {
return axios({
url: "/node/ssh/log_list_data.json",
method: "post",
data: params,
});
url: '/node/ssh/log_list_data.json',
method: 'post',
data: params
})
}
/**
@ -48,37 +48,37 @@ export function getSshOperationLogList(params) {
* @param {*} params
* params.type = {'add': , 'edit': }
*/
export function editSsh(params) {
export function editSsh(params: any) {
return axios({
url: "/node/ssh/save.json",
method: "post",
url: '/node/ssh/save.json',
method: 'post',
params,
});
params
})
}
// 删除 SSH
export function deleteSsh(id) {
return axios({
url: "/node/ssh/del.json",
method: "post",
data: { id },
});
url: '/node/ssh/del.json',
method: 'post',
data: { id }
})
}
// 删除 SSH
export function deleteForeSsh(id) {
return axios({
url: "/node/ssh/del-fore",
method: "post",
data: { id },
});
url: '/node/ssh/del-fore',
method: 'post',
data: { id }
})
}
export function syncToWorkspace(params) {
export function syncToWorkspace(params: any) {
return axios({
url: "/node/ssh/sync-to-workspace",
method: "get",
params: params,
});
url: '/node/ssh/sync-to-workspace',
method: 'get',
params: params
})
}

View File

@ -1,16 +1,16 @@
import axios from "./config";
import { loadRouterBase } from "./config";
import axios from './config'
import { loadRouterBase } from './config'
/**
*
* @param {nodeId} params
*/
export function getLogList(params) {
export function getLogList(params: any) {
return axios({
url: "/system/log_data.json",
method: "post",
data: params,
});
url: '/system/log_data.json',
method: 'post',
data: params
})
}
/**
@ -18,20 +18,20 @@ export function getLogList(params) {
* blob blob
* @param {nodeId, path} params
*/
export function downloadFile(params) {
return loadRouterBase("/system/log_download", params);
export function downloadFile(params: any) {
return loadRouterBase('/system/log_download', params)
}
/**
*
* @param {nodeId, path} params
*/
export function deleteLog(params) {
export function deleteLog(params: any) {
return axios({
url: "/system/log_del.json",
method: "post",
data: params,
});
url: '/system/log_del.json',
method: 'post',
data: params
})
}
/**
@ -39,21 +39,21 @@ export function deleteLog(params) {
*/
export function getServerCache() {
return axios({
url: "/system/server-cache",
method: "post",
});
url: '/system/server-cache',
method: 'post'
})
}
/**
*
* @param {String} nodeId
*/
export function getNodeCache(nodeId) {
export function getNodeCache(nodeId: string) {
return axios({
url: "/system/node_cache.json",
method: "post",
data: { nodeId },
});
url: '/system/node_cache.json',
method: 'post',
data: { nodeId }
})
}
/**
@ -63,38 +63,38 @@ export function getNodeCache(nodeId) {
* nodeId: 节点 ID
* } params
*/
export function clearCache(params) {
export function clearCache(params: any) {
return axios({
url: "/system/clearCache.json",
method: "post",
data: params,
});
url: '/system/clearCache.json',
method: 'post',
data: params
})
}
/**
*
*
*/
export function clearErrorWorkspace(params) {
export function clearErrorWorkspace(params: any) {
return axios({
url: "/system/clear-error-workspace",
method: "get",
url: '/system/clear-error-workspace',
method: 'get',
headers: {},
params,
});
params
})
}
/**
*
* @param {String} nodeId ID Server
*/
export function getConfigData(data) {
export function getConfigData(data: any) {
return axios({
url: "/system/config-data",
method: "post",
data: data,
});
url: '/system/config-data',
method: 'post',
data: data
})
}
/**
@ -102,10 +102,10 @@ export function getConfigData(data) {
*/
export function getIpConfigData() {
return axios({
url: "/system/ip-config-data",
method: "post",
data: {},
});
url: '/system/ip-config-data',
method: 'post',
data: {}
})
}
/**
@ -115,12 +115,12 @@ export function getIpConfigData() {
* prohibited: 禁止访问ip
* }
*/
export function editIpConfig(params) {
export function editIpConfig(params: any) {
return axios({
url: "/system/save_ip_config.json",
method: "post",
data: params,
});
url: '/system/save_ip_config.json',
method: 'post',
data: params
})
}
/**
@ -131,12 +131,12 @@ export function editIpConfig(params) {
* restart: 是否重启
* } params
*/
export function editConfig(params) {
export function editConfig(params: any) {
return axios({
url: "/system/save_config.json",
method: "post",
data: params,
});
url: '/system/save_config.json',
method: 'post',
data: params
})
}
/**
@ -144,25 +144,25 @@ export function editConfig(params) {
*/
export function getMailConfigData() {
return axios({
url: "/system/mail-config-data",
method: "post",
});
url: '/system/mail-config-data',
method: 'post'
})
}
export function oauthConfigOauth2(params) {
export function oauthConfigOauth2(params: any) {
return axios({
url: "/system/oauth-config/oauth2",
method: "get",
params,
});
url: '/system/oauth-config/oauth2',
method: 'get',
params
})
}
export function oauthConfigOauth2Save(params) {
export function oauthConfigOauth2Save(params: any) {
return axios({
url: "/system/oauth-config/oauth2-save",
method: "post",
data: params,
});
url: '/system/oauth-config/oauth2-save',
method: 'post',
data: params
})
}
/**
@ -177,28 +177,28 @@ export function oauthConfigOauth2Save(params) {
* socketFactoryPort: SSL
* } params
*/
export function editMailConfig(params) {
export function editMailConfig(params: any) {
return axios({
url: "/system/mailConfig_save.json",
method: "post",
data: params,
});
url: '/system/mailConfig_save.json',
method: 'post',
data: params
})
}
/**
*
* @param {String} nodeId ID
*/
export function systemInfo(data) {
export function systemInfo(data: any) {
return axios({
url: "/system/info",
method: "post",
url: '/system/info',
method: 'post',
headers: {
tip: "no",
loading: "no",
tip: 'no',
loading: 'no'
},
data,
});
data
})
}
/**
@ -208,82 +208,82 @@ export function systemInfo(data) {
* nodeId: 节点 ID
* } formData
*/
export function uploadUpgradeFile(formData) {
export function uploadUpgradeFile(formData: FormData) {
return axios({
url: "/system/upload-jar-sharding",
url: '/system/upload-jar-sharding',
headers: {
"Content-Type": "multipart/form-data;charset=UTF-8",
loading: "no",
'Content-Type': 'multipart/form-data;charset=UTF-8',
loading: 'no'
},
method: "post",
method: 'post',
// 0 表示无超时时间
timeout: 0,
data: formData,
});
data: formData
})
}
/**
*
*@param {String} nodeId ID
*/
export function uploadUpgradeFileMerge(data) {
export function uploadUpgradeFileMerge(data: any) {
return axios({
url: "/system/upload-jar-sharding-merge",
method: "post",
url: '/system/upload-jar-sharding-merge',
method: 'post',
headers: {},
data: data,
// 0 表示无超时时间
timeout: 0,
});
timeout: 0
})
}
/**
*
*@param {String} nodeId ID
*/
export function changelog(data) {
export function changelog(data: any) {
return axios({
url: "/system/change_log",
method: "post",
url: '/system/change_log',
method: 'post',
headers: {},
data,
});
data
})
}
export function changBetaRelease(params) {
export function changBetaRelease(params: any) {
return axios({
url: "/system/change-beta-release",
method: "get",
url: '/system/change-beta-release',
method: 'get',
headers: {},
params,
});
params
})
}
/**
*
*@param {String} nodeId ID
*/
export function checkVersion(data) {
export function checkVersion(data: any) {
return axios({
url: "/system/check_version.json",
method: "post",
url: '/system/check_version.json',
method: 'post',
headers: {},
data,
});
data
})
}
/**
*
*@param {String} nodeId ID
*/
export function remoteUpgrade(params) {
export function remoteUpgrade(params: any) {
return axios({
url: "/system/remote_upgrade.json",
method: "get",
url: '/system/remote_upgrade.json',
method: 'get',
timeout: 0,
headers: {},
params,
});
params
})
}
/**
@ -291,22 +291,22 @@ export function remoteUpgrade(params) {
*/
export function getProxyConfig() {
return axios({
url: "/system/get_proxy_config",
method: "get",
params: {},
});
url: '/system/get_proxy_config',
method: 'get',
params: {}
})
}
/**
*
*/
export function saveProxyConfig(data) {
export function saveProxyConfig(data: any) {
return axios({
url: "/system/save_proxy_config",
method: "post",
url: '/system/save_proxy_config',
method: 'post',
headers: {
"Content-Type": "application/json",
'Content-Type': 'application/json'
},
data: data,
});
data: data
})
}

View File

@ -1,35 +1,35 @@
import axios from "@/api/config";
import axios from '@/api/config'
/**
*
* @param {JSON} params
*/
export function dockerList(params) {
export function dockerList(params: any) {
return axios({
url: "/system/assets/docker/list-data",
method: "post",
data: params,
});
url: '/system/assets/docker/list-data',
method: 'post',
data: params
})
}
export function dockerImportTls(formData) {
export function dockerImportTls(formData: FormData) {
return axios({
url: "/system/assets/docker/import-tls",
url: '/system/assets/docker/import-tls',
headers: {
"Content-Type": "multipart/form-data;charset=UTF-8",
'Content-Type': 'multipart/form-data;charset=UTF-8'
},
method: "post",
method: 'post',
timeout: 0,
data: formData,
});
data: formData
})
}
export function editDocker(data) {
export function editDocker(data: any) {
return axios({
url: "/system/assets/docker/edit",
method: "post",
data: data,
});
url: '/system/assets/docker/edit',
method: 'post',
data: data
})
}
/**
@ -38,12 +38,12 @@ export function editDocker(data) {
*
* } params
*/
export function tryLocalDocker(params) {
export function tryLocalDocker(params: any) {
return axios({
url: "/system/assets/docker/try-local-docker",
method: "get",
params,
});
url: '/system/assets/docker/try-local-docker',
method: 'get',
params
})
}
/**
@ -52,36 +52,36 @@ export function tryLocalDocker(params) {
* id: docker ID
* } params
*/
export function deleteDcoker(params) {
export function deleteDcoker(params: any) {
return axios({
url: "/system/assets/docker/del",
method: "get",
params,
});
url: '/system/assets/docker/del',
method: 'get',
params
})
}
export function initDockerSwarm(data) {
export function initDockerSwarm(data: any) {
return axios({
url: "/system/assets/docker/init",
method: "post",
data: data,
});
url: '/system/assets/docker/init',
method: 'post',
data: data
})
}
export function joinDockerSwarm(data) {
export function joinDockerSwarm(data: any) {
return axios({
url: "/system/assets/docker/join",
method: "post",
data: data,
});
url: '/system/assets/docker/join',
method: 'post',
data: data
})
}
export function dockerSwarmListAll(params) {
export function dockerSwarmListAll(params: any) {
return axios({
url: "/system/assets/docker/swarm/list-all",
method: "get",
params: params,
});
url: '/system/assets/docker/swarm/list-all',
method: 'get',
params: params
})
}
/**
@ -90,38 +90,38 @@ export function dockerSwarmListAll(params) {
* id: docker ID
* } params
*/
export function dcokerSwarmLeaveForce(params) {
export function dcokerSwarmLeaveForce(params: any) {
return axios({
url: "/system/assets/docker/leave-force",
method: "get",
params,
});
url: '/system/assets/docker/leave-force',
method: 'get',
params
})
}
/**
*
* @param {JSON} params
*/
export function dockerSwarmNodeLeave(params) {
export function dockerSwarmNodeLeave(params: any) {
return axios({
url: "/system/assets/docker/leave-node",
method: "get",
params: params,
});
url: '/system/assets/docker/leave-node',
method: 'get',
params: params
})
}
export function machineDockerDistribute(params) {
export function machineDockerDistribute(params: any) {
return axios({
url: "/system/assets/docker/distribute",
method: "post",
params: params,
});
url: '/system/assets/docker/distribute',
method: 'post',
params: params
})
}
export function dockerListWorkspace(params) {
export function dockerListWorkspace(params: any) {
return axios({
url: "/system/assets/docker/list-workspace-docker",
method: "get",
params: params,
});
url: '/system/assets/docker/list-workspace-docker',
method: 'get',
params: params
})
}

View File

@ -1,91 +1,91 @@
import axios from "@/api/config";
import axios from '@/api/config'
// 机器 列表
export function machineListData(params) {
export function machineListData(params: any) {
return axios({
url: "/system/assets/machine/list-data",
method: "post",
params: params,
});
url: '/system/assets/machine/list-data',
method: 'post',
params: params
})
}
export function machineListGroup(params) {
export function machineListGroup(params: any) {
return axios({
url: "/system/assets/machine/list-group",
method: "get",
params: params,
});
url: '/system/assets/machine/list-group',
method: 'get',
params: params
})
}
// 编辑机器
export function machineEdit(params) {
export function machineEdit(params: any) {
return axios({
url: "/system/assets/machine/edit",
method: "post",
params: params,
});
url: '/system/assets/machine/edit',
method: 'post',
params: params
})
}
// 删除机器
export function machineDelete(params) {
export function machineDelete(params: any) {
return axios({
url: "/system/assets/machine/delete",
method: "post",
params: params,
});
url: '/system/assets/machine/delete',
method: 'post',
params: params
})
}
// 分配机器
export function machineDistribute(params) {
export function machineDistribute(params: any) {
return axios({
url: "/system/assets/machine/distribute",
method: "post",
params: params,
});
url: '/system/assets/machine/distribute',
method: 'post',
params: params
})
}
export const statusMap = {
0: "无法连接",
1: "正常",
2: "授权信息错误",
3: "状态码错误",
};
// 查看机器关联节点
export function machineListNode(params) {
return axios({
url: "/system/assets/machine/list-node",
method: "get",
params: params,
});
0: '无法连接',
1: '正常',
2: '授权信息错误',
3: '状态码错误'
}
export function machineListTemplateNode(params) {
// 查看机器关联节点
export function machineListNode(params: any) {
return axios({
url: "/system/assets/machine/list-template-node",
method: "get",
params: params,
});
url: '/system/assets/machine/list-node',
method: 'get',
params: params
})
}
export function machineListTemplateNode(params: any) {
return axios({
url: '/system/assets/machine/list-template-node',
method: 'get',
params: params
})
}
/**
*
*/
export function saveWhitelist(data) {
export function saveWhitelist(data: any) {
return axios({
url: "/system/assets/machine/save-whitelist",
method: "post",
data: data,
});
url: '/system/assets/machine/save-whitelist',
method: 'post',
data: data
})
}
/**
*
*/
export function saveNodeConfig(data) {
export function saveNodeConfig(data: any) {
return axios({
url: "/system/assets/machine/save-node-config",
method: "post",
data: data,
});
url: '/system/assets/machine/save-node-config',
method: 'post',
data: data
})
}

View File

@ -1,74 +1,74 @@
import axios from "@/api/config";
import { loadRouterBase } from "@/api/config";
import axios from '@/api/config'
import { loadRouterBase } from '@/api/config'
// ssh 列表
export function machineSshListData(params) {
export function machineSshListData(params: any) {
return axios({
url: "/system/assets/ssh/list-data",
method: "post",
params: params,
});
url: '/system/assets/ssh/list-data',
method: 'post',
params: params
})
}
export function machineSshListGroup(params) {
export function machineSshListGroup(params: any) {
return axios({
url: "/system/assets/ssh/list-group",
method: "get",
params: params,
});
url: '/system/assets/ssh/list-group',
method: 'get',
params: params
})
}
// 编辑ssh
export function machineSshEdit(params) {
export function machineSshEdit(params: any) {
return axios({
url: "/system/assets/ssh/edit",
method: "post",
params: params,
});
url: '/system/assets/ssh/edit',
method: 'post',
params: params
})
}
// 删除 ssh
export function machineSshDelete(params) {
export function machineSshDelete(params: any) {
return axios({
url: "/system/assets/ssh/delete",
method: "post",
params: params,
});
url: '/system/assets/ssh/delete',
method: 'post',
params: params
})
}
// 分配 ssh
export function machineSshDistribute(params) {
export function machineSshDistribute(params: any) {
return axios({
url: "/system/assets/ssh/distribute",
method: "post",
params: params,
});
url: '/system/assets/ssh/distribute',
method: 'post',
params: params
})
}
// ssh 操作日志列表
export function getMachineSshOperationLogList(params) {
export function getMachineSshOperationLogList(params: any) {
return axios({
url: "/system/assets/ssh/log-list-data",
method: "post",
data: params,
});
url: '/system/assets/ssh/log-list-data',
method: 'post',
data: params
})
}
// ssh 关联工作空间的数据
export function machineListGroupWorkspaceSsh(params) {
export function machineListGroupWorkspaceSsh(params: any) {
return axios({
url: "/system/assets/ssh/list-workspace-ssh",
method: "get",
params: params,
});
url: '/system/assets/ssh/list-workspace-ssh',
method: 'get',
params: params
})
}
export function machineSshSaveWorkspaceConfig(params) {
export function machineSshSaveWorkspaceConfig(params: any) {
return axios({
url: "/system/assets/ssh/save-workspace-config",
method: "post",
params: params,
});
url: '/system/assets/ssh/save-workspace-config',
method: 'post',
params: params
})
}
/**
@ -78,36 +78,36 @@ export function machineSshSaveWorkspaceConfig(params) {
*/
export function restHideField(id) {
return axios({
url: "/system/assets/ssh/rest-hide-field",
method: "post",
data: { id },
});
url: '/system/assets/ssh/rest-hide-field',
method: 'post',
data: { id }
})
}
/*
*
*
*/
export function importTemplate(data) {
return loadRouterBase("/system/assets/ssh/import-template", data);
export function importTemplate(params: any) {
return loadRouterBase('/system/assets/ssh/import-template', data)
}
/*
*
*
*/
export function exportData(data) {
return loadRouterBase("/system/assets/ssh/export-data", data);
export function exportData(params: any) {
return loadRouterBase('/system/assets/ssh/export-data', data)
}
// 导入数据
export function importData(formData) {
return axios({
url: "/system/assets/ssh/import-data",
url: '/system/assets/ssh/import-data',
headers: {
"Content-Type": "multipart/form-data;charset=UTF-8",
'Content-Type': 'multipart/form-data;charset=UTF-8'
},
method: "post",
method: 'post',
// 0 表示无超时时间
timeout: 0,
data: formData,
});
data: formData
})
}

View File

@ -1,13 +1,13 @@
import axios from "./config";
import axios from './config'
/**
*
* @param data
*/
export function cronTools(data) {
export function cronTools(params: any) {
return axios({
url: "/tools/cron",
method: "get",
params: data,
});
url: '/tools/cron',
method: 'get',
params: data
})
}

View File

@ -1,38 +1,38 @@
import axios from "@/api/config";
import { loadRouterBase } from "@/api/config";
import axios from '@/api/config'
import { loadRouterBase } from '@/api/config'
// 导入证书
export function certificateImportFile(formData) {
return axios({
url: "/certificate/import-file",
url: '/certificate/import-file',
headers: {
"Content-Type": "multipart/form-data;charset=UTF-8",
'Content-Type': 'multipart/form-data;charset=UTF-8'
},
method: "post",
method: 'post',
data: formData,
});
data: formData
})
}
/**
* cert
*/
export function certList(params) {
export function certList(params: any) {
return axios({
url: "/certificate/list",
method: "post",
data: params,
});
url: '/certificate/list',
method: 'post',
data: params
})
}
/**
* cert
*/
export function certListAll(params) {
export function certListAll(params: any) {
return axios({
url: "/certificate/list-all",
method: "post",
data: params,
});
url: '/certificate/list-all',
method: 'post',
data: params
})
}
/**
@ -41,12 +41,12 @@ export function certListAll(params) {
*
* } params
*/
export function deleteCert(params) {
export function deleteCert(params: any) {
return axios({
url: "/certificate/del",
method: "get",
params: params,
});
url: '/certificate/del',
method: 'get',
params: params
})
}
/**
@ -55,24 +55,24 @@ export function deleteCert(params) {
*
* } params
*/
export function downloadCert(params) {
return loadRouterBase("/certificate/export", params);
export function downloadCert(params: any) {
return loadRouterBase('/certificate/export', params)
}
// 修改证书
export function certificateEdit(params) {
export function certificateEdit(params: any) {
return axios({
url: "/certificate/edit",
method: "post",
data: params,
});
url: '/certificate/edit',
method: 'post',
data: params
})
}
// 部署证书
export function certificateDeploy(params) {
export function certificateDeploy(params: any) {
return axios({
url: "/certificate/deploy",
method: "post",
data: params,
});
url: '/certificate/deploy',
method: 'post',
data: params
})
}

View File

@ -1,36 +1,36 @@
import axios from "../config";
import axios from '../config'
// 权限组列表
export function getList(params) {
export function getList(params: any) {
return axios({
url: "/user-permission-group/get-list",
method: "post",
data: params,
});
url: '/user-permission-group/get-list',
method: 'post',
data: params
})
}
// 编辑
export function editPermissionGroup(params) {
export function editPermissionGroup(params: any) {
return axios({
url: "/user-permission-group/edit",
method: "post",
data: params,
});
url: '/user-permission-group/edit',
method: 'post',
data: params
})
}
// 所有列表
export function getUserPermissionListAll() {
return axios({
url: "/user-permission-group/get-list-all",
method: "get",
});
url: '/user-permission-group/get-list-all',
method: 'get'
})
}
// 删除
export function deletePermissionGroup(id) {
return axios({
url: "/user-permission-group/delete",
method: "get",
params: { id },
});
url: '/user-permission-group/delete',
method: 'get',
params: { id }
})
}

View File

@ -2,28 +2,28 @@ import { IResponse } from '@/interface/request'
import axios from '../config'
// login
export function login(params) {
export function login(params: any) {
return axios({
url: '/userLogin',
method: 'post',
data: params,
data: params
})
}
// oauth2Login
export function oauth2Login(params) {
export function oauth2Login(params: any) {
return axios({
url: '/oauth2/login',
method: 'post',
data: params,
data: params
})
}
export function oauth2Url(params) {
export function oauth2Url(params: any) {
return axios({
url: '/oauth2-url',
method: 'get',
params: params,
params: params
})
}
@ -32,11 +32,11 @@ export function oauth2Url(params) {
* @param {JSON} params
* @returns
*/
export function mfaVerify(params) {
export function mfaVerify(params: any) {
return axios({
url: '/mfa_verify',
method: 'get',
params: params,
params: params
})
}
@ -44,16 +44,16 @@ export function mfaVerify(params) {
export function refreshToken() {
return axios({
url: '/renewal',
method: 'post',
method: 'post'
})
}
// 关闭 两步验证信息
export function closeMfa(params) {
export function closeMfa(params: any) {
return axios({
url: '/user/close_mfa',
method: 'get',
params,
params
})
}
@ -61,7 +61,7 @@ export function closeMfa(params) {
export function generateMfa() {
return axios({
url: '/user/generate_mfa',
method: 'get',
method: 'get'
})
}
@ -70,11 +70,11 @@ export function generateMfa() {
* @param {JSON} params
* @returns
*/
export function bindMfa(params) {
export function bindMfa(params: any) {
return axios({
url: '/user/bind_mfa',
method: 'get',
params: params,
params: params
})
}
@ -82,25 +82,25 @@ export function bindMfa(params) {
export function getUserInfo() {
return axios<IResponse<any>>({
url: '/user/user-basic-info',
method: 'post',
method: 'post'
})
}
// 退出登录
export function loginOut(params) {
export function loginOut(params: any) {
return axios({
url: '/logout2',
method: 'get',
data: params,
data: params
})
}
// 修改密码
export function updatePwd(params) {
export function updatePwd(params: any) {
return axios({
url: '/user/updatePwd',
method: 'post',
data: params,
data: params
})
}
@ -108,30 +108,30 @@ export function updatePwd(params) {
export function getUserListAll() {
return axios({
url: '/user/get_user_list_all',
method: 'post',
method: 'post'
})
}
// 用户列表
export function getUserList(params) {
export function getUserList(params: any) {
return axios({
url: '/user/get_user_list',
method: 'post',
data: params,
data: params
})
}
// 编辑
export function editUser(params) {
export function editUser(params: any) {
return axios({
url: '/user/edit',
method: 'post',
data: params,
data: params
})
}
// // 修改用户
// export function updateUser(params) {
// export function updateUser(params:any) {
// return axios({
// url: '/user/updateUser',
// method: 'post',
@ -140,11 +140,11 @@ export function editUser(params) {
// }
// 删除用户
export function deleteUser(id) {
export function deleteUser(id:string) {
return axios({
url: '/user/deleteUser',
method: 'post',
data: { id },
data: { id }
})
}
@ -158,11 +158,11 @@ export function deleteUser(id) {
* workWx: 企业微信群通知地址
* } params
*/
export function editUserInfo(params) {
export function editUserInfo(params: any) {
return axios({
url: '/user/save_basicInfo.json',
method: 'post',
data: params,
data: params
})
}
@ -170,12 +170,12 @@ export function editUserInfo(params) {
*
* @param {String} email
*/
export function sendEmailCode(email) {
export function sendEmailCode(email:string) {
return axios({
url: '/user/sendCode.json',
method: 'post',
timeout: 0,
data: { email },
data: { email }
})
}
@ -184,11 +184,11 @@ export function sendEmailCode(email) {
* @param {String} id ID
* @returns
*/
export function unlockUser(id) {
export function unlockUser(id:string) {
return axios({
url: '/user/unlock',
method: 'get',
params: { id },
params: { id }
})
}
@ -197,11 +197,11 @@ export function unlockUser(id) {
* @param {String} id ID
* @returns
*/
export function closeUserMfa(id) {
export function closeUserMfa(id:string) {
return axios({
url: '/user/close_user_mfa',
method: 'get',
params: { id },
params: { id }
})
}
@ -210,11 +210,11 @@ export function closeUserMfa(id) {
* @param {String} id ID
* @returns
*/
export function restUserPwd(id) {
export function restUserPwd(id:string) {
return axios({
url: '/user/rest-user-pwd',
method: 'get',
params: { id },
params: { id }
})
}
@ -223,11 +223,11 @@ export function restUserPwd(id) {
* @param {String} userId ID
* @returns
*/
export function workspaceList(userId) {
export function workspaceList(userId:string) {
return axios({
url: '/user/workspace_list',
method: 'get',
params: { userId: userId },
params: { userId: userId }
})
}
@ -240,7 +240,7 @@ export function myWorkspace() {
return axios({
url: '/user/my-workspace',
method: 'get',
params: {},
params: {}
})
}
@ -249,14 +249,14 @@ export function myWorkspace() {
*
* @returns
*/
export function saveWorkspace(data) {
export function saveWorkspace(data:any) {
return axios({
url: '/user/save-workspace',
method: 'post',
data,
headers: {
'Content-Type': 'application/json',
},
'Content-Type': 'application/json'
}
})
}
@ -269,22 +269,22 @@ export function loginConfig() {
return axios({
url: '/login-config',
method: 'get',
params: {},
params: {}
})
}
export function listLoginLog(params) {
export function listLoginLog(params: any) {
return axios({
url: '/user/list-login-log-data',
method: 'post',
data: params,
data: params
})
}
export function listOperaterLog(params) {
export function listOperaterLog(params: any) {
return axios({
url: '/user/list-operate-log-data',
method: 'post',
data: params,
data: params
})
}

View File

@ -1,15 +1,15 @@
import axios from "./config";
import axios from './config'
/**
*
* @param data
* @param params
*/
export function editWorkSpace(data) {
export function editWorkSpace(params: any) {
return axios({
url: "/system/workspace/edit",
method: "post",
data: data,
});
url: '/system/workspace/edit',
method: 'post',
data: params
})
}
/*
@ -17,12 +17,12 @@ export function editWorkSpace(data) {
* @param {*}
* } params
*/
export function getWorkSpaceList(params) {
export function getWorkSpaceList(params: any) {
return axios({
url: "/system/workspace/list",
method: "post",
data: params,
});
url: '/system/workspace/list',
method: 'post',
data: params
})
}
/*
@ -32,10 +32,10 @@ export function getWorkSpaceList(params) {
*/
export function getWorkSpaceListAll() {
return axios({
url: "/system/workspace/list_all",
method: "get",
data: {},
});
url: '/system/workspace/list_all',
method: 'get',
data: {}
})
}
/*
@ -43,12 +43,12 @@ export function getWorkSpaceListAll() {
* @param {String} id
* } params
*/
export function deleteWorkspace(id) {
export function deleteWorkspace(id: string) {
return axios({
url: "/system/workspace/delete",
method: "get",
params: { id: id },
});
url: '/system/workspace/delete',
method: 'get',
params: { id: id }
})
}
/*
@ -56,24 +56,24 @@ export function deleteWorkspace(id) {
* @param {*}
* } params
*/
export function getWorkspaceEnvList(params) {
export function getWorkspaceEnvList(params: any) {
return axios({
url: "/system/workspace_env/list",
method: "post",
data: params,
});
url: '/system/workspace_env/list',
method: 'post',
data: params
})
}
/**
*
* @param data
*/
export function editWorkspaceEnv(data) {
export function editWorkspaceEnv(data: any) {
return axios({
url: "/system/workspace_env/edit",
method: "post",
data: data,
});
url: '/system/workspace_env/edit',
method: 'post',
data: data
})
}
/*
@ -81,32 +81,32 @@ export function editWorkspaceEnv(data) {
* @param {String} id
* } params
*/
export function deleteWorkspaceEnv(params) {
export function deleteWorkspaceEnv(params: any) {
return axios({
url: "/system/workspace_env/delete",
method: "get",
params: params,
});
url: '/system/workspace_env/delete',
method: 'get',
params: params
})
}
/**
*
*/
export function getMenusConfig(data) {
export function getMenusConfig(data: any) {
return axios({
url: "/system/workspace/get_menus_config",
method: "post",
data,
});
url: '/system/workspace/get_menus_config',
method: 'post',
data
})
}
/**
*
*/
export function saveMenusConfig(data) {
export function saveMenusConfig(data: any) {
return axios({
url: "/system/workspace/save_menus_config.json",
method: "post",
data: data,
});
url: '/system/workspace/save_menus_config.json',
method: 'post',
data: data
})
}

View File

@ -24,8 +24,8 @@
*
* @param data
*/
export function cloneDeep(data) {
return JSON.parse(JSON.stringify(data));
export function cloneDeep(data: any) {
return JSON.parse(JSON.stringify(data))
}
/**
@ -33,19 +33,19 @@ export function cloneDeep(data) {
* @param tree
* @param hasChildren
*/
export function treeToList(tree, hasChildren = false) {
let queen = [];
const out = [];
queen = queen.concat(JSON.parse(JSON.stringify(tree)));
export function treeToList(tree: any[], hasChildren = false) {
let queen: any[] = []
const out = []
queen = queen.concat(JSON.parse(JSON.stringify(tree)))
while (queen.length) {
const first = queen.shift();
const first = queen.shift()
if (first?.children) {
queen = queen.concat(first.children);
if (!hasChildren) delete first.children;
queen = queen.concat(first.children)
if (!hasChildren) delete first.children
}
out.push(first);
out.push(first)
}
return out;
return out
}
/**
@ -55,28 +55,28 @@ export function treeToList(tree, hasChildren = false) {
* @param parentId
* @param key
*/
export function listToTree(list, tree, parentId = 0, key = "parentId") {
list.forEach((item) => {
export function listToTree(list: any, tree: any, parentId = 0, key = 'parentId') {
list.forEach((item: any) => {
if (item[key] === parentId) {
const child = {
...item,
children: [],
};
listToTree(list, child.children, item.key, key);
if (!child.children?.length) delete child.children;
tree.push(child);
children: []
}
listToTree(list, child.children, item.key, key)
if (!child.children?.length) delete child.children
tree.push(child)
}
});
return tree;
})
return tree
}
/**
* key
* @param treeData
*/
export function getTreeKeys(treeData) {
const list = treeToList(treeData);
return list.map((item) => item.key);
export function getTreeKeys(treeData: any) {
const list = treeToList(treeData)
return list.map((item) => item.key)
}
// /**
@ -117,8 +117,8 @@ export function getTreeKeys(treeData) {
* @param selectedKeys
* @param eventKey
*/
export function isChecked(selectedKeys, eventKey) {
return selectedKeys.indexOf(eventKey) !== -1;
export function isChecked(selectedKeys: any[], eventKey: any) {
return selectedKeys.indexOf(eventKey) !== -1
}
/**
@ -127,16 +127,16 @@ export function isChecked(selectedKeys, eventKey) {
* @param targetKeys
* @param direction
*/
export function handleLeftTreeData(data, targetKeys, direction = "right") {
data.forEach((item) => {
if (direction === "right") {
item.disabled = targetKeys.includes(item.key);
} else if (direction === "left") {
if (item.disabled && targetKeys.includes(item.key)) item.disabled = false;
export function handleLeftTreeData(data: any, targetKeys: any, direction = 'right') {
data.forEach((item: any) => {
if (direction === 'right') {
item.disabled = targetKeys.includes(item.key)
} else if (direction === 'left') {
if (item.disabled && targetKeys.includes(item.key)) item.disabled = false
}
if (item.children) handleLeftTreeData(item.children, targetKeys, direction);
});
return data;
if (item.children) handleLeftTreeData(item.children, targetKeys, direction)
})
return data
}
/**
@ -145,27 +145,27 @@ export function handleLeftTreeData(data, targetKeys, direction = "right") {
* @param targetKeys
* @param direction
*/
export function handleRightTreeData(data, targetKeys, direction = "right") {
const list = treeToList(data);
const arr = [];
const tree = [];
export function handleRightTreeData(data: any, targetKeys: any, direction = 'right') {
const list = treeToList(data)
const arr: any[] = []
const tree: any[] = []
list.forEach((item) => {
if (direction === "right") {
if (direction === 'right') {
if (targetKeys.includes(item.key)) {
const content = { ...item };
if (content.children) delete content.children;
arr.push({ ...content });
const content = { ...item }
if (content.children) delete content.children
arr.push({ ...content })
}
} else if (direction === "left") {
} else if (direction === 'left') {
if (!targetKeys.includes(item.key)) {
const content = { ...item };
if (content.children) delete content.children;
arr.push({ ...content });
const content = { ...item }
if (content.children) delete content.children
arr.push({ ...content })
}
}
});
listToTree(arr, tree, 0);
return tree;
})
listToTree(arr, tree, 0)
return tree
}
/**
@ -173,10 +173,10 @@ export function handleRightTreeData(data, targetKeys, direction = "right") {
* @param list
* @param dataSource
*/
export function flatten(list, dataSource) {
list.forEach((item) => {
dataSource.push(item);
if (item.children) flatten(item.children, dataSource);
});
return dataSource;
export function flatten(list: any, dataSource: any) {
list.forEach((item: any) => {
dataSource.push(item)
if (item.children) flatten(item.children, dataSource)
})
return dataSource
}

View File

@ -3,10 +3,10 @@ import '@/assets/reset.less'
import App from './App.vue'
import Antd from 'ant-design-vue'
import router from './router'
import { createPinia } from 'pinia'
import {createPinia, Pinia} from 'pinia'
import { message, notification, Modal } from 'ant-design-vue'
import 'ant-design-vue/dist/antd.css'
const pinia = createPinia()
const pinia: Pinia = createPinia()
const app = createApp(App)

View File

@ -1,102 +1,76 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Code Technology Studio
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* store
* tab tab
* tab tab tab
*/
import { MANAGEMENT_ACTIVE_TAB_KEY, MANAGEMENT_TAB_LIST_KEY, MANAGEMENT_ACTIVE_MENU_KEY } from '@/utils/const'
import {
MANAGEMENT_ACTIVE_TAB_KEY as ACTIVE_TAB_KEY,
MANAGEMENT_TAB_LIST_KEY as TAB_LIST_KEY,
MANAGEMENT_ACTIVE_MENU_KEY as ACTIVE_MENU_KEY
} from '@/utils/const'
import { getSystemMenu } from '@/api/menu'
import { getSystemMenu as getMenu } from '@/api/menu'
import routeMenuMap from '@/router/route-menu'
import { defineStore } from 'pinia'
import { IMenuState } from '@/stores/menu'
const app = {
state: {
activeTabKey: localStorage.getItem(MANAGEMENT_ACTIVE_TAB_KEY),
tabList: JSON.parse(localStorage.getItem(MANAGEMENT_TAB_LIST_KEY)),
activeMenuKey: localStorage.getItem(MANAGEMENT_ACTIVE_MENU_KEY),
export const useMenuStore = defineStore('menu', {
state: (): IMenuState => ({
activeTabKey: localStorage.getItem(ACTIVE_TAB_KEY) || '',
tabList: localStorage.getItem(TAB_LIST_KEY) ? JSON.parse(localStorage.getItem(TAB_LIST_KEY)!) : [],
activeMenuKey: localStorage.getItem(ACTIVE_MENU_KEY) || '',
menuOpenKeys: [],
menus: [],
},
mutations: {
setManagementActiveTabKey(state, activeKey) {
state.activeTabKey = activeKey
},
setManagementTabList(state, tabList) {
state.tabList = tabList
localStorage.setItem(MANAGEMENT_TAB_LIST_KEY, JSON.stringify(tabList))
},
setManagementActiveMenuKey(state, activeMenuKey) {
state.activeMenuKey = activeMenuKey
},
setManagementMenuOpenKeys(state, keys) {
state.menuOpenKeys = keys
},
setManagementMenus(state, menus) {
state.menus = menus
},
},
activeMenu: ''
}),
actions: {
// 加载系统菜单 action
loadManagementSystemMenus({ commit, state }) {
return new Promise((resolve, reject) => {
if (state.menus.length) {
// 避免重复加载
resolve()
return
}
// 加载系统菜单
getSystemMenu()
.then((res) => {
res.data.forEach((element) => {
async loadSystemMenus() {
if (this.menus.length) {
// 避免重复加载
return true
}
return await this.restLoadSystemMenus()
},
async restLoadSystemMenus() {
// return new Promise((resolve, reject) => {
// // 加载系统菜单
// })
await getMenu()
.then((res) => {
if (res.data) {
res.data?.forEach((element: any) => {
if (element.childs.length > 0) {
const childs = element.childs.map((child) => {
element.childs = element.childs.map((child: any) => {
return {
...child,
path: routeMenuMap[child.id],
path: routeMenuMap[child.id]
}
})
element.childs = childs
}
})
commit('setManagementMenus', res.data)
resolve()
})
.catch((error) => {
reject(error)
})
})
this.menus = res.data
Promise.resolve()
} else {
Promise.reject()
}
})
.catch((error) => {
Promise.reject(error)
})
},
// 添加 tab
addManagementTab({ commit, state, dispatch }, tab) {
addTab(tab: any) {
return new Promise((resolve) => {
// 从 store 里面拿到 menus 匹配 path 得到当前的菜单,设置 tab 的标题
const menus = state.menus
let currentMenu = null,
firstMenu = null
const menus = this.menus
let currentMenu: any = undefined
let firstMenu: any = undefined
menus.forEach((menu) => {
menu.childs.forEach((subMenu) => {
menu.childs.forEach((subMenu: any) => {
if (!firstMenu) {
firstMenu = subMenu
}
@ -106,20 +80,20 @@ const app = {
}
})
})
let tabList = state.tabList || []
let tabList = this.tabList || []
// 过滤已经不能显示的菜单
tabList = tabList.filter((item) => {
return (
menus.filter((menu) => {
return (
menu.childs.filter((subMenu) => {
menu.childs.filter((subMenu: any) => {
return subMenu.path === item.path
}).length > 0
)
}).length > 0
)
})
commit('setManagementTabList', tabList)
this.tabList = tabList
if (!currentMenu) {
// 打开第一个菜单
resolve(firstMenu)
@ -137,44 +111,45 @@ const app = {
} else {
// 新增
tabList.push(tab)
commit('setManagementTabList', tabList)
this.tabList = tabList
}
// 设置当前选择的菜单
dispatch('activeManagementTabKey', tab.key)
dispatch('activeManagementMenu', tab.id)
resolve()
this.activeTabKey = tab.key
this.activeMenu = tab.id
resolve(true)
})
},
// 删除 tab
removeManagementTab({ commit, state, dispatch }, key) {
removeTab(key: string) {
return new Promise((resolve) => {
let tabList = state.tabList
let tabList = this.tabList
const index = tabList.findIndex((ele) => ele.key === key)
tabList.splice(index, 1)
commit('setManagementTabList', tabList)
localStorage.setItem(MANAGEMENT_TAB_LIST_KEY, JSON.stringify(tabList))
this.tabList = tabList
localStorage.setItem(TAB_LIST_KEY, JSON.stringify(tabList))
// 如果删除的是 activeTabKey
if (state.activeTabKey === key) {
if (this.activeTabKey === key) {
// 寻找下一个
const tempTab = tabList[Math.min(index, 0)]
// 如果还是原来激活的 tab 就不用更新
if (state.activeTabKey !== tempTab.key) {
dispatch('activeTabKey', tempTab.key)
resolve()
if (this.activeTabKey !== tempTab.key) {
this.activeTabKey = tempTab.key
resolve(true)
}
}
})
},
// 清除 tabs
clearManagementTabs({ commit, state, dispatch }, { key, position }) {
clearTabs({ key, position }: { key?: string; position?: string }) {
return new Promise((resolve) => {
let tabList = state.tabList
key = key || state.activeTabKey
let tabList = this.tabList
key = key || this.activeTabKey
if (key === 'all') {
// 清空全部
commit('setManagementTabList', [])
dispatch('activeTabKey', '')
this.tabList = []
this.activeTabKey = ''
localStorage.setItem(TAB_LIST_KEY, JSON.stringify(this.tabList))
return
}
// 找到当前 index
@ -191,56 +166,57 @@ const app = {
// 只保留当前
tabList = [currentTab]
}
commit('setManagementTabList', tabList)
localStorage.setItem(MANAGEMENT_TAB_LIST_KEY, JSON.stringify(tabList))
//
if (state.activeTabKey !== key) {
dispatch('activeManagementTabKey', key)
this.tabList = tabList
localStorage.setItem(TAB_LIST_KEY, JSON.stringify(tabList))
if (this.activeTabKey !== key) {
this.activeTabKey = key
resolve(key)
}
})
},
activeManagementTabKey({ commit }, key) {
commit('setManagementActiveTabKey', key)
localStorage.setItem(MANAGEMENT_ACTIVE_TAB_KEY, key)
setActiveTabKey(key: string) {
this.activeTabKey = key
localStorage.setItem(ACTIVE_TAB_KEY, key)
},
// 选中当前菜单
activeManagementMenu({ commit }, activeMenuKey) {
commit('setManagementActiveMenuKey', activeMenuKey)
localStorage.setItem(MANAGEMENT_ACTIVE_MENU_KEY, activeMenuKey)
setActiveMenu(activeMenuKey: string) {
this.activeMenuKey = activeMenuKey
localStorage.setItem(ACTIVE_MENU_KEY, activeMenuKey)
},
// 打开的菜单
menuManagementOpenKeys({ commit, state }, keys) {
setMenuOpenKeys(keys: string[] | string) {
if (Array.isArray(keys)) {
commit('setManagementMenuOpenKeys', keys)
} else if (typeof keys == 'string') {
const nowKeys = state.menuOpenKeys
if (!nowKeys.includes(keys)) {
nowKeys.push(keys)
commit('setManagementMenuOpenKeys', nowKeys)
this.menuOpenKeys = keys
} else {
{
const nowKeys = this.menuOpenKeys
if (!nowKeys.includes(keys)) {
nowKeys.push(keys)
this.menuOpenKeys = nowKeys
}
}
}
},
}
},
getters: {
getManagementMenus(state) {
getMenus(state) {
return state.menus
},
getManagementTabList(state) {
getTabList(state) {
return state.tabList
},
getManagementActiveTabKey(state) {
getActiveTabKey(state) {
return state.activeTabKey
},
getManagementActiveMenuKey(state) {
getActiveMenuKey(state) {
return state.activeMenuKey
},
getManagementMenuOpenKeys(state) {
getMenuOpenKeys(state) {
return state.menuOpenKeys
},
},
}
}
}
})
export default app
// export default useMenuStore()

View File

@ -3,13 +3,13 @@
* tab tab
* tab tab tab
*/
import { ACTIVE_TAB_KEY, TAB_LIST_KEY, ACTIVE_MENU_KEY } from '@/utils/const'
import { ACTIVE_MENU_KEY, ACTIVE_TAB_KEY, TAB_LIST_KEY } from '@/utils/const'
import { getMenu } from '@/api/menu'
import routeMenuMap from '@/router/route-menu'
import { defineStore } from 'pinia'
interface IState {
export interface IMenuState {
activeTabKey: string
tabList: any[]
activeMenuKey: string
@ -19,13 +19,13 @@ interface IState {
}
export const useMenuStore = defineStore('menu', {
state: (): IState => ({
state: (): IMenuState => ({
activeTabKey: localStorage.getItem(ACTIVE_TAB_KEY) || '',
tabList: localStorage.getItem(TAB_LIST_KEY) ? JSON.parse(localStorage.getItem(TAB_LIST_KEY)!) : [],
activeMenuKey: localStorage.getItem(ACTIVE_MENU_KEY) || '',
menuOpenKeys: [],
menus: [],
activeMenu: '',
activeMenu: ''
}),
actions: {
@ -33,7 +33,7 @@ export const useMenuStore = defineStore('menu', {
async loadSystemMenus() {
if (this.menus.length) {
// 避免重复加载
Promise.resolve(true)
return true
}
return await this.restLoadSystemMenus()
},
@ -48,13 +48,12 @@ export const useMenuStore = defineStore('menu', {
if (res.data) {
res.data?.forEach((element: any) => {
if (element.childs.length > 0) {
const childs = element.childs.map((child: any) => {
element.childs = element.childs.map((child: any) => {
return {
...child,
path: routeMenuMap[child.id],
path: routeMenuMap[child.id]
}
})
element.childs = childs
}
})
this.menus = res.data
@ -193,14 +192,16 @@ export const useMenuStore = defineStore('menu', {
setMenuOpenKeys(keys: string[] | string) {
if (Array.isArray(keys)) {
this.menuOpenKeys = keys
} else if (typeof keys == 'string') {
const nowKeys = this.menuOpenKeys
if (!nowKeys.includes(keys)) {
nowKeys.push(keys)
this.menuOpenKeys = nowKeys
} else {
{
const nowKeys = this.menuOpenKeys
if (!nowKeys.includes(keys)) {
nowKeys.push(keys)
this.menuOpenKeys = nowKeys
}
}
}
},
}
},
getters: {
getMenus(state) {
@ -218,8 +219,8 @@ export const useMenuStore = defineStore('menu', {
getMenuOpenKeys(state) {
return state.menuOpenKeys
},
},
}
}
})
// export default useMenuStore()

View File

@ -1,3 +1,5 @@
import { GlobalWindow } from '@/interface/common'
// 常量池
export const USER_NAME_KEY = 'Jpom-UserName'
@ -37,25 +39,29 @@ export const LOADING_TIP = 'loadingTip'
const cachePageLimitKeyName = 'page_limit'
export function getCachePageLimit() {
return parseInt(localStorage.getItem(cachePageLimitKeyName) || 10)
export function getCachePageLimit(): number {
return Number(localStorage.getItem(cachePageLimitKeyName) || 10)
}
/**
*
*/
export const PAGE_DEFAULT_SIZW_OPTIONS = ['5', '10', '15', '20', '25', '30', '35', '40', '50']
export const PAGE_DEFAULT_SIZW_OPTIONS: string[] = ['5', '10', '15', '20', '25', '30', '35', '40', '50']
/**
*
* @param {Number} total
* @returns String
*/
export function PAGE_DEFAULT_SHOW_TOTAL(total) {
export function PAGE_DEFAULT_SHOW_TOTAL(total: number) {
return `总计 ${total}`
}
export const PAGE_DEFAULT_LIST_QUERY = { page: 1, limit: isNaN(getCachePageLimit) ? 10 : getCachePageLimit, total: 0 }
export const PAGE_DEFAULT_LIST_QUERY = {
page: 1,
limit: isNaN(getCachePageLimit()) ? 10 : getCachePageLimit(),
total: 0
}
/**
*
@ -63,7 +69,7 @@ export const PAGE_DEFAULT_LIST_QUERY = { page: 1, limit: isNaN(getCachePageLimit
* @param {Array} pageSizeOptions
* @returns
*/
export function COMPUTED_PAGINATION(queryParam, pageSizeOptions) {
export function COMPUTED_PAGINATION(queryParam: any, pageSizeOptions: []) {
// console.log(queryParam);
const limit = queryParam.limit || PAGE_DEFAULT_LIST_QUERY.limit
const total = queryParam.total || 0
@ -77,7 +83,7 @@ export function COMPUTED_PAGINATION(queryParam, pageSizeOptions) {
showLessItems: true,
// 只有在分页条数在 小于 2 的时候隐藏,避免设置太大无法切回
hideOnSinglePage: limit <= 20,
showTotal: (total) => {
showTotal: (total: number) => {
return PAGE_DEFAULT_SHOW_TOTAL(total)
}
}
@ -89,7 +95,7 @@ export function COMPUTED_PAGINATION(queryParam, pageSizeOptions) {
* @param {JSON} param1
* @returns
*/
export function CHANGE_PAGE(listQuery, { pagination, sorter }) {
export function CHANGE_PAGE(listQuery: any, { pagination, sorter }: any) {
if (pagination && Object.keys(pagination).length) {
listQuery = { ...listQuery, page: pagination.current, limit: pagination.pageSize }
//
@ -198,7 +204,7 @@ export const ZIP_ACCEPT: string = '.tar,.bz2,.gz,.zip,.tar.bz2,.tar.gz'
/**
* mfa app
*/
export const MFA_APP_TIP_ARRAY = [
export const MFA_APP_TIP_ARRAY: string[] = [
'<strong>【推荐】微信小程序搜索 数盾OTP',
'<strong>【推荐】腾讯身份验证码</strong> 简单好用 <a href="https://a.app.qq.com/o/simple.jsp?pkgname=com.tencent.authenticator">Android</a>',
'<strong>Authy</strong> 功能丰富 专为两步验证码 <a href="https://authy.com/download/">iOS/Android/Windows/Mac/Linux</a> &nbsp; <a href="https://chrome.google.com/webstore/detail/authy/gaedmjdfmmahhbjefcbgaolhhanlaolb?hl=cn">Chrome 扩展</a>',
@ -253,8 +259,9 @@ export const PROJECT_DSL_DEFATUL =
* @returns
*/
export function getWebSocketUrl(url: string, parameter: any) {
const protocol = location.protocol === 'https:' ? 'wss://' : 'ws://'
const domain = window.routerBase
const protocol: string = location.protocol === 'https:' ? 'wss://' : 'ws://'
const _window: GlobalWindow = window as unknown as GlobalWindow
const domain: string = _window.routerBase
const fullUrl: string = (domain + url).replace(new RegExp('//', 'gm'), '/')
return `${protocol}${location.host}${fullUrl}?${parameter}`
}
@ -373,7 +380,7 @@ export function parseTime(time: string | number | Date | null, cFormat: string |
* @param defaultValue
* @returns
*/
export function renderSize(value, defaultValue = '-') {
export function renderSize(value: any, defaultValue = '-') {
return formatUnits(value, 1024, ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], defaultValue)
}
@ -383,7 +390,7 @@ export function renderSize(value, defaultValue = '-') {
* @param defaultValue
* @returns
*/
export function renderBpsSize(value, defaultValue = '-') {
export function renderBpsSize(value: any, defaultValue = '-') {
return formatUnits(value, 1024, ['bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], defaultValue)
}
@ -391,23 +398,25 @@ export function renderBpsSize(value, defaultValue = '-') {
*
* @param {*} value
* @param defaultValue
* @param unitArr
* @param base
* @returns
*/
export function formatUnits(value, base, unitArr, defaultValue = '-') {
export function formatUnits(value: any, base: number, unitArr: string[], defaultValue = '-') {
if (null == value || value === '') {
return defaultValue
}
var index = 0
var srcsize = parseFloat(value)
var index: number = 0
var srcsize: number = parseFloat(value)
if (srcsize <= 0) {
return defaultValue
}
// console.log(value, srcsize);
index = Math.floor(Math.log(srcsize) / Math.log(base))
var size = srcsize / Math.pow(base, index)
size = size.toFixed(2) //保留的小数位数
return size + unitArr[index]
var size: number = srcsize / Math.pow(base, index)
//保留的小数位数
return size.toFixed(2) + unitArr[index]
}
/**
@ -415,11 +424,11 @@ export function formatUnits(value, base, unitArr, defaultValue = '-') {
* @param {function} group
* @returns Object
*/
Array.prototype.groupBy = function (group) {
;(Array.prototype as any).groupBy = function (group: Function) {
return group && typeof group === 'function'
? Array.prototype.reduce.call(
this,
function (c, v) {
function (c: any, v) {
var k = group(v)
c[k] = v
return c
@ -429,12 +438,12 @@ Array.prototype.groupBy = function (group) {
: this
}
//
export function itemGroupBy(arr, groupKey, key, dataKey) {
export function itemGroupBy(arr: any[], groupKey: string, key: string, dataKey: string) {
key = key || 'type'
dataKey = dataKey || 'data'
let newArr = [],
types = {},
let newArr: any[] = [],
types: any = {},
// newItem,
i,
j,
@ -457,7 +466,7 @@ export function itemGroupBy(arr, groupKey, key, dataKey) {
* @param {String} levelCount
* @returns
*/
export function formatDuration(ms, seg, levelCount) {
export function formatDuration(ms: any, seg: string, levelCount: number) {
if (isNaN(Number(ms))) {
return ms
}
@ -479,7 +488,7 @@ export function formatDuration(ms, seg, levelCount) {
}
//小数转换为分数(小数先转换成number类型再乘以100并且保留2位小数)
export function formatPercent(point, keep = 2) {
export function formatPercent(point: any, keep = 2) {
if (!point) {
return '-'
}
@ -487,24 +496,24 @@ export function formatPercent(point, keep = 2) {
}
//小数转换为分数(小数先转换成number类型并且保留2位小数)
export function formatPercent2(point, keep = 2) {
export function formatPercent2(point: any, keep = 2) {
if (null == point) {
return '-'
}
var percent = Number(point).toFixed(keep)
var percent: string = Number(point).toFixed(keep)
percent += '%'
return percent
}
//小数转换为分数(小数先转换成number类型再乘以100并且保留2位小数)
export function formatPercent2Number(point, keep = 2) {
export function formatPercent2Number(point: any, keep = 2) {
if (null == point) {
return 0
}
return Number(Number(point).toFixed(keep))
}
export function compareVersion(version1, version2) {
export function compareVersion(version1: any, version2: any) {
if (version1 == null && version2 == null) {
return 0
} else if (version1 == null) {
@ -521,10 +530,11 @@ export function compareVersion(version1, version2) {
const v1s = version1.split('.')
const v2s = version2.split('.')
let diff = 0
const minLength = Math.min(v1s.length, v2s.length) // 取最小长度值
let diff: number = 0
const minLength: number = Math.min(v1s.length, v2s.length) // 取最小长度值
for (let i = 0; i < minLength; i++) {
let i: number
for (i = 0; i < minLength; i++) {
let v1 = v1s[i]
let v2 = v2s[i]
// 先比较长度
@ -544,13 +554,13 @@ export function compareVersion(version1, version2) {
// 当前页面构建信息
export function pageBuildInfo() {
const htmlVersion = document.head?.querySelector('[name~=jpom-version][content]')?.content
const buildTime = document.head?.querySelector('[name~=build-time][content]')?.content
const buildEnv = document.head?.querySelector('[name~=build-env][content]')?.content
const htmlVersion: any = document.head?.querySelector('[name~=jpom-version][content]')
const buildTime: any = document.head?.querySelector('[name~=build-time][content]')
const buildEnv: any = document.head?.querySelector('[name~=build-env][content]')
return {
v: htmlVersion,
t: buildTime,
e: buildEnv,
v: htmlVersion?.content,
t: buildTime?.content,
e: buildEnv?.content,
df: (document.title || '').toLowerCase().includes('jpom'),
t2: Date.now()
}

View File

@ -22,16 +22,16 @@
///
// https://github.com/hua1995116/ansi-color-parse
const ansiparse = function (str) {
const ansiparse:any = function (str:any) {
//
// I'm terrible at writing parsers.
//
var matchingControl = null,
matchingData = null,
matchingText = '',
ansiState = [],
result = [],
state = {},
matchingText: string = '',
ansiState: any[] = [],
result: any[] = [],
state: any = {},
eraseChar
//

View File

@ -21,7 +21,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import path from 'node:path'
import { defineConfig, loadEnv } from 'vite'
import { ConfigEnv, defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import { createHtmlPlugin } from 'vite-plugin-html'
@ -34,10 +34,10 @@ import Components from 'unplugin-vue-components/vite'
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
export default defineConfig(({ mode }: ConfigEnv) => {
// 加载环境配置
const env = loadEnv(mode, __dirname, 'JPOM')
const { JPOM_PROXY_HOST: HOST, JPOM_BASE_URL, JPOM_PORT } = env
const env: Record<string, string> = loadEnv(mode, __dirname, 'JPOM')
const { JPOM_PROXY_HOST: HOST, JPOM_BASE_URL, JPOM_PORT }: Record<string, string> = env
console.log(env, `当前为${mode}环境`)
return {
@ -56,7 +56,7 @@ export default defineConfig(({ mode }) => {
outDir: '../modules/server/src/main/resources/dist2'
},
server: {
port: JPOM_PORT,
port: Number(JPOM_PORT),
proxy: {
// websocket
'/ssh': {