From 8beaed85e3a2e3aa00ee42486c3e68805688538d Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 13 Mar 2026 17:38:06 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BC=98=E5=8C=96]=20=E5=9C=A8=20PublishPrevi?= =?UTF-8?q?ewCard=20=E7=BB=84=E4=BB=B6=E4=B8=AD=E6=B7=BB=E5=8A=A0=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E6=B4=BB=E5=8A=A8=E4=B8=BB=E9=85=8D=E7=BD=AE=E4=B8=8E?= =?UTF-8?q?=E5=BE=85=E5=A4=84=E7=90=86=E4=B8=BB=E9=85=8D=E7=BD=AE=E7=9A=84?= =?UTF-8?q?=E6=AF=94=E8=BE=83=EF=BC=8C=E5=A2=9E=E5=BC=BA=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=AF=B9=E9=85=8D=E7=BD=AE=E5=8F=98=E6=9B=B4=E7=9A=84=E7=90=86?= =?UTF-8?q?=E8=A7=A3=EF=BC=9B=E5=9C=A8=20ProxyRoutesPage=20=E4=B8=AD?= =?UTF-8?q?=E6=8F=90=E5=8F=96=20hasConfigChanges=20=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E4=BB=A5=E7=AE=80=E5=8C=96=E5=8F=98=E6=9B=B4=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/config-versions-page.tsx | 68 +++++++++++++++++++ .../components/performance-page.tsx | 4 +- .../components/proxy-routes-page.tsx | 26 +++++-- 3 files changed, 89 insertions(+), 9 deletions(-) diff --git a/atsf_server/web/features/config-versions/components/config-versions-page.tsx b/atsf_server/web/features/config-versions/components/config-versions-page.tsx index 45b8a16b..f2f13200 100644 --- a/atsf_server/web/features/config-versions/components/config-versions-page.tsx +++ b/atsf_server/web/features/config-versions/components/config-versions-page.tsx @@ -168,12 +168,14 @@ function OptionDiffTable({ items }: { items: ConfigOptionDiffItem[] }) { function PublishPreviewCard({ preview, diff, + activeVersion, isPublishing, onConfirm, onCancel, }: { preview: ConfigPreviewResult; diff: ConfigDiffResult; + activeVersion: ConfigVersionItem | null; isPublishing: boolean; onConfirm: () => void; onCancel: () => void; @@ -261,6 +263,67 @@ function PublishPreviewCard({ + {diff.main_config_changed && activeVersion ? ( +
+
+
+

+ Current Active Main Config +

+ +
+ + {activeVersion.main_config} + +
+
+
+

+ Pending Main Config +

+

+ {`Checksum: ${preview.checksum}`} +

+
+ + {preview.main_config} + +
+
+ ) : null} + + {/* Legacy duplicated main config preview block kept commented out while + we replace it with an explicit active-vs-pending comparison above. + {diff.main_config_changed && activeVersion ? ( +
+
+
+

+ 褰撳墠婵€娲讳富閰嶇疆 +

+ +
+ + {activeVersion.main_config} + +
+
+
+

+ 寰呭彂甯冧富閰嶇疆 +

+

+ Checksum锛歿preview.checksum} +

+
+ + {preview.main_config} + +
+
+ ) : null} + */} +

@@ -335,6 +398,10 @@ export function ConfigVersionsPage() { () => versionsQuery.data ?? [], [versionsQuery.data], ); + const activeVersion = useMemo( + () => versions.find((item) => item.is_active) ?? null, + [versions], + ); const selectedVersion = useMemo( () => versions.find((item) => item.id === selectedVersionId) ?? null, [selectedVersionId, versions], @@ -426,6 +493,7 @@ export function ConfigVersionsPage() { publishMutation.mutate()} onCancel={() => setPublishPreview(null)} diff --git a/atsf_server/web/features/performance/components/performance-page.tsx b/atsf_server/web/features/performance/components/performance-page.tsx index 100cd6da..5a10f658 100644 --- a/atsf_server/web/features/performance/components/performance-page.tsx +++ b/atsf_server/web/features/performance/components/performance-page.tsx @@ -879,7 +879,7 @@ export function PerformancePage() {

-
+
-
+
0 || + diff.removed_domains.length > 0 || + diff.modified_domains.length > 0 || + diff.main_config_changed || + diff.changed_option_keys.length > 0 || + !diff.active_version + ); +} + function getErrorMessage(error: unknown) { return error instanceof Error ? error.message : '请求失败,请稍后重试。'; } @@ -314,13 +332,7 @@ export function ProxyRoutesPage() { try { const diff = await getConfigVersionDiff(); - const hasChanges = - diff.added_domains.length > 0 || - diff.removed_domains.length > 0 || - diff.modified_domains.length > 0 || - !diff.active_version; - - if (!hasChanges) { + if (!hasConfigChanges(diff)) { setFeedback({ tone: 'info', message: '当前规则没有变更,已阻止重复发布。',