fix(workbench): reuse system reconnect notice
This commit is contained in:
@@ -26,6 +26,7 @@ import {
|
||||
MapSourceStatusNotice,
|
||||
MapToolbar,
|
||||
MapZoom,
|
||||
dismissMapNotice,
|
||||
showMapNotice,
|
||||
type MapToolbarItem,
|
||||
type MapSourceStatus
|
||||
@@ -166,6 +167,25 @@ export function MapWorkbenchPage({
|
||||
ScheduledConditionRecord[]
|
||||
>([]);
|
||||
const workbenchSync = useWorkbenchSync(getAccessToken);
|
||||
const workbenchSyncReconnecting =
|
||||
workbenchSync.status === "reconnecting" && workbenchSync.snapshot !== null;
|
||||
useEffect(() => {
|
||||
const noticeId = "workbench-sync-reconnecting";
|
||||
if (!workbenchSyncReconnecting) {
|
||||
dismissMapNotice(noticeId);
|
||||
return;
|
||||
}
|
||||
|
||||
showMapNotice({
|
||||
id: noticeId,
|
||||
tone: "warning",
|
||||
title: "业务同步正在重连",
|
||||
message: "当前数据可能陈旧,连接恢复后将自动更新。",
|
||||
duration: Infinity
|
||||
});
|
||||
|
||||
return () => dismissMapNotice(noticeId);
|
||||
}, [workbenchSyncReconnecting]);
|
||||
const {
|
||||
headerDataTime,
|
||||
scheduledConditions: runtimeScheduledConditions,
|
||||
@@ -1166,15 +1186,6 @@ export function MapWorkbenchPage({
|
||||
onLogout={onLogout}
|
||||
/>
|
||||
|
||||
{workbenchSync.status === "reconnecting" && workbenchSync.snapshot ? (
|
||||
<div
|
||||
role="status"
|
||||
className="absolute left-1/2 top-[3.7rem] z-[70] -translate-x-1/2 rounded-md border border-amber-300/70 bg-amber-50/95 px-3 py-1.5 text-xs font-medium text-amber-900 shadow-xs backdrop-blur"
|
||||
>
|
||||
正在重连,业务数据可能陈旧
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{analysisResultsPanelOpen || peripheralSamplePanelOpen ? (
|
||||
<div
|
||||
aria-hidden="true"
|
||||
|
||||
Reference in New Issue
Block a user