Skip to content

Commit

Permalink
Merge remote-tracking branch 'github-bk-bcs/master'
Browse files Browse the repository at this point in the history
* github-bk-bcs/master:
  feat: upgrade bcs-project-manager go.mod go version to 1.20 (#2675)
  fix:修复部分空间bug 添加分组规则的模糊匹配 (#2674)
  • Loading branch information
wenxinlee2015 committed Oct 11, 2023
2 parents 1521542 + 67f64d3 commit dfb38a2
Show file tree
Hide file tree
Showing 19 changed files with 81 additions and 68 deletions.
2 changes: 1 addition & 1 deletion bcs-services/bcs-bscp/ui/src/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ a {

.center-top-infobox {
top: 35% !important;
}
}
27 changes: 17 additions & 10 deletions bcs-services/bcs-bscp/ui/src/views/space/groups/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ import { InfoBox } from 'bkui-vue/lib';
import useGlobalStore from '../../../store/global';
import { getSpaceGroupList, deleteGroup } from '../../../api/group';
import { IGroupItem, IGroupCategory, IGroupCategoryItem } from '../../../../types/group';
import GROUP_RULE_OPS from '../../../constants/group';
import CreateGroup from './create-group.vue';
import EditGroup from './edit-group.vue';
import RuleTag from './components/rule-tag.vue';
Expand Down Expand Up @@ -297,18 +296,26 @@ const handleSearch = () => {
const groupNameList = groupList.value.filter(item => item.name.includes(lowercaseSearchStr));
// 分组规则过滤出来的数据
const groupRuleList = groupList.value.filter((item) => {
const ruleList: string[] = [];
let groupRuleMatch = false;
item.selector?.labels_and?.forEach((labels) => {
const op = GROUP_RULE_OPS.find(item => item.id === labels.op)?.name;
ruleList.push(`${labels.key}${op}${labels.value}`);
if (typeof labels.value === 'string') {
const valueStr = labels.value as string;
if (labels.key.includes(lowercaseSearchStr) || valueStr.includes(lowercaseSearchStr)) {
groupRuleMatch = true;
}
}
});
item.selector?.labels_or?.forEach((labels) => {
const op = GROUP_RULE_OPS.find(item => item.id === labels.op)?.name;
ruleList.push(`${labels.key}${op}${labels.value}`);
});
return ruleList.includes(lowercaseSearchStr);
return groupRuleMatch;
});
searchGroupList.value = [...groupNameList, ...groupRuleList];
const searchArr = [...groupNameList, ...groupRuleList];
const uniqueIds = new Set(); // 用于记录已经出现过的id
searchGroupList.value = searchArr.filter((obj) => {
if (uniqueIds.has(obj.id)) {
return false;
}
uniqueIds.add(obj.id);
return true;
});
isSearchEmpty.value = true;
}
refreshTableData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</bk-select>
</bk-form-item>
<bk-form-item class="fixed-width-form" property="memo" label="脚本描述">
<bk-input v-model="formData.memo" type="textarea" :rows="3" :maxlength="200" />
<bk-input v-model="formData.memo" type="textarea" :rows="3" :maxlength="200" :resize="false"/>
</bk-form-item>
<bk-form-item label="脚本内容" property="content" required>
<div class="script-content-wrapper">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div v-show="!fullscreen" class="version-config-form">
<bk-form ref="formRef" form-type="vertical" :model="localVal">
<bk-form-item label="版本说明" propperty="memo">
<bk-input v-model="localVal.memo" type="textarea" :rows="8" />
<bk-input v-model="localVal.memo" type="textarea" :rows="8" :resize="false"/>
</bk-form-item>
</bk-form>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<bk-input v-model="formData.name" @change="formChange" />
</bk-form-item>
<bk-form-item label="版本描述" property="memo">
<bk-input v-model="formData.memo" type="textarea" :maxlength="100" @change="formChange" />
<bk-input v-model="formData.memo" type="textarea" :maxlength="100" @change="formChange" :resize="false"/>
</bk-form-item>
<bk-checkbox v-model="isPublish" :true-label="true" :false-label="false" @change="formChange">
同时上线版本
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</div>
</bk-form-item>
<bk-form-item label="上线说明" property="memo">
<bk-input v-model="localVal.memo" type="textarea" :maxlength="100"></bk-input>
<bk-input v-model="localVal.memo" type="textarea" :maxlength="100" :resize="false"></bk-input>
</bk-form-item>
</bk-form>
<template #footer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/>
</bk-form-item>
<bk-form-item label="配置项描述" property="memo">
<bk-input v-model="localVal.memo" type="textarea" :disabled="!editable" @change="change"></bk-input>
<bk-input v-model="localVal.memo" type="textarea" :disabled="!editable" @change="change" :resize="false"/>
</bk-form-item>
<bk-form-item label="配置项格式">
<bk-radio-group v-model="localVal.file_type" :required="true" @change="change">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ watch(() => props.show, (val) => {
console.log(val);
if (val) {
configForm.value = getConfigEditParams();
isFormChange.value = false;
}
});
const handleFormChange = (data: IConfigEditParams, configContent: IFileConfigContentSummary|string) => {
configForm.value = data;
content.value = configContent;
isFormChange.value = true;
};
const handleBeforeClose = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@
:dialog-type="'operation'"
header-align="center"
footer-align="center"
@value-change="dialogInputStr = ''"
>
<div class="dialog-content">
<div class="dialog-title">确认删除此服务?</div>
<div>删除的服务<span>无法找回</span>,请谨慎操作!</div>
<div class="dialog-input">
<div class="dialog-info">
请输入服务名<span>{{ service.spec.name }}</span> 已确认删除
请输入服务名<span>{{ service.spec.name }}</span>已确认删除
</div>
<bk-input v-model="dialogInputStr"/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/>
</bk-form-item>
<bk-form-item :label="t('服务描述')" property="memo">
<bk-input placeholder="请输入" type="textarea" v-model="formData.memo" @change="isFormChange = true" />
<bk-input placeholder="请输入" type="textarea" v-model="formData.memo" @change="isFormChange = true" :resize="false" />
</bk-form-item>
</bk-form>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
:maxlength="255"
:rows="5"
@blur="handleUpdateMemo"
:resize="false"
>
</bk-input>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ onMounted(() => {
align-items: flex-start;
justify-content: space-between;
height: calc(100% - 38px);
border: none;
}
.side-menu-area {
padding: 16px 0;
height: 100%;
background: #ffffff;
border-right: 1px solid #dcdee5;
}
.package-detail-area {
height: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<bk-input v-model="localVal.name" @change="change" />
</bk-form-item>
<bk-form-item label="模板套餐描述" property="memo">
<bk-input v-model="localVal.memo" type="textarea" :rows="6" :maxlength="256" @change="change" />
<bk-input v-model="localVal.memo" type="textarea" :rows="6" :maxlength="256" @change="change" :resize="false" />
</bk-form-item>
<bk-form-item label="服务可见范围" property="public" required>
<bk-radio-group v-model="localVal.public" @change="change">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<bk-input v-model="localVal.name" />
</bk-form-item>
<bk-form-item label="模板空间描述" property="memo">
<bk-input v-model="localVal.memo" type="textarea" :rows="6" :maxlength="100" />
<bk-input v-model="localVal.memo" type="textarea" :rows="6" :maxlength="100" :resize="false" />
</bk-form-item>
</bk-form>
</bk-dialog>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</template>
<bk-form ref="formRef" form-type="vertical" :model="{ memo }">
<bk-form-item label="模板空间描述" property="memo">
<bk-input v-model="memo" type="textarea" :rows="6" :maxlength="100" />
<bk-input v-model="memo" type="textarea" :rows="6" :maxlength="100" :resize="false" />
</bk-form-item>
</bk-form>
</bk-dialog>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
class="bk-bscp-icon icon-edit-small"
@click.stop="handleEditOpen(item)"
></i>
<!-- <Del
v-if="templateSpaceDetail.name !== 'default_space'"
<Del
v-if="item.spec.name !== 'default_space'"
class="delete-icon"
@click.stop="handleDelete(item)"
/> -->
/>
</div>
</div>
</bk-option>
Expand All @@ -49,12 +49,13 @@
import { ref, computed, onMounted, watch } from 'vue';
import { useRouter } from 'vue-router';
import { storeToRefs } from 'pinia';
import { DownShape } from 'bkui-vue/lib/icon';
import { DownShape, Del } from 'bkui-vue/lib/icon';
import { InfoBox, Message } from 'bkui-vue';
import useGlobalStore from '../../../../../store/global';
import useTemplateStore from '../../../../../store/template';
import { ITemplateSpaceItem } from '../../../../../../types/template';
import { ICommonQuery } from '../../../../../../types/index';
import { getTemplateSpaceList } from '../../../../../api/template';
import { getTemplateSpaceList, getTemplatesBySpaceId, deleteTemplateSpace } from '../../../../../api/template';
import Create from './create.vue';
import Edit from './edit.vue';
Expand All @@ -69,6 +70,7 @@ const spaceList = ref<ITemplateSpaceItem[]>([]);
const selectorOpen = ref(false);
const selectorRef = ref();
const isShowCreateDialog = ref(false);
const templatesLoading = ref(false);
const editingData = ref({
open: false,
data: { id: 0, name: '', memo: '' },
Expand Down Expand Up @@ -152,45 +154,45 @@ const handleCreated = (id: number) => {
window.location.href = href;
};
// const handleDelete = async (space: ITemplateSpaceItem) => {
// templatesLoading.value = true;
// const params = {
// start: 0,
// limit: 1,
// // all: true
// };
// const res = await getTemplatesBySpaceId(spaceId.value, space.id, params);
// if (res.count > 0) {
// InfoBox({
// title: `未能删除【${space.spec.name}】`,
// subTitle: '请先确认删除此空间下所有配置项',
// dialogType: 'confirm',
// confirmText: '我知道了',
// } as any);
// } else {
// InfoBox({
// title: `确认删除【${space.spec.name}】`,
// extCls: 'delete-space-infobox',
// onConfirm: async () => {
// await deleteTemplateSpace(spaceId.value, space.id);
// if (space.id === currentTemplateSpace.value) {
// templateStore.$patch((state) => {
// state.currentTemplateSpace = '';
// });
// initData();
// } else {
// loadList();
// }
// Message({
// theme: 'success',
// message: '删除成功',
// });
// },
// } as any);
// }
const handleDelete = async (space: ITemplateSpaceItem) => {
templatesLoading.value = true;
const params = {
start: 0,
limit: 1,
// all: true
};
const res = await getTemplatesBySpaceId(spaceId.value, space.id, params);
if (res.count > 0) {
InfoBox({
title: `未能删除【${space.spec.name}】`,
subTitle: '请先确认删除此空间下所有配置项',
dialogType: 'confirm',
confirmText: '我知道了',
} as any);
} else {
InfoBox({
title: `确认删除【${space.spec.name}】`,
extCls: 'delete-space-infobox',
onConfirm: async () => {
await deleteTemplateSpace(spaceId.value, space.id);
if (space.id === currentTemplateSpace.value) {
templateStore.$patch((state) => {
state.currentTemplateSpace = '';
});
initData();
} else {
loadList();
}
Message({
theme: 'success',
message: '删除成功',
});
},
} as any);
}
// selectorRef.value.hidePopover();
// };
selectorRef.value.hidePopover();
};
const handleSelect = (id: number) => {
setTemplateSpace(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<bk-input v-model="formData.revision_name" />
</bk-form-item>
<bk-form-item label="版本描述" property="revision_memo">
<bk-input v-model="formData.revision_memo" type="textarea" :rows="4" :maxlength="200" />
<bk-input v-model="formData.revision_memo" type="textarea" :rows="4" :maxlength="200" :resize="false" />
</bk-form-item>
<bk-form-item label="文件权限" required>
<PermissionInputPicker v-model="formData.privilege" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<bk-input v-model="localVal.default_val" @change="change" />
</bk-form-item>
<bk-form-item label="描述" property="memo">
<bk-input v-model="localVal.memo" type="textarea" :maxlength="100" :rows="5" @change="change" />
<bk-input v-model="localVal.memo" type="textarea" :maxlength="100" :rows="5" @change="change" :resize="false" />
</bk-form-item>
</bk-form>
</template>
Expand Down
2 changes: 1 addition & 1 deletion bcs-services/bcs-project-manager/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Tencent/bk-bcs/bcs-services/bcs-project-manager

go 1.17
go 1.20

replace (
github.com/coreos/bbolt v1.3.4 => go.etcd.io/bbolt v1.3.4
Expand Down

0 comments on commit dfb38a2

Please sign in to comment.