🔨 抽象执行日志.
This commit is contained in:
@@ -1,105 +1,41 @@
|
||||
import type { DataGrid, Pagination } from '@/types/global';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
import type { DataGrid } from '@/types/global';
|
||||
import type {
|
||||
ExecHostLogQueryResponse,
|
||||
ExecLogInterruptRequest,
|
||||
ExecLogQueryRequest,
|
||||
ExecLogQueryResponse,
|
||||
ExecLogStatusResponse,
|
||||
ExecLogTailRequest
|
||||
} from './exec-log';
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
/**
|
||||
* 批量执行日志查询请求
|
||||
*/
|
||||
export interface ExecCommandLogQueryRequest extends Pagination {
|
||||
id?: number;
|
||||
userId?: number;
|
||||
description?: string;
|
||||
command?: string;
|
||||
status?: string;
|
||||
startTimeRange?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量执行日志查询响应
|
||||
*/
|
||||
export interface ExecCommandLogQueryResponse extends TableData, ExecCommandLogQueryExtraResponse {
|
||||
id: number;
|
||||
userId: number;
|
||||
username: string;
|
||||
description: string;
|
||||
command: string;
|
||||
parameterSchema: string;
|
||||
timeout: number;
|
||||
status: string;
|
||||
startTime: number;
|
||||
finishTime: number;
|
||||
hostIdList: Array<number>;
|
||||
hosts: Array<ExecCommandHostLogQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量执行日志查询响应 拓展
|
||||
*/
|
||||
export interface ExecCommandLogQueryExtraResponse {
|
||||
hosts: Array<ExecCommandHostLogQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机批量执行日志查询响应
|
||||
*/
|
||||
export interface ExecCommandHostLogQueryResponse extends TableData {
|
||||
id: number;
|
||||
logId: number;
|
||||
hostId: number;
|
||||
hostName: string;
|
||||
hostAddress: string;
|
||||
status: string;
|
||||
command: string;
|
||||
parameter: string;
|
||||
exitStatus: number;
|
||||
errorMessage: string;
|
||||
startTime: number;
|
||||
finishTime: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量执行状态查询响应
|
||||
*/
|
||||
export interface ExecCommandLogStatusResponse {
|
||||
logList: Array<ExecCommandLogQueryResponse>;
|
||||
hostList: Array<ExecCommandHostLogQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量执行日志 tail 请求
|
||||
*/
|
||||
export interface ExecCommandLogTailRequest {
|
||||
execId?: number;
|
||||
hostExecIdList?: Array<number>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询批量执行日志
|
||||
*/
|
||||
export function getExecCommandLogPage(request: ExecCommandLogQueryRequest) {
|
||||
return axios.post<DataGrid<ExecCommandLogQueryResponse>>('/asset/exec-command-log/query', request);
|
||||
export function getExecCommandLogPage(request: ExecLogQueryRequest) {
|
||||
return axios.post<DataGrid<ExecLogQueryResponse>>('/asset/exec-command-log/query', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询批量执行日志
|
||||
*/
|
||||
export function getExecCommandLog(id: number) {
|
||||
return axios.get<ExecCommandLogQueryResponse>('/asset/exec-command-log/get', { params: { id } });
|
||||
return axios.get<ExecLogQueryResponse>('/asset/exec-command-log/get', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询主机批量执行日志
|
||||
*/
|
||||
export function getExecCommandHostLogList(logId: number) {
|
||||
return axios.get<Array<ExecCommandHostLogQueryResponse>>('/asset/exec-command-log/host-list', { params: { logId } });
|
||||
return axios.get<Array<ExecHostLogQueryResponse>>('/asset/exec-command-log/host-list', { params: { logId } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询命令执行状态
|
||||
*/
|
||||
export function getExecCommandLogStatus(idList: Array<number>) {
|
||||
return axios.get<ExecCommandLogStatusResponse>('/asset/exec-command-log/status', {
|
||||
return axios.get<ExecLogStatusResponse>('/asset/exec-command-log/status', {
|
||||
params: { idList },
|
||||
paramsSerializer: params => {
|
||||
return qs.stringify(params, { arrayFormat: 'comma' });
|
||||
@@ -111,7 +47,7 @@ export function getExecCommandLogStatus(idList: Array<number>) {
|
||||
* 查询历史批量执行日志
|
||||
*/
|
||||
export function getExecCommandLogHistory(limit: number) {
|
||||
return axios.get<Array<ExecCommandLogQueryResponse>>('/asset/exec-command-log/history', { params: { page: 1, limit } });
|
||||
return axios.get<Array<ExecLogQueryResponse>>('/asset/exec-command-log/history', { params: { page: 1, limit } });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,21 +79,21 @@ export function deleteExecCommandHostLog(id: number) {
|
||||
/**
|
||||
* 查询批量执行日志数量
|
||||
*/
|
||||
export function getExecCommandLogCount(request: ExecCommandLogQueryRequest) {
|
||||
export function getExecCommandLogCount(request: ExecLogQueryRequest) {
|
||||
return axios.post<number>('/asset/exec-command-log/query-count', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空批量执行日志
|
||||
*/
|
||||
export function clearExecCommandLog(request: ExecCommandLogQueryRequest) {
|
||||
export function clearExecCommandLog(request: ExecLogQueryRequest) {
|
||||
return axios.post<number>('/asset/exec-command-log/clear', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看批量执行日志
|
||||
*/
|
||||
export function getExecCommandLogTailToken(request: ExecCommandLogTailRequest) {
|
||||
export function getExecCommandLogTailToken(request: ExecLogTailRequest) {
|
||||
return axios.post<string>('/asset/exec-command-log/tail', request);
|
||||
}
|
||||
|
||||
@@ -167,3 +103,17 @@ export function getExecCommandLogTailToken(request: ExecCommandLogTailRequest) {
|
||||
export function downloadExecCommandLogFile(id: number) {
|
||||
return axios.get('/asset/exec-command-log/download', { unwrap: true, params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断执行命令
|
||||
*/
|
||||
export function interruptExecCommand(request: ExecLogInterruptRequest) {
|
||||
return axios.put('/asset/exec-command-log/interrupt', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断执行主机命令
|
||||
*/
|
||||
export function interruptHostExecCommand(request: ExecLogInterruptRequest) {
|
||||
return axios.put('/asset/exec-command-log/interrupt-host', request);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ExecCommandLogQueryResponse } from './exec-command-log';
|
||||
import type { ExecLogQueryResponse } from './exec-log';
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
@@ -13,38 +13,16 @@ export interface ExecCommandRequest {
|
||||
hostIdList?: Array<number>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断命令请求
|
||||
*/
|
||||
export interface ExecCommandInterruptRequest {
|
||||
logId?: number;
|
||||
hostLogId?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量执行命令
|
||||
*/
|
||||
export function batchExecCommand(request: ExecCommandRequest) {
|
||||
return axios.post<ExecCommandLogQueryResponse>('/asset/exec-command/exec', request);
|
||||
return axios.post<ExecLogQueryResponse>('/asset/exec-command/exec', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新执行命令
|
||||
*/
|
||||
export function reExecCommand(request: ExecCommandRequest) {
|
||||
return axios.post<ExecCommandLogQueryResponse>('/asset/exec-command/re-exec', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断执行命令
|
||||
*/
|
||||
export function interruptExecCommand(request: ExecCommandInterruptRequest) {
|
||||
return axios.put('/asset/exec-command/interrupt', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断执行主机命令
|
||||
*/
|
||||
export function interruptHostExecCommand(request: ExecCommandInterruptRequest) {
|
||||
return axios.put('/asset/exec-command/interrupt-host', request);
|
||||
return axios.post<ExecLogQueryResponse>('/asset/exec-command/re-exec', request);
|
||||
}
|
||||
|
||||
@@ -1,105 +1,41 @@
|
||||
import type { DataGrid, Pagination } from '@/types/global';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
import type { DataGrid } from '@/types/global';
|
||||
import type {
|
||||
ExecHostLogQueryResponse,
|
||||
ExecLogQueryRequest,
|
||||
ExecLogQueryResponse,
|
||||
ExecLogStatusResponse,
|
||||
ExecLogTailRequest,
|
||||
ExecLogInterruptRequest
|
||||
} from './exec-log';
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
/**
|
||||
* 计划任务日志查询请求
|
||||
*/
|
||||
export interface ExecJobLogQueryRequest extends Pagination {
|
||||
id?: number;
|
||||
userId?: number;
|
||||
description?: string;
|
||||
command?: string;
|
||||
status?: string;
|
||||
startTimeRange?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 计划任务日志查询响应
|
||||
*/
|
||||
export interface ExecJobLogQueryResponse extends TableData, ExecJobLogQueryExtraResponse {
|
||||
id: number;
|
||||
userId: number;
|
||||
username: string;
|
||||
description: string;
|
||||
command: string;
|
||||
parameterSchema: string;
|
||||
timeout: number;
|
||||
status: string;
|
||||
startTime: number;
|
||||
finishTime: number;
|
||||
hostIdList: Array<number>;
|
||||
hosts: Array<ExecJobHostLogQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计划任务日志查询响应 拓展
|
||||
*/
|
||||
export interface ExecJobLogQueryExtraResponse {
|
||||
hosts: Array<ExecJobHostLogQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机计划任务日志查询响应
|
||||
*/
|
||||
export interface ExecJobHostLogQueryResponse extends TableData {
|
||||
id: number;
|
||||
logId: number;
|
||||
hostId: number;
|
||||
hostName: string;
|
||||
hostAddress: string;
|
||||
status: string;
|
||||
command: string;
|
||||
parameter: string;
|
||||
exitStatus: number;
|
||||
errorMessage: string;
|
||||
startTime: number;
|
||||
finishTime: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计划任务状态查询响应
|
||||
*/
|
||||
export interface ExecJobLogStatusResponse {
|
||||
logList: Array<ExecJobLogQueryResponse>;
|
||||
hostList: Array<ExecJobHostLogQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计划任务日志 tail 请求
|
||||
*/
|
||||
export interface ExecJobLogTailRequest {
|
||||
execId?: number;
|
||||
hostExecIdList?: Array<number>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询计划任务日志
|
||||
*/
|
||||
export function getExecJobLogPage(request: ExecJobLogQueryRequest) {
|
||||
return axios.post<DataGrid<ExecJobLogQueryResponse>>('/asset/exec-job-log/query', request);
|
||||
export function getExecJobLogPage(request: ExecLogQueryRequest) {
|
||||
return axios.post<DataGrid<ExecLogQueryResponse>>('/asset/exec-job-log/query', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询计划任务日志
|
||||
*/
|
||||
export function getExecJobLog(id: number) {
|
||||
return axios.get<ExecJobLogQueryResponse>('/asset/exec-job-log/get', { params: { id } });
|
||||
return axios.get<ExecLogQueryResponse>('/asset/exec-job-log/get', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询主机计划任务日志
|
||||
*/
|
||||
export function getExecJobHostLogList(logId: number) {
|
||||
return axios.get<Array<ExecJobHostLogQueryResponse>>('/asset/exec-job-log/host-list', { params: { logId } });
|
||||
return axios.get<Array<ExecHostLogQueryResponse>>('/asset/exec-job-log/host-list', { params: { logId } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询命令执行状态
|
||||
*/
|
||||
export function getExecJobLogStatus(idList: Array<number>) {
|
||||
return axios.get<ExecJobLogStatusResponse>('/asset/exec-job-log/status', {
|
||||
return axios.get<ExecLogStatusResponse>('/asset/exec-job-log/status', {
|
||||
params: { idList },
|
||||
paramsSerializer: params => {
|
||||
return qs.stringify(params, { arrayFormat: 'comma' });
|
||||
@@ -136,21 +72,21 @@ export function deleteExecJobHostLog(id: number) {
|
||||
/**
|
||||
* 查询计划任务日志数量
|
||||
*/
|
||||
export function getExecJobLogCount(request: ExecJobLogQueryRequest) {
|
||||
export function getExecJobLogCount(request: ExecLogQueryRequest) {
|
||||
return axios.post<number>('/asset/exec-job-log/query-count', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空计划任务日志
|
||||
*/
|
||||
export function clearExecJobLog(request: ExecJobLogQueryRequest) {
|
||||
export function clearExecJobLog(request: ExecLogQueryRequest) {
|
||||
return axios.post<number>('/asset/exec-job-log/clear', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看计划任务日志
|
||||
*/
|
||||
export function getExecJobLogTailToken(request: ExecJobLogTailRequest) {
|
||||
export function getExecJobLogTailToken(request: ExecLogTailRequest) {
|
||||
return axios.post<string>('/asset/exec-job-log/tail', request);
|
||||
}
|
||||
|
||||
@@ -160,3 +96,17 @@ export function getExecJobLogTailToken(request: ExecJobLogTailRequest) {
|
||||
export function downloadExecJobLogFile(id: number) {
|
||||
return axios.get('/asset/exec-job-log/download', { unwrap: true, params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断计划任务执行
|
||||
*/
|
||||
export function interruptExecJob(request: ExecLogInterruptRequest) {
|
||||
return axios.put('/asset/exec-job-log/interrupt', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断计划任务执行主机
|
||||
*/
|
||||
export function interruptHostExecJob(request: ExecLogInterruptRequest) {
|
||||
return axios.put('/asset/exec-job-log/interrupt-host', request);
|
||||
}
|
||||
|
||||
@@ -89,6 +89,13 @@ export function getExecJob(id: number) {
|
||||
return axios.get<ExecJobQueryResponse>('/asset/exec-job/get', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部计划任务
|
||||
*/
|
||||
export function getExecJobList() {
|
||||
return axios.get<Array<ExecJobQueryResponse>>('/asset/exec-job/list');
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询计划任务
|
||||
*/
|
||||
|
||||
83
orion-ops-ui/src/api/exec/exec-log.ts
Normal file
83
orion-ops-ui/src/api/exec/exec-log.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
import type { Pagination } from '@/types/global';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
|
||||
/**
|
||||
* 执行日志查询请求
|
||||
*/
|
||||
export interface ExecLogQueryRequest extends Pagination {
|
||||
id?: number;
|
||||
userId?: number;
|
||||
sourceId?: number;
|
||||
description?: string;
|
||||
command?: string;
|
||||
status?: string;
|
||||
startTimeRange?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行日志查询响应
|
||||
*/
|
||||
export interface ExecLogQueryResponse extends TableData, ExecLogQueryExtraResponse {
|
||||
id: number;
|
||||
userId: number;
|
||||
username: string;
|
||||
description: string;
|
||||
execSeq: number;
|
||||
command: string;
|
||||
parameterSchema: string;
|
||||
timeout: number;
|
||||
status: string;
|
||||
startTime: number;
|
||||
finishTime: number;
|
||||
hostIdList: Array<number>;
|
||||
hosts: Array<ExecHostLogQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行日志查询响应 拓展
|
||||
*/
|
||||
export interface ExecLogQueryExtraResponse {
|
||||
hosts: Array<ExecHostLogQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机执行日志查询响应
|
||||
*/
|
||||
export interface ExecHostLogQueryResponse extends TableData {
|
||||
id: number;
|
||||
logId: number;
|
||||
hostId: number;
|
||||
hostName: string;
|
||||
hostAddress: string;
|
||||
status: string;
|
||||
command: string;
|
||||
parameter: string;
|
||||
exitStatus: number;
|
||||
errorMessage: string;
|
||||
startTime: number;
|
||||
finishTime: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行状态查询响应
|
||||
*/
|
||||
export interface ExecLogStatusResponse {
|
||||
logList: Array<ExecLogQueryResponse>;
|
||||
hostList: Array<ExecHostLogQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行日志 tail 请求
|
||||
*/
|
||||
export interface ExecLogTailRequest {
|
||||
execId?: number;
|
||||
hostExecIdList?: Array<number>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行中断命令请求
|
||||
*/
|
||||
export interface ExecLogInterruptRequest {
|
||||
logId?: number;
|
||||
hostLogId?: number;
|
||||
}
|
||||
Reference in New Issue
Block a user