🔨 执行日志.
This commit is contained in:
@@ -1,135 +0,0 @@
|
||||
import type { DataGrid, Pagination } from '@/types/global';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
/**
|
||||
* 主机执行记录创建请求
|
||||
*/
|
||||
export interface ExecHostLogCreateRequest {
|
||||
logId?: number;
|
||||
hostId?: number;
|
||||
hostName?: string;
|
||||
status?: string;
|
||||
command?: string;
|
||||
parameter?: string;
|
||||
exitStatus?: number;
|
||||
logPath?: string;
|
||||
errorMessage?: string;
|
||||
startTime?: string;
|
||||
finishTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机执行记录更新请求
|
||||
*/
|
||||
export interface ExecHostLogUpdateRequest extends ExecHostLogCreateRequest {
|
||||
id?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机执行记录查询请求
|
||||
*/
|
||||
export interface ExecHostLogQueryRequest extends Pagination {
|
||||
searchValue?: string;
|
||||
id?: number;
|
||||
logId?: number;
|
||||
hostId?: number;
|
||||
hostName?: string;
|
||||
status?: string;
|
||||
command?: string;
|
||||
parameter?: string;
|
||||
exitStatus?: number;
|
||||
logPath?: string;
|
||||
errorMessage?: string;
|
||||
startTime?: string;
|
||||
finishTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机执行记录查询响应
|
||||
*/
|
||||
export interface ExecHostLogQueryResponse extends TableData {
|
||||
id: number;
|
||||
logId: number;
|
||||
hostId: number;
|
||||
hostName: string;
|
||||
status: string;
|
||||
command: string;
|
||||
parameter: string;
|
||||
exitStatus: number;
|
||||
logPath: string;
|
||||
errorMessage: string;
|
||||
startTime: number;
|
||||
finishTime: number;
|
||||
createTime: number;
|
||||
updateTime: number;
|
||||
creator: string;
|
||||
updater: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建主机执行记录
|
||||
*/
|
||||
export function createExecHostLog(request: ExecHostLogCreateRequest) {
|
||||
return axios.post('/asset/exec-host-log/create', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新主机执行记录
|
||||
*/
|
||||
export function updateExecHostLog(request: ExecHostLogUpdateRequest) {
|
||||
return axios.put('/asset/exec-host-log/update', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询主机执行记录
|
||||
*/
|
||||
export function getExecHostLog(id: number) {
|
||||
return axios.get<ExecHostLogQueryResponse>('/asset/exec-host-log/get', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询主机执行记录
|
||||
*/
|
||||
export function batchGetExecHostLogList(idList: Array<number>) {
|
||||
return axios.get<ExecHostLogQueryResponse[]>('/asset/exec-host-log/batch-get', {
|
||||
params: { idList },
|
||||
paramsSerializer: params => {
|
||||
return qs.stringify(params, { arrayFormat: 'comma' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部主机执行记录
|
||||
*/
|
||||
export function getExecHostLogList(request: ExecHostLogQueryRequest) {
|
||||
return axios.post<Array<ExecHostLogQueryResponse>>('/asset/exec-host-log/list', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询主机执行记录
|
||||
*/
|
||||
export function getExecHostLogPage(request: ExecHostLogQueryRequest) {
|
||||
return axios.post<DataGrid<ExecHostLogQueryResponse>>('/asset/exec-host-log/query', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除主机执行记录
|
||||
*/
|
||||
export function deleteExecHostLog(id: number) {
|
||||
return axios.delete('/asset/exec-host-log/delete', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除主机执行记录
|
||||
*/
|
||||
export function batchDeleteExecHostLog(idList: Array<number>) {
|
||||
return axios.delete('/asset/exec-host-log/batch-delete', {
|
||||
params: { idList },
|
||||
paramsSerializer: params => {
|
||||
return qs.stringify(params, { arrayFormat: 'comma' });
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -55,10 +55,11 @@ export interface ExecHostLogQueryResponse extends TableData {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询执行记录
|
||||
* 执行状态查询响应
|
||||
*/
|
||||
export function getExecLog(id: number) {
|
||||
return axios.get<ExecLogQueryResponse>('/asset/exec-log/get', { params: { id } });
|
||||
export interface ExecStatusResponse {
|
||||
logList: Array<ExecLogQueryResponse>;
|
||||
hostList: Array<ExecHostLogQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,6 +76,18 @@ export function getExecHostLogList(logId: number) {
|
||||
return axios.get<Array<ExecHostLogQueryResponse>>('/asset/exec-log/host-list', { params: { logId } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询命令执行状态
|
||||
*/
|
||||
export function getExecLogStatus(idList: Array<number>) {
|
||||
return axios.get<ExecStatusResponse>('/asset/exec-log/status', {
|
||||
params: { idList },
|
||||
paramsSerializer: params => {
|
||||
return qs.stringify(params, { arrayFormat: 'comma' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除执行记录
|
||||
*/
|
||||
@@ -93,3 +106,24 @@ export function batchDeleteExecLog(idList: Array<number>) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除主机执行记录
|
||||
*/
|
||||
export function deleteExecHostLog(id: number) {
|
||||
return axios.delete('/asset/exec-log/delete-host', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询操作日志数量
|
||||
*/
|
||||
export function getExecLogCount(request: ExecLogQueryRequest) {
|
||||
return axios.post<number>('/asset/exec-log/query-count', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空操作日志
|
||||
*/
|
||||
export function clearExecLog(request: ExecLogQueryRequest) {
|
||||
return axios.post<number>('/asset/exec-log/clear', request);
|
||||
}
|
||||
|
||||
53
orion-ops-ui/src/api/exec/exec.ts
Normal file
53
orion-ops-ui/src/api/exec/exec.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* 执行命令请求
|
||||
*/
|
||||
export interface ExecCommandRequest {
|
||||
templateId?: number;
|
||||
description?: string;
|
||||
timeout?: number;
|
||||
command?: string;
|
||||
parameter?: string;
|
||||
hostIdList?: number[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断命令请求
|
||||
*/
|
||||
export interface ExecInterruptRequest {
|
||||
logId?: number;
|
||||
hostLogId?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行命令响应
|
||||
*/
|
||||
export interface ExecCommandResponse {
|
||||
id: number;
|
||||
hosts: {
|
||||
id: number;
|
||||
hostId: number;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行命令
|
||||
*/
|
||||
export function execCommand(request: ExecCommandRequest) {
|
||||
return axios.post<ExecCommandResponse>('/asset/exec/exec-command', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断执行命令
|
||||
*/
|
||||
export function interruptExec(request: ExecInterruptRequest) {
|
||||
return axios.put('/asset/exec/interrupt', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断执行主机命令
|
||||
*/
|
||||
export function interruptHostExec(request: ExecInterruptRequest) {
|
||||
return axios.put('/asset/exec/interrupt-host', request);
|
||||
}
|
||||
Reference in New Issue
Block a user