From 21d2b9cde13110bab3f8244e8e21c0984d7ab121 Mon Sep 17 00:00:00 2001 From: Syngnat Date: Fri, 31 Jul 2026 10:36:01 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(nacos):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E9=85=8D=E7=BD=AE=E6=9B=B4=E6=96=B0=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - V2 远端变更提示移入配置详情标题区,避免占据工作台整行 - 使用紧凑状态条并保留加载远端与图标式忽略操作 - 仅本地存在未保存草稿时展示覆盖风险提示,旧版 Alert 行为保持不变 - 更新配置选择与远端变更监听测试 --- .../components/NacosViewer.selection.test.tsx | 22 ++-- frontend/src/components/NacosViewer.tsx | 68 +++++++--- frontend/src/styles/v2-theme-workbench.css | 116 ++++++++++-------- 3 files changed, 125 insertions(+), 81 deletions(-) diff --git a/frontend/src/components/NacosViewer.selection.test.tsx b/frontend/src/components/NacosViewer.selection.test.tsx index 1cacb57b..fdcb5657 100644 --- a/frontend/src/components/NacosViewer.selection.test.tsx +++ b/frontend/src/components/NacosViewer.selection.test.tsx @@ -96,6 +96,8 @@ vi.mock('@ant-design/icons', async () => { const React = await import('react'); const Icon = () => React.createElement('span', { 'data-icon': true }); return { + CloseOutlined: Icon, + CloudSyncOutlined: Icon, DeleteOutlined: Icon, DownloadOutlined: Icon, ExperimentOutlined: Icon, @@ -776,16 +778,18 @@ describe('NacosViewer config selection actions', () => { expect(antdState.message.info).toHaveBeenCalledTimes(1); expect(renderedText(renderer!.toJSON())).not.toContain('Listening'); - const compactBanner = renderer!.root.find( - (node) => String(node.type) === 'alert', - ); - expect(compactBanner.props.className).toBe('gn-v2-nacos-banner'); - expect(renderedText(compactBanner)).toContain('Remote config update detected'); - expect(renderedText(compactBanner)).toContain('Reload remote'); - expect(renderedText(compactBanner)).toContain('Dismiss'); - expect(renderedText(compactBanner)).not.toContain('Local draft is clean'); + expect(renderer!.root.findAll((node) => String(node.type) === 'alert')).toHaveLength(0); + const compactNotice = renderer!.root.findByProps({ + className: 'gn-v2-nacos-remote-notice', + }); + expect(renderedText(compactNotice)).toContain('Remote config update detected'); + expect(renderedText(compactNotice)).toContain('Reload remote'); + expect(renderedText(compactNotice)).not.toContain('Dismiss'); + expect(renderedText(compactNotice)).not.toContain('Local draft is clean'); + expect(compactNotice.findByProps({ 'aria-label': 'Dismiss' })).toBeTruthy(); expect( - compactBanner.findByProps({ className: 'gn-v2-nacos-banner__copy' }), + renderer!.root.findByProps({ className: 'gn-v2-nacos-detail-pane' }) + .findByProps({ className: 'gn-v2-nacos-remote-notice' }), ).toBeTruthy(); await act(async () => { diff --git a/frontend/src/components/NacosViewer.tsx b/frontend/src/components/NacosViewer.tsx index 43e31505..bc9e6a4f 100644 --- a/frontend/src/components/NacosViewer.tsx +++ b/frontend/src/components/NacosViewer.tsx @@ -18,6 +18,8 @@ import { message, } from 'antd'; import { + CloseOutlined, + CloudSyncOutlined, DeleteOutlined, DownloadOutlined, ExperimentOutlined, @@ -1273,28 +1275,12 @@ const NacosViewer: React.FC = ({ color: workbenchTheme.textPrimary, }} > - {remoteChanged ? ( + {remoteChanged && !isV2Ui ? ( - - {tr('nacos_viewer.message.remote_changed_banner')} - - {draftDirty ? ( - - {remoteChangedHint} - - ) : null} - - ) : ( - tr('nacos_viewer.message.remote_changed_banner') - ) - } - description={isV2Ui ? undefined : remoteChangedHint} + message={tr('nacos_viewer.message.remote_changed_banner')} + description={remoteChangedHint} action={ + +