Skip to content

Commit

Permalink
Merge pull request #2369 from TencentBlueKing/develop
Browse files Browse the repository at this point in the history
v1.10.17
  • Loading branch information
zhu327 authored Nov 16, 2023
2 parents 3b35d88 + 91b153e commit 9d50a81
Show file tree
Hide file tree
Showing 52 changed files with 2,758 additions and 1,363 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/custom-perm-system-policy/index.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<div :class="['iam-perm-item', extCls]">
<div class="header" @click="handleExpanded">
<div class="header" @click="handleExpanded" v-if="permLength > 0">
<Icon bk class="expanded-icon" :type="isExpanded ? 'down-shape' : 'right-shape'" />
<label class="title">{{ title }}</label>
<div class="sub-title" v-if="permLength > 0">
<div class="sub-title">
{{ $t(`m.common['共']`) }}
<span class="number">{{ permLength }}</span>
{{ $t(`m.common['个']`) }}
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/components/dialog-infinite-list/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@
},
selectedNode () {
return (payload) => {
if (payload.disabled) {
return true;
}
if (this.hasSelectedDepartments.length || this.hasSelectedUsers.length) {
payload.is_selected = this.hasSelectedDepartments.map(
item => item.id.toString()).includes(payload.id.toString())
Expand Down Expand Up @@ -288,7 +291,7 @@
},
async handleNodeClick (node) {
const isDisabled = this.isDisabled || (this.getGroupAttributes && this.getGroupAttributes().source_from_role && node.type === 'depart');
const isDisabled = node.disabled || this.isDisabled || (this.getGroupAttributes && this.getGroupAttributes().source_from_role && node.type === 'depart');
if (!isDisabled) {
if (this.isStaff) {
node.is_selected = !node.is_selected;
Expand Down
12 changes: 4 additions & 8 deletions frontend/src/components/header-nav/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
};
};
const NORMAL_DOCU_LINK = '/权限中心/产品白皮书/产品简介/README.md';
const NORMAL_DOCU_LINK = '/IAM/UserGuide/Introduce/README.md';
// const GRADE_DOCU_LINK = '/权限中心/产品白皮书/场景案例/GradingManager.md';
const docuLinkMap = new Map([
Expand Down Expand Up @@ -607,16 +607,12 @@
},
handleChangeLocale (language) {
Cookie.remove('blueking_language', { path: '' });
Cookie.set('blueking_language', language, {
domain: window.BK_DOMAIN || window.location.hostname.split('.').slice(1).join('.')
domain: window.BK_DOMAIN
});
jsonpRequest(
`${window.BK_COMPONENT_API_URL}/api/c/compapi/v2/usermanage/fe_update_user_language/`,
{
language
}
);
this.setMagicBoxLocale(language);
jsonpRequest(`${window.BK_COMPONENT_API_URL}/api/c/compapi/v2/usermanage/fe_update_user_language/?language=${language}`, { language });
},
handleSwitchIdentity () {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/header/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
};
};
const NORMAL_DOCU_LINK = '/权限中心/产品白皮书/产品简介/README.md';
const NORMAL_DOCU_LINK = '/IAM/UserGuide/Introduce/README.md';
// const GRADE_DOCU_LINK = '/权限中心/产品白皮书/场景案例/GradingManager.md';
const docuLinkMap = new Map([
Expand Down
41 changes: 29 additions & 12 deletions frontend/src/components/iam-resource-cascade-search/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,14 @@
active: {
type: String,
default: 'GroupPerm'
},
minSelectWidth: {
type: String,
default: '200px'
},
maxSelectWidth: {
type: String,
default: '240px'
}
},
data () {
Expand Down Expand Up @@ -324,7 +332,7 @@
resourceInstanceSideSliderTitle: '',
curSelectMenu: '',
curInputText: '',
contentWidth: window.innerWidth <= 1440 ? '200px' : '240px'
contentWidth: ''
};
},
computed: {
Expand Down Expand Up @@ -375,6 +383,7 @@
}
},
async created () {
this.contentWidth = window.innerWidth <= 1520 ? this.minSelectWidth : this.maxSelectWidth;
this.searchData = this.enableGroupInstanceSearch
? this.initSearchData.filter(item => ['name', 'id', 'description'].includes(item.id))
: this.initSearchData;
Expand Down Expand Up @@ -418,6 +427,8 @@
this.systemIdError = false;
this.handleManualInput(isTagInput);
const isSearch = this.applyGroupData.system_id || Object.keys(this.searchParams).length > 0;
// 处理搜索框没有生成tag,下拉框也没有选择任务数据,但实际有输入内容情况
const isNoTag = isTagInput && this.searchList.length < 1 && !this.applyGroupData.system_id;
if (isSearch) {
// if (!this.applyGroupData.system_id && ['CustomPerm'].includes(this.active)) {
// this.systemIdError = true;
Expand Down Expand Up @@ -455,15 +466,18 @@
if (isClick) {
this.resetPagination();
}
await this.fetchSearchUserGroup(resourceInstances);
await this.fetchSearchUserGroup(resourceInstances, isNoTag);
} else {
if (isNoTag) {
return;
}
// 如果没有搜索参数,重置数据
this.emptyData.tipType = '';
this.$emit('on-refresh-table');
}
},
async fetchSearchUserGroup (resourceInstances) {
async fetchSearchUserGroup (resourceInstances, isNoTag) {
const { current, limit } = this.pagination;
if (this.searchParams.hasOwnProperty('id')) {
if (!isNaN(Number(this.searchParams.id))) {
Expand All @@ -480,7 +494,8 @@
this.$emit('on-remote-table', {
searchParams: params,
pagination: this.pagination,
emptyData: { ...this.emptyData, ...{ tipType: 'search' } }
emptyData: { ...this.emptyData, ...{ tipType: 'search' } },
isNoTag
});
this.curSelectMenu = '';
this.curInputText = '';
Expand Down Expand Up @@ -601,7 +616,7 @@
if (!this.curResourceData.type) {
this.$set(this.resourceTypeData.resource_groups[0], 'related_resource_types', []);
}
// 如果related_resource_types和related_resource_types_list都为空,则需要填充默认数据显示资源实例下路拉框
// 如果related_resource_types和related_resource_types_list都为空,则需要填充默认数据显示资源实例下拉框
if ((resourceGroups[0].related_resource_types_list
&& resourceGroups[0].related_resource_types_list.length
&& !resourceGroups[0].related_resource_types.length)
Expand Down Expand Up @@ -696,13 +711,15 @@
delete this.searchParams.name;
}
this.$nextTick(() => {
const localValue = this.$refs.searchSelectRef.$refs.searchSelect.localValue;
this.searchParams.name = localValue;
if (!localValue) {
delete this.searchParams.name;
if (this.$refs.searchSelectRef && this.$refs.searchSelectRef.$refs.searchSelect) {
const localValue = this.$refs.searchSelectRef.$refs.searchSelect.localValue;
this.searchParams.name = localValue;
if (!localValue) {
delete this.searchParams.name;
}
// 处理切换tab,只输入内容
this.$emit('on-input-value', localValue);
}
// 处理切换tab,只输入内容
this.$emit('on-input-value', localValue);
});
}
}
Expand Down Expand Up @@ -779,7 +796,7 @@
},
formatFormItemWidth () {
this.contentWidth = window.innerWidth <= 1520 ? '200px' : '240px';
this.contentWidth = window.innerWidth <= 1520 ? this.minSelectWidth : this.maxSelectWidth;
},
handleQuickSearchMethod (value) {
Expand Down
32 changes: 18 additions & 14 deletions frontend/src/components/iam-search-select/search-select/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,10 @@
methods: {
_calcTextareaWidth () {
this.$nextTick(() => {
const { width } = this.$refs.realInputContent.getBoundingClientRect();
this.textareaWidth = width + 20;
if (this.$refs.realInputContent.getBoundingClientRect) {
const { width } = this.$refs.realInputContent.getBoundingClientRect();
this.textareaWidth = width + 20;
}
});
},
// 显示 key 面板
Expand Down Expand Up @@ -571,18 +573,20 @@
this.$nextTick(() => {
const allTag = this.$refs.tagGroup.querySelectorAll('.search-tag-box');
const {
width: searchSelectWidth
} = this.$refs.searchSelect.getBoundingClientRect();
let tagWidthTotal = 0;
for (let i = 0; i < allTag.length; i++) {
const { width } = allTag[i].getBoundingClientRect();
if (tagWidthTotal + width + 50 < searchSelectWidth) {
tagWidthTotal = tagWidthTotal + width + 6;
} else {
this.maxRenderTagNums = i;
break;
if (this.$refs.searchSelect.getBoundingClientRect) {
const {
width: searchSelectWidth
} = this.$refs.searchSelect.getBoundingClientRect();
let tagWidthTotal = 0;
for (let i = 0; i < allTag.length; i++) {
const { width } = allTag[i].getBoundingClientRect();
if (tagWidthTotal + width + 50 < searchSelectWidth) {
tagWidthTotal = tagWidthTotal + width + 6;
} else {
this.maxRenderTagNums = i;
break;
}
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@
},
mounted () {
this.searchSelect.renderTagInstance = this;
this.keyBoxWidth = this.$refs.keyBox.getBoundingClientRect().width;
if (this.$refs.keyBox.getBoundingClientRect) {
this.keyBoxWidth = this.$refs.keyBox.getBoundingClientRect().width;
}
document.body.addEventListener('click', this.handleInputOutSide);
},
beforeDestroy () {
Expand All @@ -95,8 +97,10 @@
methods: {
calcTextareaWidth () {
this.$nextTick(() => {
const { width } = this.$refs.realContent.getBoundingClientRect();
this.textareaWidth = width + 20;
if (this.$refs.realContent.getBoundingClientRect) {
const { width } = this.$refs.realContent.getBoundingClientRect();
this.textareaWidth = width + 20;
}
});
},
Expand Down Expand Up @@ -196,7 +200,9 @@
});
this.calcTextareaWidth();
this.isEditing = true;
this.searchSelectWidth = this.searchSelect.$refs.searchSelect.getBoundingClientRect().width;
if (this.searchSelect.$refs && this.searchSelect.$refs.searchSelect.getBoundingClientRect) {
this.searchSelectWidth = this.searchSelect.$refs.searchSelect.getBoundingClientRect().width;
}
// 编辑tag的值时隐藏 searchSelect 操作面板
this.searchSelect.hidePopper();
this.showPopper();
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/language/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,9 @@ export const m = {
'不可续期的用户组成员如下': 'The non renewable user group members are as follows: {value}',
'管理员组不能添加权限': 'Administrators group cannot add permissions',
'只读用户组不能添加权限': 'Read only user groups cannot add permissions',
'申请加入失败,用户组数量超出上限(100个),请在“我的权限”中退出用户组后重试': 'Application to join failed. The number of user groups exceeds the maximum limit (100), please exit {value} user group in "My permissions" and try again'
'申请加入失败,用户组数量超出上限(100个),请在“我的权限”中退出用户组后重试': 'Application to join failed. The number of user groups exceeds the maximum limit (100), please exit {value} user group in "My permissions" and try again',
'最多添加一个管理员': 'Add at most one administrator',
'管理员不可重复添加': 'Administrators cannot be added repeatedly'
},
// 二次确认弹窗相关
dialog: {
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/language/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,9 @@ export const m = {
'不可续期的用户组成员如下': '不可续期的用户组成员如下:{value}',
'管理员组不能添加权限': '管理员组不能添加权限',
'只读用户组不能添加权限': '只读用户组不能添加权限',
'申请加入失败,用户组数量超出上限(100个),请在“我的权限”中退出用户组后重试': '申请加入失败,用户组数量超出上限(100个),请在"我的权限"中退出{value}个用户组后重试'
'申请加入失败,用户组数量超出上限(100个),请在“我的权限”中退出用户组后重试': '申请加入失败,用户组数量超出上限(100个),请在"我的权限"中退出{value}个用户组后重试',
'最多添加一个管理员': '最多添加一个管理员',
'管理员不可重复添加': '管理员不可重复添加'
},
// 二次确认弹窗相关
dialog: {
Expand Down
17 changes: 8 additions & 9 deletions frontend/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,14 @@ const currentNav = [
path: `${SITE_URL}resource-permiss`,
disabled: false
},
// {
// icon: 'mingandengji',
// id: 'sensitivityLevelNav',
// rkey: 'sensitivityLevel',
// name: il8n('nav', '敏感等级'),
// path: `${SITE_URL}sensitivity-level`,
// disabled: false
// },
{
icon: 'mingandengji',
id: 'sensitivityLevelNav',
rkey: 'sensitivityLevel',
name: il8n('nav', '敏感等级'),
path: `${SITE_URL}sensitivity-level`,
disabled: false
},
{
icon: 'perm-manage',
name: il8n('common', '设置'),
Expand Down Expand Up @@ -279,7 +279,6 @@ const currentNav = [
]
}
];

if (window.ENABLE_MODEL_BUILD.toLowerCase() === 'true') {
currentNav.push({
icon: 'perm-manage',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/store/modules/organization.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export default {
* @return {Promise} promise 对象
*/
getSubjectScopeCheck ({ commit, state, dispatch }, config) {
return http.post(`${AJAX_URL_PREFIX}/roles/subject_scope_check/`, config);
return http.post(`${AJAX_URL_PREFIX}/roles/subject_scope_check/?${+new Date()}`, config);
}
}
};
Loading

0 comments on commit 9d50a81

Please sign in to comment.