From 7f87ad26f554bd0da4591fea3d6bc7b28760120f Mon Sep 17 00:00:00 2001 From: KDZhu Date: Mon, 28 Oct 2024 11:52:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(version-diff):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=AF=B9=E6=AF=94=E4=B8=8D=E8=83=BD=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E6=98=BE=E7=A4=BA=E6=96=B0=E7=BD=91=E5=85=B3=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E7=89=88=E6=9C=AC=E7=9A=84=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=B7=AE=E5=BC=82=E7=9A=84=E9=97=AE=E9=A2=98=20#=20Reviewed,?= =?UTF-8?q?=20transaction=20id:=2022037?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/version-diff/index.vue | 3 +- .../src/views/resource/setting/index.vue | 8 +++- .../overview/comps/release-sideslider.vue | 38 ++++++++++++------- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/dashboard-front/src/components/version-diff/index.vue b/src/dashboard-front/src/components/version-diff/index.vue index e8d332b96..f0f746c07 100644 --- a/src/dashboard-front/src/components/version-diff/index.vue +++ b/src/dashboard-front/src/components/version-diff/index.vue @@ -624,7 +624,8 @@ const handleVersionChange = async () => { }; const getDiffData = async () => { - if (isDataLoading.value || !localSourceId.value) { + // localSourceId 可以为 0 + if (isDataLoading.value || localSourceId.value === '') { return false; } diff --git a/src/dashboard-front/src/views/resource/setting/index.vue b/src/dashboard-front/src/views/resource/setting/index.vue index df61818af..e46c2a8b5 100644 --- a/src/dashboard-front/src/views/resource/setting/index.vue +++ b/src/dashboard-front/src/views/resource/setting/index.vue @@ -1075,7 +1075,13 @@ const handleOutBatch = () => { const handleShowDiff = async () => { try { const res = await getResourceVersionsList(props.apigwId, { offset: 0, limit: 999 }); - diffSourceId.value = res.results[0]?.id || ''; + // 如果是此网关的第一个版本(版本号为 1.0.0),则与空网关版本对比(版本ID为0) + if (res.results[0]?.version === '1.0.0') { + diffTargetId.value = res.results[0].id; + diffSourceId.value = 0; + } else { + diffSourceId.value = res.results[0]?.id || ''; + } diffSidesliderConf.width = window.innerWidth <= 1280 ? 1040 : 1280; diffSidesliderConf.isShow = true; } catch (e) { diff --git a/src/dashboard-front/src/views/stage/overview/comps/release-sideslider.vue b/src/dashboard-front/src/views/stage/overview/comps/release-sideslider.vue index cd6676553..fbb49a948 100644 --- a/src/dashboard-front/src/views/stage/overview/comps/release-sideslider.vue +++ b/src/dashboard-front/src/views/stage/overview/comps/release-sideslider.vue @@ -4,7 +4,7 @@ class="release-sideslider" v-model:isShow="isShow" :width="960" - :title="t('发布资源至环境【{stage}】', { stage: chooseAssets?.name })" + :title="t('发布资源至环境【{stage}】', { stage: chooseAssets.name })" quick-close :before-close="handleBeforeClose" @animation-end="handleAnimationEnd" @@ -23,17 +23,17 @@

{{ - t('发布的资源版本( 当前版本:{version}', { version: chooseAssets?.resource_version?.version || '--' }) + t('发布的资源版本( 当前版本:{version}', { version: chooseAssets.resource_version?.version || '--' }) }} -