🔨 定时执行配置.
This commit is contained in:
@@ -4,7 +4,7 @@ import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
/**
|
||||
* 执行记录查询请求
|
||||
* 批量执行日志查询请求
|
||||
*/
|
||||
export interface ExecCommandLogQueryRequest extends Pagination {
|
||||
id?: number;
|
||||
@@ -16,7 +16,7 @@ export interface ExecCommandLogQueryRequest extends Pagination {
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行记录查询响应
|
||||
* 批量执行日志查询响应
|
||||
*/
|
||||
export interface ExecCommandLogQueryResponse extends TableData, ExecCommandLogQueryExtraResponse {
|
||||
id: number;
|
||||
@@ -34,14 +34,14 @@ export interface ExecCommandLogQueryResponse extends TableData, ExecCommandLogQu
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行记录查询响应 拓展
|
||||
* 批量执行日志查询响应 拓展
|
||||
*/
|
||||
export interface ExecCommandLogQueryExtraResponse {
|
||||
hosts: Array<ExecCommandHostLogQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机执行记录查询响应
|
||||
* 主机批量执行日志查询响应
|
||||
*/
|
||||
export interface ExecCommandHostLogQueryResponse extends TableData {
|
||||
id: number;
|
||||
@@ -59,7 +59,7 @@ export interface ExecCommandHostLogQueryResponse extends TableData {
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行状态查询响应
|
||||
* 批量执行状态查询响应
|
||||
*/
|
||||
export interface ExecCommandLogStatusResponse {
|
||||
logList: Array<ExecCommandLogQueryResponse>;
|
||||
@@ -67,7 +67,7 @@ export interface ExecCommandLogStatusResponse {
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断命令请求
|
||||
* 批量执行日志 tail 请求
|
||||
*/
|
||||
export interface ExecCommandLogTailRequest {
|
||||
execId?: number;
|
||||
@@ -75,21 +75,21 @@ export interface ExecCommandLogTailRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询执行记录
|
||||
* 分页查询批量执行日志
|
||||
*/
|
||||
export function getExecCommandLogPage(request: ExecCommandLogQueryRequest) {
|
||||
return axios.post<DataGrid<ExecCommandLogQueryResponse>>('/asset/exec-command-log/query', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询执行记录
|
||||
* 查询批量执行日志
|
||||
*/
|
||||
export function getExecCommandLog(id: number) {
|
||||
return axios.get<ExecCommandLogQueryResponse>('/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 } });
|
||||
@@ -108,21 +108,21 @@ 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 } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除执行记录
|
||||
* 删除批量执行日志
|
||||
*/
|
||||
export function deleteExecCommandLog(id: number) {
|
||||
return axios.delete('/asset/exec-command-log/delete', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除执行记录
|
||||
* 批量删除批量执行日志
|
||||
*/
|
||||
export function batchDeleteExecCommandLog(idList: Array<number>) {
|
||||
return axios.delete('/asset/exec-command-log/batch-delete', {
|
||||
@@ -134,35 +134,35 @@ export function batchDeleteExecCommandLog(idList: Array<number>) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除主机执行记录
|
||||
* 删除主机批量执行日志
|
||||
*/
|
||||
export function deleteExecCommandHostLog(id: number) {
|
||||
return axios.delete('/asset/exec-command-log/delete-host', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询操作日志数量
|
||||
* 查询批量执行日志数量
|
||||
*/
|
||||
export function getExecCommandLogCount(request: ExecCommandLogQueryRequest) {
|
||||
return axios.post<number>('/asset/exec-command-log/query-count', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空操作日志
|
||||
* 清空批量执行日志
|
||||
*/
|
||||
export function clearExecCommandLog(request: ExecCommandLogQueryRequest) {
|
||||
return axios.post<number>('/asset/exec-command-log/clear', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看执行日志
|
||||
* 查看批量执行日志
|
||||
*/
|
||||
export function getExecCommandLogTailToken(request: ExecCommandLogTailRequest) {
|
||||
return axios.post<string>('/asset/exec-command-log/tail', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载执行日志文件
|
||||
* 下载批量执行日志文件
|
||||
*/
|
||||
export function downloadExecCommandLogFile(id: number) {
|
||||
return axios.get('/asset/exec-command-log/download', { unwrap: true, params: { id } });
|
||||
|
||||
162
orion-ops-ui/src/api/exec/exec-job-log.ts
Normal file
162
orion-ops-ui/src/api/exec/exec-job-log.ts
Normal file
@@ -0,0 +1,162 @@
|
||||
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 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 getExecJobLog(id: number) {
|
||||
return axios.get<ExecJobLogQueryResponse>('/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 } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询命令执行状态
|
||||
*/
|
||||
export function getExecJobLogStatus(idList: Array<number>) {
|
||||
return axios.get<ExecJobLogStatusResponse>('/asset/exec-job-log/status', {
|
||||
params: { idList },
|
||||
paramsSerializer: params => {
|
||||
return qs.stringify(params, { arrayFormat: 'comma' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除计划执行日志
|
||||
*/
|
||||
export function deleteExecJobLog(id: number) {
|
||||
return axios.delete('/asset/exec-job-log/delete', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除计划执行日志
|
||||
*/
|
||||
export function batchDeleteExecJobLog(idList: Array<number>) {
|
||||
return axios.delete('/asset/exec-job-log/batch-delete', {
|
||||
params: { idList },
|
||||
paramsSerializer: params => {
|
||||
return qs.stringify(params, { arrayFormat: 'comma' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除主机计划执行日志
|
||||
*/
|
||||
export function deleteExecJobHostLog(id: number) {
|
||||
return axios.delete('/asset/exec-job-log/delete-host', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询计划执行日志数量
|
||||
*/
|
||||
export function getExecJobLogCount(request: ExecJobLogQueryRequest) {
|
||||
return axios.post<number>('/asset/exec-job-log/query-count', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空计划执行日志
|
||||
*/
|
||||
export function clearExecJobLog(request: ExecJobLogQueryRequest) {
|
||||
return axios.post<number>('/asset/exec-job-log/clear', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看计划执行日志
|
||||
*/
|
||||
export function getExecJobLogTailToken(request: ExecJobLogTailRequest) {
|
||||
return axios.post<string>('/asset/exec-job-log/tail', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载计划执行日志文件
|
||||
*/
|
||||
export function downloadExecJobLogFile(id: number) {
|
||||
return axios.get('/asset/exec-job-log/download', { unwrap: true, params: { id } });
|
||||
}
|
||||
111
orion-ops-ui/src/api/exec/exec-job.ts
Normal file
111
orion-ops-ui/src/api/exec/exec-job.ts
Normal file
@@ -0,0 +1,111 @@
|
||||
import type { DataGrid, Pagination } from '@/types/global';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
import type { HostQueryResponse } from '@/api/asset/host';
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* 计划执行创建请求
|
||||
*/
|
||||
export interface ExecJobCreateRequest {
|
||||
name?: string;
|
||||
expression?: string;
|
||||
timeout?: number;
|
||||
command?: string;
|
||||
parameterSchema?: string;
|
||||
hostIdList?: Array<number>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计划执行更新请求
|
||||
*/
|
||||
export interface ExecJobUpdateRequest extends ExecJobCreateRequest {
|
||||
id?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计划执行状态更新请求
|
||||
*/
|
||||
export interface ExecJobUpdateStatusRequest {
|
||||
id: number;
|
||||
status: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计划执行查询请求
|
||||
*/
|
||||
export interface ExecJobQueryRequest extends Pagination {
|
||||
id?: number;
|
||||
name?: string;
|
||||
command?: string;
|
||||
status?: number;
|
||||
queryRecentLog?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计划执行查询响应
|
||||
*/
|
||||
export interface ExecJobQueryResponse extends TableData {
|
||||
id: number;
|
||||
name: string;
|
||||
expression: string;
|
||||
timeout: number;
|
||||
command: string;
|
||||
parameterSchema: string;
|
||||
status: number;
|
||||
recentLogId: number;
|
||||
recentLogStatus: string;
|
||||
recentLogTime: number;
|
||||
createTime: number;
|
||||
updateTime: number;
|
||||
hostIdList: Array<number>;
|
||||
hostList: Array<HostQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建计划执行
|
||||
*/
|
||||
export function createExecJob(request: ExecJobCreateRequest) {
|
||||
return axios.post('/asset/exec-job/create', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新计划执行
|
||||
*/
|
||||
export function updateExecJob(request: ExecJobUpdateRequest) {
|
||||
return axios.put('/asset/exec-job/update', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新计划执行状态
|
||||
*/
|
||||
export function updateExecJobStatus(request: ExecJobUpdateStatusRequest) {
|
||||
return axios.put('/asset/exec-job/update-status', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询计划执行
|
||||
*/
|
||||
export function getExecJob(id: number) {
|
||||
return axios.get<ExecJobQueryResponse>('/asset/exec-job/get', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询计划执行
|
||||
*/
|
||||
export function getExecJobPage(request: ExecJobQueryRequest) {
|
||||
return axios.post<DataGrid<ExecJobQueryResponse>>('/asset/exec-job/query', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除计划执行
|
||||
*/
|
||||
export function deleteExecJob(id: number) {
|
||||
return axios.delete('/asset/exec-job/delete', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动触发计划执行任务
|
||||
*/
|
||||
export function triggerExecJob(id: number) {
|
||||
return axios.post('/asset/exec-job/trigger', { id });
|
||||
}
|
||||
24
orion-ops-ui/src/api/meta/expression.ts
Normal file
24
orion-ops-ui/src/api/meta/expression.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* cron 下次执行时间请求对象
|
||||
*/
|
||||
export interface CronNextRequest {
|
||||
expression: number;
|
||||
times: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* cron 下次执行时间响应对象
|
||||
*/
|
||||
export interface CronNextResponse {
|
||||
valid: boolean;
|
||||
next: Array<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 cron 下次执行时间
|
||||
*/
|
||||
export function getCronNextTime(request: CronNextRequest) {
|
||||
return axios.get<CronNextResponse>('/infra/expression/cron-next', { params: request });
|
||||
}
|
||||
Reference in New Issue
Block a user