-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 配置模板支持单个文件下载 # Reviewed, transaction id: 3084 * refactor: 已发布版本服务下载文件时需要导出变量渲染后的配置 # Reviewed, transaction id: 3104 * Merge branch 'master' into feat_template_download , # Reviewed, transaction id: 3118 * refactor: 下载的模板文件名称带上版本号 # Reviewed, transaction id: 3120
- Loading branch information
Showing
10 changed files
with
79 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
bcs-services/bcs-bscp/ui/src/utils/hooks/use-download-template-config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { getTemplateVersionsNameByIds } from '../../api/template'; | ||
|
||
const useDownloadTemplateConfig = () => {}; | ||
|
||
export default useDownloadTemplateConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,7 @@ | |
list.push(version); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
}); | ||
return list; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
.../views/space/templates/list/package-detail/operations/download-config/download-config.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<template> | ||
<div class="download-config" @click="handleDownload"> | ||
<slot> | ||
<bk-button text :theme="props.theme" :loading="pending">{{ $t('下载') }}</bk-button> | ||
</slot> | ||
</div> | ||
</template> | ||
<script lang="ts" setup> | ||
import { ref } from 'vue'; | ||
import { getTemplateVersionsNameByIds, downloadTemplateContent } from '../../../../../../../api/template'; | ||
import { fileDownload } from '../../../../../../../utils/file'; | ||
const props = withDefaults( | ||
defineProps<{ | ||
spaceId: string; | ||
templateSpaceId: number; | ||
templateId: number; | ||
theme: string; | ||
}>(), | ||
{ | ||
theme: 'primary', | ||
}, | ||
); | ||
const pending = ref(false); | ||
const handleDownload = async () => { | ||
if (pending.value) return; | ||
try { | ||
pending.value = true; | ||
const res = await getTemplateVersionsNameByIds(props.spaceId, [props.templateId]); | ||
const { template_name, latest_signature } = res.details[0]; | ||
const content = await downloadTemplateContent(props.spaceId, props.templateSpaceId, latest_signature); | ||
fileDownload(content, template_name); | ||
} catch (e) { | ||
console.error(e); | ||
} finally { | ||
pending.value = false; | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters