feat: 命令片段.
This commit is contained in:
52
orion-ops-ui/src/api/asset/command-snippet-group.ts
Normal file
52
orion-ops-ui/src/api/asset/command-snippet-group.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* 命令片段分组创建请求
|
||||
*/
|
||||
export interface CommandSnippetGroupCreateRequest {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 命令片段分组更新请求
|
||||
*/
|
||||
export interface CommandSnippetGroupUpdateRequest extends CommandSnippetGroupCreateRequest {
|
||||
id?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 命令片段分组查询响应
|
||||
*/
|
||||
export interface CommandSnippetGroupQueryResponse {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建命令片段分组
|
||||
*/
|
||||
export function createCommandSnippetGroup(request: CommandSnippetGroupCreateRequest) {
|
||||
return axios.post('/asset/command-snippet-group/create', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新命令片段分组
|
||||
*/
|
||||
export function updateCommandSnippetGroup(request: CommandSnippetGroupUpdateRequest) {
|
||||
return axios.put('/asset/command-snippet-group/update', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部命令片段分组
|
||||
*/
|
||||
export function getCommandSnippetGroupList() {
|
||||
return axios.get<Array<CommandSnippetGroupQueryResponse>>('/asset/command-snippet-group/list');
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除命令片段分组
|
||||
*/
|
||||
export function deleteCommandSnippetGroup(id: number) {
|
||||
return axios.delete('/asset/command-snippet-group/delete', { params: { id } });
|
||||
}
|
||||
|
||||
65
orion-ops-ui/src/api/asset/command-snippet.ts
Normal file
65
orion-ops-ui/src/api/asset/command-snippet.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import type { CommandSnippetGroupQueryResponse } from './command-snippet-group';
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* 命令片段创建请求
|
||||
*/
|
||||
export interface CommandSnippetCreateRequest {
|
||||
groupId?: number;
|
||||
name?: string;
|
||||
command?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 命令片段更新请求
|
||||
*/
|
||||
export interface CommandSnippetUpdateRequest extends CommandSnippetCreateRequest {
|
||||
id?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 命令片段查询响应
|
||||
*/
|
||||
export interface CommandSnippetQueryResponse {
|
||||
id: number;
|
||||
groupId: number;
|
||||
name: string;
|
||||
command: string;
|
||||
expand?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 命令片段查询响应
|
||||
*/
|
||||
export interface CommandSnippetWrapperResponse {
|
||||
groups: Array<CommandSnippetGroupQueryResponse>;
|
||||
items: Array<CommandSnippetQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建命令片段
|
||||
*/
|
||||
export function createCommandSnippet(request: CommandSnippetCreateRequest) {
|
||||
return axios.post('/asset/command-snippet/create', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新命令片段
|
||||
*/
|
||||
export function updateCommandSnippet(request: CommandSnippetUpdateRequest) {
|
||||
return axios.put('/asset/command-snippet/update', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部命令片段
|
||||
*/
|
||||
export function getCommandSnippetList() {
|
||||
return axios.get<Array<CommandSnippetQueryResponse>>('/asset/command-snippet/list');
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除命令片段
|
||||
*/
|
||||
export function deleteCommandSnippet(id: number) {
|
||||
return axios.delete('/asset/command-snippet/delete', { params: { id } });
|
||||
}
|
||||
Reference in New Issue
Block a user