2022-08-18 18:54:21 +08:00
|
|
|
import http from '@/api';
|
2023-02-13 17:13:55 +08:00
|
|
|
import { ResPage } from '../interface';
|
|
|
|
import { Command } from '../interface/command';
|
|
|
|
import { Group } from '../interface/group';
|
2022-08-18 18:54:21 +08:00
|
|
|
import { Host } from '../interface/host';
|
|
|
|
|
2022-09-01 16:52:58 +08:00
|
|
|
export const getHostTree = (params: Host.ReqSearch) => {
|
2022-08-30 18:49:07 +08:00
|
|
|
return http.post<Array<Host.HostTree>>(`/hosts/search`, params);
|
2022-08-18 18:54:21 +08:00
|
|
|
};
|
2022-08-31 23:16:10 +08:00
|
|
|
export const getHostInfo = (id: number) => {
|
|
|
|
return http.get<Host.Host>(`/hosts/` + id);
|
|
|
|
};
|
2022-08-18 18:54:21 +08:00
|
|
|
export const addHost = (params: Host.HostOperate) => {
|
|
|
|
return http.post<Host.HostOperate>(`/hosts`, params);
|
|
|
|
};
|
2023-01-03 14:37:17 +08:00
|
|
|
export const testByInfo = (params: Host.HostConnTest) => {
|
|
|
|
return http.post<boolean>(`/hosts/test/byinfo`, params);
|
|
|
|
};
|
|
|
|
export const testByID = (id: number) => {
|
|
|
|
return http.post<boolean>(`/hosts/test/byid/${id}`);
|
2022-09-01 10:25:38 +08:00
|
|
|
};
|
2022-08-18 18:54:21 +08:00
|
|
|
export const editHost = (params: Host.HostOperate) => {
|
2022-12-13 18:54:28 +08:00
|
|
|
return http.post(`/hosts/update`, params);
|
2022-08-18 18:54:21 +08:00
|
|
|
};
|
2022-08-31 23:16:10 +08:00
|
|
|
export const deleteHost = (id: number) => {
|
2022-12-13 18:54:28 +08:00
|
|
|
return http.post(`/hosts/del`, { id: id });
|
2022-08-18 18:54:21 +08:00
|
|
|
};
|
2023-02-13 17:13:55 +08:00
|
|
|
|
|
|
|
// group
|
|
|
|
export const getGroupList = (params: Group.GroupSearch) => {
|
|
|
|
return http.post<Array<Group.GroupInfo>>(`/hosts/group/search`, params);
|
|
|
|
};
|
|
|
|
export const addGroup = (params: Group.GroupOperate) => {
|
|
|
|
return http.post<Group.GroupOperate>(`/hosts/group`, params);
|
|
|
|
};
|
|
|
|
export const editGroup = (params: Group.GroupOperate) => {
|
|
|
|
return http.post(`/hosts/group/update`, params);
|
|
|
|
};
|
|
|
|
export const deleteGroup = (id: number) => {
|
|
|
|
return http.post(`/hosts/group/del`, { id: id });
|
|
|
|
};
|
|
|
|
|
|
|
|
// command
|
|
|
|
export const getCommandList = () => {
|
|
|
|
return http.get<Array<Command.CommandInfo>>(`/hosts/command`, {});
|
|
|
|
};
|
|
|
|
export const getCommandPage = (params: Command.CommandSearch) => {
|
|
|
|
return http.post<ResPage<Command.CommandInfo>>(`/hosts/command/search`, params);
|
|
|
|
};
|
|
|
|
export const addCommand = (params: Command.CommandOperate) => {
|
|
|
|
return http.post<Command.CommandOperate>(`/hosts/command`, params);
|
|
|
|
};
|
|
|
|
export const editCommand = (params: Command.CommandOperate) => {
|
|
|
|
return http.post(`/hosts/command/update`, params);
|
|
|
|
};
|
|
|
|
export const deleteCommand = (params: { ids: number[] }) => {
|
|
|
|
return http.post(`/hosts/command/del`, params);
|
|
|
|
};
|