fix: Fix action log popup with debounce

Fix action log popup with debounce

Change-Id: I412bb4091b987755c1be12b6eec353119de3c3e2
This commit is contained in:
xusongfu 2021-08-17 15:30:06 +08:00 committed by Jingwei.Zhang
parent f15ea203a2
commit 1491201580
2 changed files with 11 additions and 5 deletions

View File

@ -269,7 +269,7 @@
"Compute Services": "计算服务", "Compute Services": "计算服务",
"Compute Start Instance": "启动", "Compute Start Instance": "启动",
"Compute Stop Instance": "关闭", "Compute Stop Instance": "关闭",
"Compute Suspend Instance": "挂起", "Compute Suspend Instance": "云主机挂起",
"Compute Unpause Instance": "恢复", "Compute Unpause Instance": "恢复",
"Compute service:": "计算服务(nova):", "Compute service:": "计算服务(nova):",
"Conductor Live Migrate Instance": "执行热迁移实例", "Conductor Live Migrate Instance": "执行热迁移实例",

View File

@ -474,16 +474,22 @@ export const actionEvent = {
function PopUpContent({ id, requestId }) { function PopUpContent({ id, requestId }) {
const [event, setEvent] = useState([]); const [event, setEvent] = useState([]);
const [isLoading, setLoaidng] = useState(false); const [loading, setLoaidng] = useState(false);
useEffect(() => { useEffect(() => {
let timeout = null;
(async function () { (async function () {
setLoaidng(true); setLoaidng(true);
const cb = await globalActionLogStore.fetchDetail({ id, requestId }); const cb = await globalActionLogStore.fetchDetail({ id, requestId });
const { events = [] } = cb; const { events = [] } = cb;
setEvent(events.reverse()); timeout = setTimeout(() => {
setLoaidng(false); setLoaidng(false);
setEvent(events.slice().reverse());
}, 200);
})(); })();
return () => {
clearTimeout(timeout);
};
}, []); }, []);
const columns = [ const columns = [
{ {
@ -516,7 +522,7 @@ function PopUpContent({ id, requestId }) {
columns={columns} columns={columns}
dataSource={event} dataSource={event}
pagination={false} pagination={false}
loading={isLoading} loading={loading}
size="small" size="small"
rowKey="event" rowKey="event"
/> />