From f3ec3f9332cc3d4343d2a3dab9897160df1b9d10 Mon Sep 17 00:00:00 2001 From: luofann Date: Wed, 28 Feb 2024 18:01:45 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E9=85=8D=E7=BD=AE=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E6=94=AF=E6=8C=81=E5=8D=95=E4=B8=AA=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=20#=20Reviewed,=20transaction=20id:=203084?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bcs-bscp/ui/src/components/diff/file.vue | 2 +- .../hooks/use-download-template-config.ts | 5 +++ .../components/publish-version/index.vue | 1 + .../config-table-list/config-form.vue | 8 +++- .../config-table-list/download-config-btn.vue | 3 -- .../download-config/download-config.vue | 41 +++++++++++++++++++ .../tables/common-config-table.vue | 11 ++++- .../tables/config-without-package.vue | 14 +++++-- .../version-detail/version-editor.vue | 2 +- .../version-manage/version-full-table.vue | 3 +- 10 files changed, 76 insertions(+), 14 deletions(-) create mode 100644 bcs-services/bcs-bscp/ui/src/utils/hooks/use-download-template-config.ts create mode 100644 bcs-services/bcs-bscp/ui/src/views/space/templates/list/package-detail/operations/download-config/download-config.vue diff --git a/bcs-services/bcs-bscp/ui/src/components/diff/file.vue b/bcs-services/bcs-bscp/ui/src/components/diff/file.vue index 50b67e54d3..e3ac51b399 100644 --- a/bcs-services/bcs-bscp/ui/src/components/diff/file.vue +++ b/bcs-services/bcs-bscp/ui/src/components/diff/file.vue @@ -65,7 +65,7 @@ const { signature, name } = config; const getConfigContent = props.isTpl ? downloadTemplateContent : downloadConfigContent; const res = await getConfigContent(bkBizId, props.id, signature); - fileDownload(res, `${name}.bin`); + fileDownload(res, name); }; diff --git a/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-detail/version-editor.vue b/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-detail/version-editor.vue index 1bd7cc74dd..6c24433e84 100644 --- a/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-detail/version-editor.vue +++ b/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-detail/version-editor.vue @@ -263,7 +263,7 @@ const handleDownloadFile = async () => { const { signature, name } = fileContent.value as IFileConfigContentSummary; const res = await downloadTemplateContent(props.spaceId, props.templateSpaceId, signature); - fileDownload(String(res), `${name}.bin`); + fileDownload(String(res), name); }; const validate = async () => { diff --git a/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-full-table.vue b/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-full-table.vue index faa17401a0..3cf7a28fde 100644 --- a/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-full-table.vue +++ b/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-full-table.vue @@ -121,8 +121,7 @@ const handleDownload = async (version: ITemplateVersionItem) => { const { name, file_type, revision_name, content_spec } = version.spec; const content = await downloadTemplateContent(props.spaceId, props.templateSpaceId, content_spec.signature); - const fileName = file_type === 'binary' ? `${name}(${revision_name}).bin` : `${name}(${revision_name})`; - fileDownload(content, fileName); + fileDownload(content, `${name}(${revision_name})`); }; // const handleDeleteVersion = (version: ITemplateVersionItem) => { From 236eea82d632e5c4d9c7542a2729942918897c74 Mon Sep 17 00:00:00 2001 From: luofann Date: Thu, 29 Feb 2024 10:37:16 +0800 Subject: [PATCH 2/4] =?UTF-8?q?refactor:=20=E5=B7=B2=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9C=8D=E5=8A=A1=E4=B8=8B=E8=BD=BD=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=E9=9C=80=E8=A6=81=E5=AF=BC=E5=87=BA=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E6=B8=B2=E6=9F=93=E5=90=8E=E7=9A=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=20#=20Reviewed,=20transaction=20id:=203104?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config-list/config-table-list/download-config-btn.vue | 8 ++------ .../space/templates/version-manage/version-full-table.vue | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/bcs-services/bcs-bscp/ui/src/views/space/service/detail/config/config-list/config-table-list/download-config-btn.vue b/bcs-services/bcs-bscp/ui/src/views/space/service/detail/config/config-list/config-table-list/download-config-btn.vue index e00bf32d6b..132fefa99b 100644 --- a/bcs-services/bcs-bscp/ui/src/views/space/service/detail/config/config-list/config-table-list/download-config-btn.vue +++ b/bcs-services/bcs-bscp/ui/src/views/space/service/detail/config/config-list/config-table-list/download-config-btn.vue @@ -35,33 +35,29 @@ let signature; let content; let fileName; - let fileType; pending.value = true; if (props.type === 'config') { let res; if (versionData.value.id) { res = await getReleasedConfigItemDetail(props.bkBizId, props.appId, versionData.value.id, props.id); - signature = res.config_item.commit_spec.content.origin_signature; + signature = res.config_item.commit_spec.content.signature; } else { res = await getConfigItemDetail(props.bkBizId, props.id, props.appId); signature = res.content.signature; } fileName = res.config_item.spec.name; - fileType = res.config_item.spec.file_type; content = await downloadConfigContent(props.bkBizId, props.appId, signature); } else { let templateSpaceId; if (versionData.value.id) { const res = await getTemplateVersionDetail(props.bkBizId, props.appId, versionData.value.id, props.id); - signature = res.detail.origin_signature; + signature = res.detail.signature; fileName = res.detail.name; - fileType = res.detail.file_type; templateSpaceId = res.detail.template_space_id; } else { const res = await getTemplateVersionsDetailByIds(props.bkBizId, [props.id]); signature = res.details[0].spec.content_spec.signature; fileName = res.details[0].spec.name; - fileType = res.details[0].spec.file_type; templateSpaceId = res.details[0].attachment.template_space_id; } content = await downloadTemplateContent(props.bkBizId, templateSpaceId, signature); diff --git a/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-full-table.vue b/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-full-table.vue index 3cf7a28fde..adac16994f 100644 --- a/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-full-table.vue +++ b/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-full-table.vue @@ -119,7 +119,7 @@ }; const handleDownload = async (version: ITemplateVersionItem) => { - const { name, file_type, revision_name, content_spec } = version.spec; + const { name, revision_name, content_spec } = version.spec; const content = await downloadTemplateContent(props.spaceId, props.templateSpaceId, content_spec.signature); fileDownload(content, `${name}(${revision_name})`); }; From c1570af0b86a058182d28220d5ee96586a0be1bd Mon Sep 17 00:00:00 2001 From: luofann Date: Thu, 29 Feb 2024 16:02:56 +0800 Subject: [PATCH 3/4] Merge branch 'master' into feat_template_download , # Reviewed, transaction id: 3118 From 79bdaf11a98c8c217a58daa10d6afd7b0f3c5afd Mon Sep 17 00:00:00 2001 From: luofann Date: Thu, 29 Feb 2024 16:30:42 +0800 Subject: [PATCH 4/4] =?UTF-8?q?refactor:=20=E4=B8=8B=E8=BD=BD=E7=9A=84?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=96=87=E4=BB=B6=E5=90=8D=E7=A7=B0=E5=B8=A6?= =?UTF-8?q?=E4=B8=8A=E7=89=88=E6=9C=AC=E5=8F=B7=20#=20Reviewed,=20transact?= =?UTF-8?q?ion=20id:=203120?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/space/templates/version-manage/version-full-table.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-full-table.vue b/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-full-table.vue index adac16994f..ee1fe827e3 100644 --- a/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-full-table.vue +++ b/bcs-services/bcs-bscp/ui/src/views/space/templates/version-manage/version-full-table.vue @@ -121,7 +121,7 @@ const handleDownload = async (version: ITemplateVersionItem) => { const { name, revision_name, content_spec } = version.spec; const content = await downloadTemplateContent(props.spaceId, props.templateSpaceId, content_spec.signature); - fileDownload(content, `${name}(${revision_name})`); + fileDownload(content, `${name}_${revision_name}`); }; // const handleDeleteVersion = (version: ITemplateVersionItem) => {