diff --git a/bcs-services/bcs-bscp/ui/src/api/config.ts b/bcs-services/bcs-bscp/ui/src/api/config.ts index 07fd208276..c62ab5bd17 100644 --- a/bcs-services/bcs-bscp/ui/src/api/config.ts +++ b/bcs-services/bcs-bscp/ui/src/api/config.ts @@ -127,7 +127,13 @@ export const getReleasedConfigItemDetail = ( * @param signature 文件内容的SHA256值 * @returns */ -export const updateConfigContent = (bizId: string, appId: number, data: string | File, signature: string) => +export const updateConfigContent = ( + bizId: string, + appId: number, + data: string | File, + signature: string, + progress?: Function, +) => http .put(`/biz/${bizId}/content/upload`, data, { headers: { @@ -136,6 +142,12 @@ export const updateConfigContent = (bizId: string, appId: number, data: string | 'X-Bkapi-File-Content-Overwrite': 'false', 'Content-Type': 'text/plain', }, + onUploadProgress: (progressEvent: any) => { + if (progress) { + const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total); + progress(percentCompleted); + } + }, }) .then((res) => res.data); diff --git a/bcs-services/bcs-bscp/ui/src/api/template.ts b/bcs-services/bcs-bscp/ui/src/api/template.ts index ff6f6fbfd8..f6d4a063d4 100644 --- a/bcs-services/bcs-bscp/ui/src/api/template.ts +++ b/bcs-services/bcs-bscp/ui/src/api/template.ts @@ -224,6 +224,7 @@ export const updateTemplateContent = ( templateSpaceId: number, data: string | File, signature: string, + progress?: Function, ) => http .put(`/biz/${biz_id}/content/upload`, data, { @@ -233,6 +234,12 @@ export const updateTemplateContent = ( 'X-Bkapi-File-Content-Overwrite': 'false', 'Content-Type': 'text/plain', }, + onUploadProgress: (progressEvent: any) => { + if (progress) { + const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total); + progress(percentCompleted); + } + }, }) .then((res) => res.data); @@ -641,3 +648,13 @@ export const importTemplateBatchAdd = (biz_id: string, template_space_id: number */ export const batchEditTemplatePermission = (biz_id: string, query: any) => http.post(`/config/biz/${biz_id}/templates/batch_update_templates_permissions`, query); + +/** + * 批量修改模板权限 + * @param biz_id 业务ID + * @param template_id 模板id + * @param revision_name 版本名称 + * @returns + */ +export const getTemplateConfigMeta = (biz_id: string, template_id: number, revision_name?: string) => + http.get(`/config/biz/${biz_id}/templates/${template_id}/template_revisions`, { params: { revision_name } }); diff --git a/bcs-services/bcs-bscp/ui/src/views/space/service/detail/config/config-list/config-simple-list/config-list-with-templates.vue b/bcs-services/bcs-bscp/ui/src/views/space/service/detail/config/config-list/config-simple-list/config-list-with-templates.vue index 79206145c0..1455306cff 100644 --- a/bcs-services/bcs-bscp/ui/src/views/space/service/detail/config/config-list/config-simple-list/config-list-with-templates.vue +++ b/bcs-services/bcs-bscp/ui/src/views/space/service/detail/config/config-list/config-simple-list/config-list-with-templates.vue @@ -16,7 +16,7 @@ v-for="config in group.configs" :class="['config-item', { disabled: config.file_state === 'DELETE' }]" :key="config.id" - @click="handleConfigClick(config, group.id)"> + @click="handleConfigClick(config, group)"> {{ fileAP(config) }} @@ -36,7 +36,8 @@ v-bind="viewConfigSliderData.data" :bk-biz-id="props.bkBizId" :app-id="props.appId" - :version-id="versionData.id" /> + :version-id="versionData.id" + @open-edit="handleOpenEdit" />