From 0dc3d3206b10a9938cdbf0772a6e8f0cc0fb1343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E5=AE=B6=E6=97=AD?= Date: Fri, 18 Aug 2023 23:45:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=BB=E6=9C=BA?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=80=89=E6=8B=A9=E6=A8=A1=E6=80=81=E6=A1=86?= =?UTF-8?q?=EF=BC=8C=E5=9C=A8=E6=B2=A1=E6=9C=89=E6=8B=89=E5=88=B0=E4=B8=BB?= =?UTF-8?q?=E6=9C=BA=E5=88=97=E8=A1=A8=E6=95=B0=E6=8D=AE=E5=89=8D=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E9=A1=B5=E9=9D=A2=EF=BC=8C=E5=AF=BC=E8=87=B4=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes 583 --- .../src/pages/deploy/request/HostSelector.js | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/spug_web/src/pages/deploy/request/HostSelector.js b/spug_web/src/pages/deploy/request/HostSelector.js index 882d659..0dd4fbe 100644 --- a/spug_web/src/pages/deploy/request/HostSelector.js +++ b/spug_web/src/pages/deploy/request/HostSelector.js @@ -1,14 +1,19 @@ import React, { useState, useEffect } from 'react'; import { observer } from 'mobx-react'; -import { Modal, Table, Button, Alert } from 'antd'; +import {Modal, Table, Button, Alert, Spin, Space} from 'antd'; import hostStore from 'pages/host/store'; import lds from 'lodash'; export default observer(function (props) { const [selectedRowKeys, setSelectedRowKeys] = useState(props.host_ids || []); + const [isLoading, setIsLoading] = useState(true); useEffect(() => { - hostStore.initial() + // 增加异步逻辑,以修复页面在初次载入时主机列表弹框看不到主机信息的问题 + hostStore.initial().then(() => { + // 异步执行完后,去除 loading 状态 + setIsLoading(false) + }) }, []) function handleClickRow(record) { @@ -32,6 +37,26 @@ export default observer(function (props) { } } + // 若主机列表数据未加载完成,则返回 loading 状态 + if (isLoading) { + return ( + + + + + + ) + } + return (