refactor: 修改缓存加载逻辑.
This commit is contained in:
@@ -5,18 +5,19 @@ import type { HostIdentityQueryResponse } from './host-identity';
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* 已授权的主机分组 查询响应
|
||||
* 已授权的主机 查询响应
|
||||
*/
|
||||
export interface AuthorizedHostGroupQueryResponse {
|
||||
export interface AuthorizedHostQueryResponse {
|
||||
groupTree: Array<HostGroupQueryResponse>;
|
||||
hostList: Array<HostQueryResponse>;
|
||||
treeNodes: Record<string, Array<number>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前用户已授权的主机分组
|
||||
* 查询当前用户已授权的主机
|
||||
*/
|
||||
export function getCurrentAuthorizedHostGroup() {
|
||||
return axios.get<AuthorizedHostGroupQueryResponse>('/asset/authorized-data/current-host-group');
|
||||
export function getCurrentAuthorizedHost() {
|
||||
return axios.get<AuthorizedHostQueryResponse>('/asset/authorized-data/current-host');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { HostQueryResponse } from './host';
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
@@ -34,7 +33,6 @@ export interface HostGroupQueryResponse {
|
||||
parentId: number;
|
||||
title: string;
|
||||
children: Array<HostGroupQueryResponse>;
|
||||
hostList: Array<HostQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import axios from 'axios';
|
||||
|
||||
export type TagType = 'HOST'
|
||||
export type TagType = 'HOST' | string
|
||||
|
||||
/**
|
||||
* tag 创建对象
|
||||
@@ -29,5 +29,5 @@ export function createTag(request: TagCreateRequest) {
|
||||
* 查询标签
|
||||
*/
|
||||
export function getTagList(type: TagType) {
|
||||
return axios.get<TagQueryResponse>('/infra/tag/list', { params: { type } });
|
||||
return axios.get<Array<TagQueryResponse>>('/infra/tag/list', { params: { type } });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user