Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 分组管理增加跨页全选功能 --story=118110616 #3321

Merged
merged 18 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
fe3cbc0
feat:分组管理增加跨页全选功能 --story=118110616
q15971095971 Jun 29, 2024
ee50580
feat: 1.拆分跨页全选hook为全量数据和非全量数据;2.跨页全选适配模板管理-批量添加至套餐--story=118110616
q15971095971 Jul 5, 2024
c9f5919
fix: 合并冲突
q15971095971 Jul 5, 2024
038b6fa
Merge branch 'master' of https://github.com/TencentBlueKing/bk-bcs in…
q15971095971 Jul 11, 2024
d63ac40
feat: 1.全选框状态改为v-model模式;2.模板管理批量操作接口调整;3.跨页全选后,单选取消bug问题修复
q15971095971 Jul 12, 2024
31275bb
feat: 模板管理:1.批量添加接口联调;2.新建配置文件、添加已有配置文件调用添加接口的改动--story118110616
q15971095971 Jul 17, 2024
6f2c42d
feat: 1.模板管理所有接口联调结束,批量移出套餐接口有问题待后端更新;2.变量管理列表应用跨页全选,接口联调结束--story=11…
q15971095971 Jul 25, 2024
520cfb2
fix: 合并冲突
q15971095971 Jul 25, 2024
4bbbea9
Merge branch 'master' of https://github.com/TencentBlueKing/bk-bcs in…
q15971095971 Jul 29, 2024
3074890
feat: 跨页全选脚本管理接口90%,待后端更新--story=118110616
q15971095971 Jul 30, 2024
fb2a127
feat: 跨页全选done--story=118110616
q15971095971 Aug 1, 2024
056a308
feat: 去除跨页全选多余代码--story=118110616
q15971095971 Aug 1, 2024
1f016fd
Merge branch 'master' of https://github.com/TencentBlueKing/bk-bcs in…
q15971095971 Aug 1, 2024
68042bc
feat: 去除多余代码--story:118110616
q15971095971 Aug 1, 2024
9ab2df6
Merge branch 'master' of https://github.com/TencentBlueKing/bk-bcs in…
q15971095971 Aug 8, 2024
4c66cb2
fix: codereview--story=118110616
q15971095971 Aug 9, 2024
d1ef023
fix: 合并冲突
q15971095971 Aug 9, 2024
ae70d91
fix: 单引号问题
q15971095971 Aug 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bcs-services/bcs-bscp/ui/src/api/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ export const getClientCommonlyUsedNameCheck = (bizId: string, appId: number, nam
* @param ids 客户端ID
* @returns
*/
export const retryClients = (bizId: string, appId: number, ids: number[]) =>
http.post(`/config/biz/${bizId}/apps/${appId}/clients/retry`, { client_ids: ids, all: false });
export const retryClients = (bizId: string, appId: number, ids: number[], exclusion_operation: boolean) =>
http.post(`/config/biz/${bizId}/apps/${appId}/clients/retry`, { client_ids: ids, all: false, exclusion_operation });

/**
* 获取集群列表
Expand Down
12 changes: 11 additions & 1 deletion bcs-services/bcs-bscp/ui/src/api/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,20 @@ export const updateBoundTemplateVersion = (
* @returns
*/
export const deleteBoundPkg = (bizId: string, appId: number, bindingId: number, template_set_ids: number[]) =>
http.delete(`/config/biz/${bizId}/apps/${appId}/template_bindings/${bindingId}/template_sets`, {
http.delete(`/config/biz/${bizId}/apps/${appId}/template_bindings/${bindingId}/template_set`, {
params: { template_set_ids: template_set_ids.join(',') },
});

/**
* 删除服务下绑定的模板套餐
* @param bizId 业务ID
* @param appId 应用ID
* @param id 配置ID
* @returns
*/
export const deleteCurrBoundPkg = (bizId: string, appId: number, id: number) =>
http.delete(`/config/biz/${bizId}/apps/${appId}/template_set/${id}`);

/**
* 导入非模板配置文件压缩包
* @param biz_id 业务ID
Expand Down
7 changes: 5 additions & 2 deletions bcs-services/bcs-bscp/ui/src/api/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ export const deleteScript = (biz_id: string, id: number) =>
* 批量删除脚本
* @param biz_id 空间ID
* @param ids 脚本ID列表
* @param exclusion_operation 是否跨页
* @returns
*/
export const batchDeleteScript = (biz_id: string, ids: number[]) =>
http.post(`/config/biz/${biz_id}/hooks/batch_delete`, { force: true, ids }).then((res) => res.data);
export const batchDeleteScript = (biz_id: string, ids: number[], exclusion_operation: boolean) =>
http
.post(`/config/biz/${biz_id}/hooks/batch_delete`, { force: false, ids, exclusion_operation })
.then((res) => res.data);

/**
* 获取脚本标签列表
Expand Down
60 changes: 44 additions & 16 deletions bcs-services/bcs-bscp/ui/src/api/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,7 @@ export const downloadTemplateContent = (biz_id: string, templateSpaceId: number,
* @param signature 文件内容的SHA256值
* @returns
*/
export const getTemplateUploadFileIsExist = (
bizId: string,
templateSpaceId: number,
signature: string,
) =>
export const getTemplateUploadFileIsExist = (bizId: string, templateSpaceId: number, signature: string) =>
http
.get(`/biz/${bizId}/content/metadata`, {
headers: {
Expand All @@ -319,11 +315,17 @@ export const getTemplateUploadFileIsExist = (
* @param biz_id 业务ID
* @param template_space_id 空间ID
* @param template_ids 模板ID列表
* @param exclusion_operation 是否跨页全选
* @returns
*/
export const deleteTemplate = (biz_id: string, template_space_id: number, template_ids: number[]) =>
export const deleteTemplate = (
biz_id: string,
template_space_id: number,
template_ids: number[],
exclusion_operation: boolean,
) =>
http.delete(`/config/biz/${biz_id}/template_spaces/${template_space_id}/templates`, {
params: { template_ids: template_ids.join(',') },
params: { template_ids: template_ids.join(','), exclusion_operation },
});

/**
Expand All @@ -341,37 +343,57 @@ export const getTemplatesDetailByIds = (biz_id: string, ids: number[]) =>
* @param template_space_id 空间ID
* @param template_id 模板ID
* @param template_set_ids 模板套餐列表
* @param exclusion_operation 是否跨页全选
* @param template_set_id 正在操作的套餐id,全部套餐和未指定套餐传0
* @param no_set_specified 是否未指定套餐
* @returns
*/
export const addTemplateToPackage = (
biz_id: string,
template_space_id: number,
template_ids: number[],
template_set_ids: number[],
exclusion_operation: boolean,
template_set_id: number | string,
no_set_specified: boolean,
) =>
http.post(`/config/biz/${biz_id}/template_spaces/${template_space_id}/templates/add_to_template_sets`, {
template_ids,
template_set_ids,
});
http.post(
`/config/biz/${biz_id}/template_spaces/${template_space_id}/template_set/${template_set_id}/templates/add_to_template_sets`,
{
template_set_ids,
template_ids,
exclusion_operation,
no_set_specified,
},
);

/**
* 将模版移出套餐(多个模板移出多个套餐)
* @param biz_id 业务ID
* @param template_space_id 空间ID
* @param template_id 模板ID
* @param template_set_ids 模板套餐列表
* @param exclusion_operation 是否跨页全选
* @param template_set_id 正在操作的套餐id,全部套餐和未指定套餐传0
* @param no_set_specified 是否未指定套餐
* @returns
*/
export const moveOutTemplateFromPackage = (
biz_id: string,
template_space_id: number,
template_ids: number[],
template_set_ids: number[],
exclusion_operation: boolean,
template_set_id: number | string,
) =>
http.post(`/config/biz/${biz_id}/template_spaces/${template_space_id}/templates/delete_from_template_sets`, {
template_ids,
template_set_ids,
});
http.post(
`/config/biz/${biz_id}/template_spaces/${template_space_id}/template_set/${template_set_id}/templates/delete_from_template_sets`,
{
template_ids,
template_set_ids,
exclusion_operation,
},
);

/**
* 查询单个模板被套餐引用详情
Expand Down Expand Up @@ -699,10 +721,16 @@ export const importTemplateBatchAdd = (
* @param biz_id 业务ID
* @param template_space_id 空间id
* @param configData 配置列表
* @param exclusion_operation // 是否跨页
* @param template_set_id // 正在操作的套餐id,全部套餐和未指定传0
* @param no_set_specified // 是否未指定套餐
* @returns
*/
export const batchEditTemplatePermission = (biz_id: string, query: any) =>
http.post(`/config/biz/${biz_id}/templates/batch_update_templates_permissions`, query);
http.post(
`/config/biz/${biz_id}/template_spaces/${query.template_space_id}/template_set/${query.template_set_id}/templates/batch_update_templates_permissions`,
query,
);

/**
* 获取配置模板配置项元信息
Expand Down
5 changes: 3 additions & 2 deletions bcs-services/bcs-bscp/ui/src/api/variable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ export const deleteVariable = (biz_id: string, template_variable_id: number) =>
* 批量删除变量
* @param bizId 业务ID
* @param ids 变量ID列表
* @param exclusion_operation 是否跨页
*/
export const batchDeleteVariable = (biz_id: string, ids: number[]) =>
http.post(`/config/biz/${biz_id}/template_variables/batch_delete`, { ids });
export const batchDeleteVariable = (biz_id: string, ids: number[], exclusion_operation: boolean) =>
http.post(`/config/biz/${biz_id}/template_variables/batch_delete`, { ids, exclusion_operation });

/**
* 获取未命名版本服务变量列表
Expand Down
89 changes: 89 additions & 0 deletions bcs-services/bcs-bscp/ui/src/components/across-check-table-tip.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<template>
<div v-show="selectType !== CheckType.Uncheck" class="selections-style">
{{ t('已选择', { count: isFullDataMode ? selectionsLength : showSelectedLength }) }},
<span
class="checked-em"
v-show="(isFullDataMode ? selectionsLength : showSelectedLength) < dataLength"
@click="selectTypeChange">
{{ t('选择所有', { count: dataLength }) }}
</span>
<span
class="checked-em"
v-show="(isFullDataMode ? selectionsLength : showSelectedLength) === dataLength"
@click="clearSelection">
{{ t('取消选择所有数据') }}
</span>
</div>
</template>
<script lang="ts" setup>
import { computed } from 'vue';
import CheckType from '../../types/across-checked';
import { useI18n } from 'vue-i18n';

const { t } = useI18n();

const props = withDefaults(
defineProps<{
dataLength: number;
selectionsLength: number;
isFullDataMode: boolean;
selectType: number;
crossPageSelect: boolean;
handleSelectTypeChange: Function;
handleClearSelection: Function;
}>(),
{
dataLength: 0,
selectionsLength: 0,
isFullDataMode: false,
selectType: CheckType.Uncheck,
crossPageSelect: true,
handleSelectTypeChange: () => {},
handleClearSelection: () => {},
},
);
// 已选择数据长度展示
const showSelectedLength = computed(() => {
const { selectType, selectionsLength, dataLength } = props;
return [CheckType.HalfChecked, CheckType.Checked].includes(selectType)
? selectionsLength
: dataLength - selectionsLength;
});

// 根据是否提供全选/跨页全选功能,判断当前页全选/跨页全选
const selectTypeChange = () => {
if (props.crossPageSelect) {
// 跨页全选
props.handleSelectTypeChange(CheckType.AcrossChecked);
} else {
// 当前页全选
props.handleSelectTypeChange(CheckType.Checked);
}
};
const clearSelection = () => {
props.handleClearSelection();
};
</script>
<style lang="scss" scoped>
.selections-style {
display: flex;
align-items: center;
justify-content: center;
height: 30px;
font-size: 12px;
color: #63656e;
background: #ebecf0;
.checked-number {
padding: 0 5px;
font-weight: 700;
}
.checked-em {
margin-left: 5px;
color: #3a84ff;
cursor: pointer;
&:hover {
color: #699df4;
}
}
}
</style>
Loading
Loading