🔨 优化安装逻辑.
This commit is contained in:
@@ -50,7 +50,7 @@ export interface HostAgentInstallStatusUpdateRequest {
|
||||
* 安装主机探针
|
||||
*/
|
||||
export function installHostAgent(request: HostInstallAgentRequest) {
|
||||
return axios.post('/asset/host-agent/install', request);
|
||||
return axios.post<Record<string, number>>('/asset/host-agent/install', request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -405,7 +405,6 @@
|
||||
} = useMonitorHostList({
|
||||
hosts: renderList,
|
||||
setLoading,
|
||||
reload,
|
||||
});
|
||||
|
||||
// 重置条件
|
||||
|
||||
@@ -456,7 +456,6 @@
|
||||
} = useMonitorHostList({
|
||||
hosts: tableRenderData,
|
||||
setLoading,
|
||||
reload,
|
||||
});
|
||||
|
||||
// 获取行样式
|
||||
|
||||
@@ -16,8 +16,6 @@ export interface UseMonitorHostListOptions {
|
||||
hosts: Ref<Array<MonitorHostQueryResponse>>;
|
||||
// 设置加载中
|
||||
setLoading: (loading: boolean) => void;
|
||||
// 重新加载
|
||||
reload: () => void;
|
||||
}
|
||||
|
||||
// 使用监控主机列表
|
||||
@@ -29,7 +27,7 @@ export default function useMonitorHostList(options: UseMonitorHostListOptions) {
|
||||
|
||||
const router = useRouter();
|
||||
const { toggleDict } = useDictStore();
|
||||
const { hosts, setLoading, reload } = options;
|
||||
const { hosts, setLoading } = options;
|
||||
|
||||
// 打开详情
|
||||
const openDetail = (hostId: number, name: string) => {
|
||||
@@ -65,10 +63,18 @@ export default function useMonitorHostList(options: UseMonitorHostListOptions) {
|
||||
onOk: async () => {
|
||||
try {
|
||||
// 调用安装
|
||||
await installHostAgent({ idList: hostIdList });
|
||||
const { data } = await installHostAgent({ idList: hostIdList });
|
||||
Message.success('开始安装');
|
||||
// 重新加载
|
||||
reload();
|
||||
// 设置状态
|
||||
installHosts.forEach(host => {
|
||||
const installId = data[host.agentKey];
|
||||
if (installId) {
|
||||
host.installLog = {
|
||||
id: installId,
|
||||
eventStatus: AgentLogStatus.WAIT,
|
||||
} as any;
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user