Skip to content

Commit

Permalink
Merge pull request #2807 from TencentBlueKing/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
nannan00 authored Sep 25, 2024
2 parents a4d8470 + ea21ddd commit b6f6e4d
Show file tree
Hide file tree
Showing 29 changed files with 450 additions and 241 deletions.
3 changes: 2 additions & 1 deletion frontend/src/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export const NEED_CONFIRM_DIALOG_ROUTER = [
'gradingAdminCreate',
'gradingAdminEdit',
'myManageSpaceCreate',
'myManageSpaceClone',
'authorBoundaryEditFirstLevel',
'secondaryManageSpaceCreate'
];
Expand Down Expand Up @@ -183,7 +184,7 @@ export const ALL_ROUTES_LIST = new Map([
'myPermNav'
],
// 我的管理空间
[['myManageSpace', 'myManageSpaceCreate', 'gradingAdminDetail', 'gradingAdminEdit', 'gradingAdminCreate', 'myManageSpaceSubDetail', 'secondaryManageSpaceEdit'], 'myManageSpaceNav'],
[['myManageSpace', 'myManageSpaceCreate', 'myManageSpaceClone', 'myManageSpaceSubDetail', 'secondaryManageSpaceEdit'], 'myManageSpaceNav'],
// 分级管理员
[['ratingManager', 'gradingAdminDetail', 'gradingAdminCreate', 'gradingAdminEdit'], 'gradingAdminNav'],
// 二级管理空间
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/common/router-handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export const getRouterDiff = (payload) => {
'authorBoundaryEditSecondLevel',
'myManageSpace',
'myManageSpaceCreate',
'myManageSpaceClone',
'permTransfer',
'myManageSpaceSubDetail',
'sensitivityLevel',
Expand Down Expand Up @@ -145,6 +146,7 @@ export const getRouterDiff = (payload) => {
'authorBoundaryEditSecondLevel',
'myManageSpace',
'myManageSpaceCreate',
'myManageSpaceClone',
'renewalNotice',
'userOrgPerm'
];
Expand Down Expand Up @@ -269,6 +271,7 @@ export const getRouterDiff = (payload) => {
'secondaryManageSpace',
'myManageSpace',
'myManageSpaceCreate',
'myManageSpaceClone',
'resourcePermManage',
'resourcePermiss',
'sensitivityLevel',
Expand Down Expand Up @@ -298,6 +301,7 @@ export const getNavRouterDiff = (navIndex, managerPerm = '') => {
'addGroupPerm',
'resourcePermiss',
'ratingManager',
'gradingAdminCreate',
'gradingAdminDetail',
'gradingAdminEdit',
'gradingAdminUpdateTemplate',
Expand Down Expand Up @@ -361,6 +365,7 @@ export const getNavRouterDiff = (navIndex, managerPerm = '') => {
'authorBoundaryEditSecondLevel',
'myManageSpace',
'myManageSpaceCreate',
'myManageSpaceClone',
'secondaryManageSpace',
'secondaryManageSpaceCreate',
'secondaryManageSpaceDetail',
Expand Down Expand Up @@ -403,6 +408,7 @@ export const getNavRouterDiff = (navIndex, managerPerm = '') => {
'permTemplateCreate',
'myManageSpace',
'myManageSpaceCreate',
'myManageSpaceClone',
'secondaryManageSpace',
'secondaryManageSpaceCreate',
'secondaryManageSpaceDetail',
Expand Down
16 changes: 15 additions & 1 deletion frontend/src/components/choose-ip/grade/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
@on-load-more="handleLoadMore"
@on-page-change="handlePageChange"
@on-table-page-change="handleTablePageChange"
@on-table-empty-search="handleTableEmptySearch"
@async-load-nodes="handleAsyncNodes"
@async-load-table-nodes="handleAsyncNodes"
/>
Expand Down Expand Up @@ -1352,13 +1353,21 @@
},
async handleAsyncNodes (node, index, flag) {
const chainLen = this.curChain.length;
// 兼容如果是实例视图最后一个节点且child_type为空,则代表没有下一级不需要调接口
if (!node.child_type && node.level + 1 >= chainLen) {
node.expanded = false;
node.async = false;
this.emptyTreeData = formatCodeData(0, this.emptyData, true);
this.removeAsyncNode();
return;
}
window.changeAlert = true;
const asyncItem = {
...ASYNC_ITEM,
parentId: node.nodeId,
parentSyncId: node.id
};
const chainLen = this.curChain.length;
const params = {
limit: this.limit,
offset: 0,
Expand Down Expand Up @@ -2004,6 +2013,11 @@
// 多层拓扑分页
async handleTablePageChange (node, index) {
this.handleLoadMore(node, index, true);
},
handleTableEmptySearch ({ keyword }) {
this.emptyTreeData.tipType = keyword ? 'search' : 'empty';
this.emptyTreeData = formatCodeData(0, this.emptyData, true);
}
}
};
Expand Down
16 changes: 15 additions & 1 deletion frontend/src/components/choose-ip/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
@on-load-more="handleLoadMore"
@on-page-change="handlePageChange"
@on-table-page-change="handleTablePageChange"
@on-table-empty-search="handleTableEmptySearch"
@async-load-nodes="handleAsyncNodes"
@async-load-table-nodes="handleAsyncNodes"
/>
Expand Down Expand Up @@ -1102,6 +1103,15 @@
async handleAsyncNodes (node, index, flag) {
console.log('handleAsyncNodes', node, index);
const chainLen = this.curChain.length;
// 兼容如果是实例视图最后一个节点且child_type为空,则代表没有下一级不需要调接口
if (!node.child_type && node.level + 1 >= chainLen) {
node.expanded = false;
node.async = false;
this.emptyTreeData = formatCodeData(0, this.emptyData, true);
this.removeAsyncNode();
return;
}
window.changeAlert = true;
const asyncItem = {
...ASYNC_ITEM,
Expand All @@ -1110,7 +1120,6 @@
};
const asyncData = new Node(asyncItem, node.level + 1, false, 'async');
this.treeData.splice((index + 1), 0, asyncData);
const chainLen = this.curChain.length;
const params = {
limit: this.limit,
offset: 0,
Expand Down Expand Up @@ -1633,6 +1642,11 @@
// 多层拓扑分页
async handleTablePageChange (node, index) {
this.handleLoadMore(node, index, true);
},
handleTableEmptySearch ({ keyword }) {
this.emptyTreeData.tipType = keyword ? 'search' : 'empty';
this.emptyTreeData = formatCodeData(0, this.emptyData, true);
}
}
};
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/choose-ip/topology-tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,10 @@
});
}
}
// 处理空数据搜索
if (!curNode && this.curTreeTableData.children && !this.curTreeTableData.children.length) {
this.$emit('on-table-empty-search', { keyword: this.tableKeyWord });
}
setTimeout(() => {
this.tableLoading = false;
}, 1000);
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/header-nav/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@ $cubic-bezier: cubic-bezier(0.4, 0, 0.2, 1);
.help-flag {
display: inline-flex;
align-items: center;
.iamcenter-help-fill {
color: #979ba5;
}
&:hover {
.iamcenter-help-fill {
color:#ffffff;
}
.dropdown-panel {
opacity: 1;
visibility: visible;
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/components/header-nav/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</div>
<div class="user fr">
<div class="help-flag">
<Icon type="help-fill" style="color: #979ba5" />
<Icon type="help-fill" />
<div :class="[
'dropdown-panel',
{ 'lang-dropdown-panel': !curLanguageIsCn }
Expand All @@ -42,6 +42,9 @@
<div class="item" @click="handleOpenQuestion">
{{ $t(`m.common['问题反馈']`) }}
</div>
<div class="item" @click="handleOpenSource">
{{ $t(`m.common['开源社区']`) }}
</div>
</div>
</div>
<div class="lang-flag">
Expand Down Expand Up @@ -470,6 +473,10 @@
window.open(window.CE_URL);
},
handleOpenSource () {
window.open(`https://github.com/TencentBlueKing/bk-iam`);
},
back () {
const curRouterName = this.$route.name;
const needConfirmFlag = NEED_CONFIRM_DIALOG_ROUTER.includes(curRouterName);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/render-resource/detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<instance-item
v-for="(instanceItem, instanceIndex) in condition.instance"
:key="instanceIndex"
:title="`${instanceItem.name}(${instanceItem.path.length})`"
:title="`${instanceItem.name}(${instanceItem.displayPath.length})`"
:has-gap="instanceIndex > 0"
:data="instanceItem.displayPath" />
</render-resource-instance>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/language/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const m = {
'搜索无结果': 'Search result is empty',
'退出': 'Quit',
'批量移除': 'Multi-remove',
'版本日志': 'Release note',
'版本日志': 'Release Notes',
'帮助文档': 'Help',
'申请加入用户组': 'Apply for join group',
'申请模板权限': 'Apply for template permissions',
Expand Down Expand Up @@ -178,6 +178,7 @@ export const m = {
'用户包含': 'User includes',
'产品文档': 'Documentation',
'问题反馈': 'Feedback',
'开源社区': 'Open Source',
'正在同步中': 'Syncing',
'新增': 'Add',
'申请新建': 'Apply for new',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/language/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export const m = {
'用户包含': '用户包含',
'产品文档': '产品文档',
'问题反馈': '问题反馈',
'开源社区': '开源社区',
'正在同步中': '正在同步中',
'新增': '新增',
'申请新建': '申请新建',
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/model/instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,14 @@ export default class Instance {
const len = item.length;
const displayName = item.map(sub => sub.name).join('/');
const tempPath = item.filter(v => v.id !== '*');
if (!tempList.some(sub => sub.id === item[len - 1].id && item[len - 1].id !== '*')) {
// 过滤重复id的数据,且最后一条path的实例范围不是无限制
const isUnique = !tempList.some(sub => sub.id === item[len - 1].id && item[len - 1].id !== '*');
if (isUnique) {
let disabled = false;
if (this.instanceNotDisabled) {
disabled = false;
} else {
// disabled = ['', 'custom'].includes(this.flag) ? !item.some(v => v.tag === 'add') : false;
// disabled = ['', 'custom'].includes(this.flag) ? !item.some(v => v.tag === 'add') : false;
disabled = item.some(v => v.tag === 'add') ? false : item.some(subItem => subItem.disabled);
}
tempList.push({
Expand All @@ -129,7 +131,6 @@ export default class Instance {
level: len - 1,
type: item[len - 1].type,
parentChain: tempPath.slice(0, tempPath.length - 1),
// disabled: item.some(v => v.tag === 'add') ? false : item.some(subItem => subItem.disabled),
disabled: disabled,
display_name: displayName
});
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/model/related-resource-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

import { language, il8n } from '@/language';
import { uniqWith, isEqual, isArray } from 'lodash';
import Condition from './condition';

const isCn = language === 'zh-cn';
Expand Down Expand Up @@ -120,7 +121,8 @@ export default class RelateResourceTypes {
}
if (item.instance) {
item.instance.forEach(ins => {
const pathLen = ins.path.length;
const curPath = isArray(ins.path) ? uniqWith(ins.path, isEqual) : [];
const pathLen = curPath.length;
if (pathLen > 0) {
if (!instanceStrMap[ins.name]) {
instanceStrMap[ins.name] = pathLen;
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/router/ce.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ export const routes = [
},
component: MyManageSpaceCreate
},
{
path: ':id/my-manage-space/clone',
name: 'myManageSpaceClone',
meta: {
headerTitle: il8n('nav', '克隆管理空间'),
backRouter: 'myManageSpace'
},
props: true,
component: GradingAdminCreate
},
{
path: 'my-manage-space/sub-detail',
name: 'myManageSpaceSubDetail',
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/router/ee.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,16 @@ export const routes = [
},
component: MyManageSpaceCreate
},
{
path: ':id/my-manage-space/clone',
name: 'myManageSpaceClone',
meta: {
headerTitle: il8n('nav', '克隆管理空间'),
backRouter: 'myManageSpace'
},
props: true,
component: GradingAdminCreate
},
{
path: 'my-manage-space/sub-detail',
name: 'myManageSpaceSubDetail',
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/router/ieod.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ export const routes = [
},
component: MyManageSpaceCreate
},
{
path: ':id/my-manage-space/clone',
name: 'myManageSpaceClone',
meta: {
headerTitle: il8n('nav', '克隆管理空间'),
backRouter: 'myManageSpace'
},
props: true,
component: GradingAdminCreate
},
{
path: 'my-manage-space/sub-detail/:id',
name: 'myManageSpaceSubDetail',
Expand Down
1 change: 0 additions & 1 deletion frontend/src/views/grading-admin/create/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@
import Condition from '@/model/condition';
export default {
name: '',
components: {
IamGuide,
basicInfo,
Expand Down
17 changes: 1 addition & 16 deletions frontend/src/views/grading-admin/index.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<template>
<div class="iam-grading-admin-wrapper">
<!-- <bk-alert type="info" style="margin-bottom: 16px;">
<div slot="title">
{{ $t(`m.grading['页面提示']`) }}
<span class="detail-link" @click="handleOpenMoreLink">{{ $t(`m.common['更多详情']`) }}</span>
</div>
</bk-alert> -->
<render-search>
<bk-button theme="primary" @click="handleCreate" data-test-id="grading_btn_create">
{{ isStaff ? $t(`m.common['申请新建']`) : $t(`m.common['新建']`) }}
Expand Down Expand Up @@ -454,10 +448,6 @@
});
},
handleOpenMoreLink () {
window.open(`${window.BK_DOCS_URL_PREFIX}/权限中心/产品白皮书/场景案例/GradingManager.md`);
},
refreshCurrentQuery () {
const { limit, current } = this.pagination;
const queryParams = {
Expand Down Expand Up @@ -835,11 +825,6 @@
routerName = 'authorBoundary';
this.$store.commit('updateIndex', 1);
window.localStorage.setItem('index', 1);
},
clone: () => {
routerName = 'secondaryManageSpaceCreate';
this.$store.commit('updateIndex', 0);
window.localStorage.setItem('index', 0);
}
};
routerNav[mode]();
Expand Down Expand Up @@ -879,7 +864,7 @@
},
handleOpenDocu () {
const GRADE_DOCU_LINK = '/权限中心/产品白皮书/场景案例/GradingManager.md';
const GRADE_DOCU_LINK = '/IAM/UserGuide/Feature/ManagerCreate.md';
window.open(`${window.BK_DOCS_URL_PREFIX}${GRADE_DOCU_LINK}`);
}
Expand Down
Loading

0 comments on commit b6f6e4d

Please sign in to comment.