From f5b281fc126b7824830467fa05a6a7bc4cc3f01c Mon Sep 17 00:00:00 2001 From: Miao Zhuang <1060950782@163.com> Date: Wed, 11 Jan 2023 15:53:31 +0800 Subject: [PATCH] fix: overview fetching job bug (#192) --- src/pages/ServiceManage/Overview/index.tsx | 11 ++++++++++- src/store/models/nebula.ts | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pages/ServiceManage/Overview/index.tsx b/src/pages/ServiceManage/Overview/index.tsx index 90995706..c022d387 100644 --- a/src/pages/ServiceManage/Overview/index.tsx +++ b/src/pages/ServiceManage/Overview/index.tsx @@ -61,6 +61,15 @@ const Overview: React.FC = (props: IProps) => { const [balancing, setBalancing] = useState(false); const modalHandler = useRef(); const [hosts, setHosts] = useState([]); + const nebulaRef = useRef<{ + currentSpace: any; + nebulaConnect: any; + }>({ + currentSpace, + nebulaConnect, + }); + nebulaRef.current.currentSpace = currentSpace; + nebulaRef.current.nebulaConnect = nebulaConnect; useEffect(() => { props.clear(); },[cluster]) @@ -127,7 +136,7 @@ const Overview: React.FC = (props: IProps) => { }; const getBalanceStatus = async () => { - if (!currentSpace||!nebulaConnect) return false; + if (!nebulaRef.current.currentSpace||!nebulaRef.current.nebulaConnect) return false; const { code,data } = await props.getJobs(); if (code === 0) { const hasRunningBalance = data.tables.find(item => item.Command.indexOf("BALANCE") && item.status === 'RUNNING'); diff --git a/src/store/models/nebula.ts b/src/store/models/nebula.ts index 1411fa6c..ed80911f 100644 --- a/src/store/models/nebula.ts +++ b/src/store/models/nebula.ts @@ -105,8 +105,8 @@ export function NebulaModelWrapper(serviceApi, state, _effects) { this.update({ parts: data.tables, }); + return data.tables; } - return data.tables; }, async asyncGetServices() {