refactor: 修改缓存加载逻辑.

This commit is contained in:
lijiahang
2023-12-04 14:35:18 +08:00
parent a22f30a8b4
commit f4b5ba168a
39 changed files with 278 additions and 332 deletions

View File

@@ -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');
}
/**

View File

@@ -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>;
}
/**

View File

@@ -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 } });
}