2024-04-12 15:23:15 +08:00
|
|
|
import type { DataGrid } from '@/types/global';
|
|
|
|
|
import type {
|
|
|
|
|
ExecHostLogQueryResponse,
|
2024-08-29 18:26:26 +08:00
|
|
|
ExecLogClearRequest,
|
2024-05-16 10:57:32 +08:00
|
|
|
ExecLogInterruptRequest,
|
2024-04-12 15:23:15 +08:00
|
|
|
ExecLogQueryRequest,
|
|
|
|
|
ExecLogQueryResponse,
|
|
|
|
|
ExecLogStatusResponse,
|
2025-06-25 14:49:36 +08:00
|
|
|
} from '../exec/exec-log';
|
2024-04-11 19:14:20 +08:00
|
|
|
import axios from 'axios';
|
|
|
|
|
import qs from 'query-string';
|
|
|
|
|
|
|
|
|
|
/**
|
2024-04-12 00:07:36 +08:00
|
|
|
* 分页查询计划任务日志
|
2024-04-11 19:14:20 +08:00
|
|
|
*/
|
2024-04-12 15:23:15 +08:00
|
|
|
export function getExecJobLogPage(request: ExecLogQueryRequest) {
|
2025-06-25 14:49:36 +08:00
|
|
|
return axios.post<DataGrid<ExecLogQueryResponse>>('/exec/exec-job-log/query', request);
|
2024-04-11 19:14:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-04-12 00:07:36 +08:00
|
|
|
* 查询计划任务日志
|
2024-04-11 19:14:20 +08:00
|
|
|
*/
|
|
|
|
|
export function getExecJobLog(id: number) {
|
2025-06-25 14:49:36 +08:00
|
|
|
return axios.get<ExecLogQueryResponse>('/exec/exec-job-log/get', { params: { id } });
|
2024-04-11 19:14:20 +08:00
|
|
|
}
|
|
|
|
|
|
2025-02-08 10:03:07 +08:00
|
|
|
/**
|
|
|
|
|
* 查询主机计划任务日志
|
|
|
|
|
*/
|
|
|
|
|
export function getExecJobHostLog(id: number) {
|
2025-06-25 14:49:36 +08:00
|
|
|
return axios.get<ExecHostLogQueryResponse>('/exec/exec-job-log/get-host', { params: { id } });
|
2025-02-08 10:03:07 +08:00
|
|
|
}
|
|
|
|
|
|
2024-04-11 19:14:20 +08:00
|
|
|
/**
|
2024-04-12 00:07:36 +08:00
|
|
|
* 查询主机计划任务日志
|
2024-04-11 19:14:20 +08:00
|
|
|
*/
|
|
|
|
|
export function getExecJobHostLogList(logId: number) {
|
2025-06-25 14:49:36 +08:00
|
|
|
return axios.get<Array<ExecHostLogQueryResponse>>('/exec/exec-job-log/host-list', { params: { logId } });
|
2024-04-11 19:14:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询命令执行状态
|
|
|
|
|
*/
|
|
|
|
|
export function getExecJobLogStatus(idList: Array<number>) {
|
2025-06-25 14:49:36 +08:00
|
|
|
return axios.get<ExecLogStatusResponse>('/exec/exec-job-log/status', {
|
2024-04-11 19:14:20 +08:00
|
|
|
params: { idList },
|
2024-12-03 11:28:58 +08:00
|
|
|
promptBizErrorMessage: false,
|
|
|
|
|
promptRequestErrorMessage: false,
|
2024-04-11 19:14:20 +08:00
|
|
|
paramsSerializer: params => {
|
|
|
|
|
return qs.stringify(params, { arrayFormat: 'comma' });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-04-12 00:07:36 +08:00
|
|
|
* 删除计划任务日志
|
2024-04-11 19:14:20 +08:00
|
|
|
*/
|
|
|
|
|
export function deleteExecJobLog(id: number) {
|
2025-06-25 14:49:36 +08:00
|
|
|
return axios.delete('/exec/exec-job-log/delete', { params: { id } });
|
2024-04-11 19:14:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-04-12 00:07:36 +08:00
|
|
|
* 批量删除计划任务日志
|
2024-04-11 19:14:20 +08:00
|
|
|
*/
|
|
|
|
|
export function batchDeleteExecJobLog(idList: Array<number>) {
|
2025-06-25 14:49:36 +08:00
|
|
|
return axios.delete('/exec/exec-job-log/batch-delete', {
|
2024-04-11 19:14:20 +08:00
|
|
|
params: { idList },
|
|
|
|
|
paramsSerializer: params => {
|
|
|
|
|
return qs.stringify(params, { arrayFormat: 'comma' });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-04-12 00:07:36 +08:00
|
|
|
* 删除主机计划任务日志
|
2024-04-11 19:14:20 +08:00
|
|
|
*/
|
|
|
|
|
export function deleteExecJobHostLog(id: number) {
|
2025-06-25 14:49:36 +08:00
|
|
|
return axios.delete('/exec/exec-job-log/delete-host', { params: { id } });
|
2024-04-11 19:14:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-04-12 00:07:36 +08:00
|
|
|
* 查询计划任务日志数量
|
2024-04-11 19:14:20 +08:00
|
|
|
*/
|
2024-04-12 15:23:15 +08:00
|
|
|
export function getExecJobLogCount(request: ExecLogQueryRequest) {
|
2025-06-25 14:49:36 +08:00
|
|
|
return axios.post<number>('/exec/exec-job-log/count', request);
|
2024-04-11 19:14:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-04-12 00:07:36 +08:00
|
|
|
* 清空计划任务日志
|
2024-04-11 19:14:20 +08:00
|
|
|
*/
|
2024-08-29 18:26:26 +08:00
|
|
|
export function clearExecJobLog(request: ExecLogClearRequest) {
|
2025-06-25 14:49:36 +08:00
|
|
|
return axios.post<number>('/exec/exec-job-log/clear', request, {
|
2025-01-17 09:56:30 +08:00
|
|
|
timeout: 60000,
|
|
|
|
|
});
|
2024-04-11 19:14:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-04-12 00:07:36 +08:00
|
|
|
* 查看计划任务日志
|
2024-04-11 19:14:20 +08:00
|
|
|
*/
|
2025-02-08 10:03:07 +08:00
|
|
|
export function getExecJobLogTailToken(id: number) {
|
2025-06-25 14:49:36 +08:00
|
|
|
return axios.get<string>('/exec/exec-job-log/tail', { params: { id } });
|
2024-04-11 19:14:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-04-12 00:07:36 +08:00
|
|
|
* 下载计划任务日志文件
|
2024-04-11 19:14:20 +08:00
|
|
|
*/
|
|
|
|
|
export function downloadExecJobLogFile(id: number) {
|
2025-06-25 14:49:36 +08:00
|
|
|
return axios.get('/exec/exec-job-log/download', {
|
2024-08-23 01:44:05 +08:00
|
|
|
unwrap: true,
|
|
|
|
|
responseType: 'blob',
|
|
|
|
|
params: { id },
|
|
|
|
|
});
|
2024-04-11 19:14:20 +08:00
|
|
|
}
|
2024-04-12 15:23:15 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 中断计划任务执行
|
|
|
|
|
*/
|
|
|
|
|
export function interruptExecJob(request: ExecLogInterruptRequest) {
|
2025-06-25 14:49:36 +08:00
|
|
|
return axios.put('/exec/exec-job-log/interrupt', request);
|
2024-04-12 15:23:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 中断计划任务执行主机
|
|
|
|
|
*/
|
|
|
|
|
export function interruptHostExecJob(request: ExecLogInterruptRequest) {
|
2025-06-25 14:49:36 +08:00
|
|
|
return axios.put('/exec/exec-job-log/interrupt-host', request);
|
2024-04-12 15:23:15 +08:00
|
|
|
}
|