refactor: 重构主机分组页面.
This commit is contained in:
9
orion-ops-ui/src/api/asset/asset-data.ts
Normal file
9
orion-ops-ui/src/api/asset/asset-data.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { HostGroupQueryResponse } from '@/api/asset/host-group';
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* 查询已授权的主机分组
|
||||
*/
|
||||
export function getAuthorizedHostGroup() {
|
||||
return axios.get<Array<HostGroupQueryResponse>>('/asset/authorized-data/host-group');
|
||||
}
|
||||
@@ -30,8 +30,10 @@ export interface HostGroupMoveRequest {
|
||||
*/
|
||||
export interface HostGroupQueryResponse {
|
||||
key: number;
|
||||
parentId: number;
|
||||
title: string;
|
||||
children: Array<HostGroupQueryResponse>;
|
||||
hosts: Array<number>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,6 +44,21 @@ export interface HostGroupRelUpdateRequest {
|
||||
hostIdList?: Array<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机分组授权 查询请求对象
|
||||
*/
|
||||
export interface HostGroupGrantQueryRequest {
|
||||
userId?: number;
|
||||
roleId?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机分组 授权请求对象
|
||||
*/
|
||||
export interface HostGroupGrantRequest extends HostGroupGrantQueryRequest {
|
||||
groupIdList?: Array<number>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建主机分组
|
||||
*/
|
||||
@@ -90,3 +107,17 @@ export function getHostGroupRelList(groupId: number) {
|
||||
export function updateHostGroupRel(request: HostGroupRelUpdateRequest) {
|
||||
return axios.put('/asset/host-group/update-rel', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已授权的分组
|
||||
*/
|
||||
export function getAuthorizedHostGroup(params: HostGroupGrantQueryRequest) {
|
||||
return axios.get<Array<number>>('/asset/host-group/get-authorized-group', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机分组授权
|
||||
*/
|
||||
export function grantHostGroup(request: HostGroupGrantRequest) {
|
||||
return axios.put('/asset/host-group/grant', request);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user