From f5eb5e7cdbd941d58b7a73de46523d77bf349827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B0=E6=9C=94?= <565183519@qq.com> Date: Tue, 4 Aug 2026 21:11:26 +0800 Subject: [PATCH] fix: project live enterprise domain state --- .../src/components/HoloLakeHome.test.tsx | 41 +++++++++++++++++++ .../src/components/HoloLakeHome.tsx | 4 +- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/product-source/hololake-platform/src/components/HoloLakeHome.test.tsx b/product-source/hololake-platform/src/components/HoloLakeHome.test.tsx index ab845db..8bad2ec 100644 --- a/product-source/hololake-platform/src/components/HoloLakeHome.test.tsx +++ b/product-source/hololake-platform/src/components/HoloLakeHome.test.tsx @@ -11,6 +11,7 @@ const { openExternalUrlMock, planGuanghuLivingSystemMock, trackEventMock, + useGuanghuEnterpriseStatusMock, useGuanghuRouterMock, useGuanghuWorldLoginMock, } = vi.hoisted(() => ({ @@ -18,6 +19,7 @@ const { openExternalUrlMock: vi.fn().mockResolvedValue(undefined), planGuanghuLivingSystemMock: vi.fn(), trackEventMock: vi.fn(), + useGuanghuEnterpriseStatusMock: vi.fn(), useGuanghuRouterMock: vi.fn(), useGuanghuWorldLoginMock: vi.fn(), })) @@ -27,6 +29,9 @@ vi.mock('../utils/planGuanghuLivingSystem', () => ({ planGuanghuLivingSystem: planGuanghuLivingSystemMock, })) vi.mock('../lib/telemetry', () => ({ trackEvent: trackEventMock })) +vi.mock('../hooks/useGuanghuEnterpriseStatus', () => ({ + useGuanghuEnterpriseStatus: useGuanghuEnterpriseStatusMock, +})) vi.mock('../hooks/useGuanghuRouter', () => ({ useGuanghuRouter: useGuanghuRouterMock })) vi.mock('../hooks/useGuanghuWorldLogin', () => ({ useGuanghuWorldLogin: useGuanghuWorldLoginMock, @@ -100,6 +105,15 @@ describe('HoloLakeHome', () => { }) useGuanghuRouterMock.mockReturnValue(offlineRouter()) useGuanghuWorldLoginMock.mockReturnValue(worldLogin()) + useGuanghuEnterpriseStatusMock.mockReturnValue({ + refresh: vi.fn(), + state: { + checkedAt: null, + error: null, + phase: 'checking', + status: null, + }, + }) planGuanghuLivingSystemMock.mockResolvedValue({ source: 'model', plan: { @@ -334,6 +348,33 @@ describe('HoloLakeHome', () => { expect(screen.queryByText('BS-SH-005')).not.toBeInTheDocument() }) + it('projects the live public enterprise domain state instead of a permanent placeholder', () => { + useGuanghuEnterpriseStatusMock.mockReturnValue({ + refresh: vi.fn(), + state: { + checkedAt: 1_785_399_662_000, + error: null, + phase: 'online', + status: { + domains: [ + { accessState: 'ONLINE_READ_ONLY', id: 'DOMAIN-MAIN', name: '光湖主域' }, + { accessState: 'ONLINE_READ_ONLY', id: 'DOMAIN-SUB', name: '光湖分域' }, + { accessState: 'ONLINE_READ_ONLY', id: 'DOMAIN-ZERO', name: '光湖零域' }, + { accessState: 'ONLINE_READ_ONLY', id: 'DOMAIN-ZS', name: '零感域' }, + ], + execution: 'disabled', + hostState: 'ONLINE', + nodeId: 'AW-GZ-001', + }, + }, + }) + + render() + + expect(useGuanghuEnterpriseStatusMock).toHaveBeenCalledOnce() + expect(screen.getAllByText('在线只读')).toHaveLength(4) + }) + it('opens the origin channel directly from the zero-point core', () => { render() diff --git a/product-source/hololake-platform/src/components/HoloLakeHome.tsx b/product-source/hololake-platform/src/components/HoloLakeHome.tsx index d083484..faab65c 100644 --- a/product-source/hololake-platform/src/components/HoloLakeHome.tsx +++ b/product-source/hololake-platform/src/components/HoloLakeHome.tsx @@ -8,7 +8,7 @@ import { openExternalUrl } from '../utils/url' import { useGuanghuRouter } from '../hooks/useGuanghuRouter' import { useGuanghuShanghaiNode } from '../hooks/useGuanghuShanghaiNode' import { useGuanghuWorldLogin } from '../hooks/useGuanghuWorldLogin' -import { INITIAL_GUANGHU_ENTERPRISE_STATE } from '../lib/guanghuEnterprise' +import { useGuanghuEnterpriseStatus } from '../hooks/useGuanghuEnterpriseStatus' import type { AiModelTarget } from '../lib/aiTargets' import { createDeterministicLivingSystemPlan, @@ -110,7 +110,7 @@ export function HoloLakeHome({ >({ status: 'checking' }) const router = useGuanghuRouter() const login = useGuanghuWorldLogin() - const enterprise = { state: INITIAL_GUANGHU_ENTERPRISE_STATE } + const enterprise = useGuanghuEnterpriseStatus() const shanghai = useGuanghuShanghaiNode() const restoreAttempted = useRef(false) const livingRequestSequence = useRef(0)