From e153c1d3b190e02f6cd9c45b0eef6691dae5755e Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Wed, 4 Sep 2024 14:33:57 +0800 Subject: [PATCH 01/13] =?UTF-8?q?fix:=20=E5=85=BC=E5=AE=B9=E5=AE=9E?= =?UTF-8?q?=E4=BE=8B=E8=A7=86=E5=9B=BE=E6=9C=80=E5=90=8E=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E4=B8=94=E5=BD=93=E5=89=8D=E6=8B=93=E6=89=91?= =?UTF-8?q?=E5=B1=82=E7=BA=A7child=5Ftype=E4=B8=BA=E7=A9=BA=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E9=9C=80=E8=A6=81=E8=AF=B7=E6=B1=82=E4=B8=8B?= =?UTF-8?q?=E4=B8=80=E5=B1=82=E6=8B=93=E6=89=91=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/choose-ip/grade/index.vue | 16 +++++++++++++++- frontend/src/components/choose-ip/index.vue | 16 +++++++++++++++- .../src/components/choose-ip/topology-tree.vue | 4 ++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/choose-ip/grade/index.vue b/frontend/src/components/choose-ip/grade/index.vue index fe967af2b..6fb0b1df5 100644 --- a/frontend/src/components/choose-ip/grade/index.vue +++ b/frontend/src/components/choose-ip/grade/index.vue @@ -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" /> @@ -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, @@ -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); } } }; diff --git a/frontend/src/components/choose-ip/index.vue b/frontend/src/components/choose-ip/index.vue index 753fa574b..7ccc76a77 100644 --- a/frontend/src/components/choose-ip/index.vue +++ b/frontend/src/components/choose-ip/index.vue @@ -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" /> @@ -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, @@ -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, @@ -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); } } }; diff --git a/frontend/src/components/choose-ip/topology-tree.vue b/frontend/src/components/choose-ip/topology-tree.vue index d8eb2b1d7..ec462e84f 100644 --- a/frontend/src/components/choose-ip/topology-tree.vue +++ b/frontend/src/components/choose-ip/topology-tree.vue @@ -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); From 91d428cf3c8424122c7d1c9d1d8f30c4fe9ebc83 Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Tue, 10 Sep 2024 12:38:05 +0800 Subject: [PATCH 02/13] =?UTF-8?q?fix:=20=E3=80=90=E6=9D=83=E9=99=90?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E6=B5=8B=E8=AF=95=E3=80=91=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E3=80=8B=E6=88=91=E7=9A=84=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=A9=BA=E9=97=B4=E6=96=B0=E5=BB=BA=E7=AE=A1=E7=90=86=E7=A9=BA?= =?UTF-8?q?=E9=97=B4=E6=97=B6=EF=BC=8C=E7=82=B9=E5=87=BB=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=EF=BC=8C=E9=A1=B5=E9=9D=A2=E8=BF=94=E5=9B=9E=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=20fix:=20=E3=80=907.2=E7=89=88=E6=9C=AC=E6=9D=83=E9=99=90?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E6=B5=8B=E8=AF=95=E3=80=91=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E8=B7=B3=E8=BD=AC=E9=97=AE=E9=A2=98=20fix:?= =?UTF-8?q?=20=E9=80=9A=E7=94=A8=E5=8A=9F=E8=83=BDicon=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=BF=80=E6=B4=BB=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/common/constants.js | 3 ++- frontend/src/common/router-handle.js | 6 ++++++ frontend/src/components/header-nav/index.css | 6 ++++++ frontend/src/components/header-nav/index.vue | 2 +- frontend/src/language/lang/en.js | 2 +- frontend/src/router/ce.js | 10 ++++++++++ frontend/src/router/ee.js | 10 ++++++++++ frontend/src/router/ieod.js | 10 ++++++++++ .../src/views/grading-admin/create/index.vue | 1 - frontend/src/views/grading-admin/index.vue | 17 +---------------- frontend/src/views/my-manage-space/index.vue | 4 ++-- 11 files changed, 49 insertions(+), 22 deletions(-) diff --git a/frontend/src/common/constants.js b/frontend/src/common/constants.js index aee8225fd..0db3b164d 100644 --- a/frontend/src/common/constants.js +++ b/frontend/src/common/constants.js @@ -132,6 +132,7 @@ export const NEED_CONFIRM_DIALOG_ROUTER = [ 'gradingAdminCreate', 'gradingAdminEdit', 'myManageSpaceCreate', + 'myManageSpaceClone', 'authorBoundaryEditFirstLevel', 'secondaryManageSpaceCreate' ]; @@ -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'], // 二级管理空间 diff --git a/frontend/src/common/router-handle.js b/frontend/src/common/router-handle.js index 342c54bc5..4e0b2ea85 100644 --- a/frontend/src/common/router-handle.js +++ b/frontend/src/common/router-handle.js @@ -103,6 +103,7 @@ export const getRouterDiff = (payload) => { 'authorBoundaryEditSecondLevel', 'myManageSpace', 'myManageSpaceCreate', + 'myManageSpaceClone', 'permTransfer', 'myManageSpaceSubDetail', 'sensitivityLevel', @@ -145,6 +146,7 @@ export const getRouterDiff = (payload) => { 'authorBoundaryEditSecondLevel', 'myManageSpace', 'myManageSpaceCreate', + 'myManageSpaceClone', 'renewalNotice', 'userOrgPerm' ]; @@ -269,6 +271,7 @@ export const getRouterDiff = (payload) => { 'secondaryManageSpace', 'myManageSpace', 'myManageSpaceCreate', + 'myManageSpaceClone', 'resourcePermManage', 'resourcePermiss', 'sensitivityLevel', @@ -298,6 +301,7 @@ export const getNavRouterDiff = (navIndex, managerPerm = '') => { 'addGroupPerm', 'resourcePermiss', 'ratingManager', + 'gradingAdminCreate', 'gradingAdminDetail', 'gradingAdminEdit', 'gradingAdminUpdateTemplate', @@ -361,6 +365,7 @@ export const getNavRouterDiff = (navIndex, managerPerm = '') => { 'authorBoundaryEditSecondLevel', 'myManageSpace', 'myManageSpaceCreate', + 'myManageSpaceClone', 'secondaryManageSpace', 'secondaryManageSpaceCreate', 'secondaryManageSpaceDetail', @@ -403,6 +408,7 @@ export const getNavRouterDiff = (navIndex, managerPerm = '') => { 'permTemplateCreate', 'myManageSpace', 'myManageSpaceCreate', + 'myManageSpaceClone', 'secondaryManageSpace', 'secondaryManageSpaceCreate', 'secondaryManageSpaceDetail', diff --git a/frontend/src/components/header-nav/index.css b/frontend/src/components/header-nav/index.css index 5a22f109a..47ed18642 100644 --- a/frontend/src/components/header-nav/index.css +++ b/frontend/src/components/header-nav/index.css @@ -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; diff --git a/frontend/src/components/header-nav/index.vue b/frontend/src/components/header-nav/index.vue index 43a9ab64a..943718b09 100644 --- a/frontend/src/components/header-nav/index.vue +++ b/frontend/src/components/header-nav/index.vue @@ -30,7 +30,7 @@
- +
- {{ isStaff ? $t(`m.common['申请新建']`) : $t(`m.common['新建']`) }} @@ -454,10 +448,6 @@ }); }, - handleOpenMoreLink () { - window.open(`${window.BK_DOCS_URL_PREFIX}/权限中心/产品白皮书/场景案例/GradingManager.md`); - }, - refreshCurrentQuery () { const { limit, current } = this.pagination; const queryParams = { @@ -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](); @@ -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}`); } diff --git a/frontend/src/views/my-manage-space/index.vue b/frontend/src/views/my-manage-space/index.vue index 34d1ca2ce..b0c8f53de 100644 --- a/frontend/src/views/my-manage-space/index.vue +++ b/frontend/src/views/my-manage-space/index.vue @@ -736,7 +736,7 @@ window.localStorage.setItem('index', 1); }, clone: () => { - routerName = 'gradingAdminCreate'; + routerName = 'myManageSpaceClone'; this.$store.commit('updateIndex', 0); window.localStorage.setItem('index', 0); }, @@ -969,7 +969,7 @@ ); }, handleOpenDocu () { - const GRADE_DOCU_LINK = '/权限中心/产品白皮书/场景案例/GradingManager.md'; + const GRADE_DOCU_LINK = '/IAM/UserGuide/Feature/UserApply.md'; window.open(`${window.BK_DOCS_URL_PREFIX}${GRADE_DOCU_LINK}`); } } From ac2d980f3b60c54470e4ae2a236ba94a750937c4 Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Wed, 11 Sep 2024 11:46:33 +0800 Subject: [PATCH 03/13] =?UTF-8?q?fix:=20=E6=9B=B4=E6=94=B97.1=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E9=93=BE=E6=8E=A5=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/header-nav/index.vue | 2 +- frontend/src/views/grading-admin/index.vue | 2 +- frontend/src/views/my-manage-space/index.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/header-nav/index.vue b/frontend/src/components/header-nav/index.vue index 943718b09..f7e6ba862 100644 --- a/frontend/src/components/header-nav/index.vue +++ b/frontend/src/components/header-nav/index.vue @@ -170,7 +170,7 @@ }; }; - const NORMAL_DOCU_LINK = '/IAM/UserGuide/Introduce/README.md'; + const NORMAL_DOCU_LINK = '/IAM/1.12/UserGuide/Introduce/README.md'; // const GRADE_DOCU_LINK = '/权限中心/产品白皮书/场景案例/GradingManager.md'; const docuLinkMap = new Map([ diff --git a/frontend/src/views/grading-admin/index.vue b/frontend/src/views/grading-admin/index.vue index bf331f50a..f04ef30d5 100644 --- a/frontend/src/views/grading-admin/index.vue +++ b/frontend/src/views/grading-admin/index.vue @@ -864,7 +864,7 @@ }, handleOpenDocu () { - const GRADE_DOCU_LINK = '/IAM/UserGuide/Feature/ManagerCreate.md'; + const GRADE_DOCU_LINK = '/IAM/1.12/UserGuide/Feature/ManagerCreate.md'; window.open(`${window.BK_DOCS_URL_PREFIX}${GRADE_DOCU_LINK}`); } diff --git a/frontend/src/views/my-manage-space/index.vue b/frontend/src/views/my-manage-space/index.vue index b0c8f53de..b98a05eb2 100644 --- a/frontend/src/views/my-manage-space/index.vue +++ b/frontend/src/views/my-manage-space/index.vue @@ -969,7 +969,7 @@ ); }, handleOpenDocu () { - const GRADE_DOCU_LINK = '/IAM/UserGuide/Feature/UserApply.md'; + const GRADE_DOCU_LINK = '/IAM/1.12/UserGuide/Feature/UserApply.md'; window.open(`${window.BK_DOCS_URL_PREFIX}${GRADE_DOCU_LINK}`); } } From 1180b179cf2d207434569e110e7e949980bc8c1c Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Wed, 11 Sep 2024 14:26:42 +0800 Subject: [PATCH 04/13] =?UTF-8?q?feature:=20=E6=B7=BB=E5=8A=A0=E5=BC=80?= =?UTF-8?q?=E6=BA=90=E7=A4=BE=E5=8C=BA=E9=80=89=E9=A1=B9=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/header-nav/index.vue | 9 ++++++++- frontend/src/language/lang/en.js | 1 + frontend/src/language/lang/zh.js | 1 + frontend/src/views/grading-admin/index.vue | 2 +- frontend/src/views/my-manage-space/index.vue | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/header-nav/index.vue b/frontend/src/components/header-nav/index.vue index f7e6ba862..8343001d2 100644 --- a/frontend/src/components/header-nav/index.vue +++ b/frontend/src/components/header-nav/index.vue @@ -42,6 +42,9 @@
{{ $t(`m.common['问题反馈']`) }}
+
+ {{ $t(`m.common['开源社区']`) }} +
@@ -170,7 +173,7 @@ }; }; - const NORMAL_DOCU_LINK = '/IAM/1.12/UserGuide/Introduce/README.md'; + const NORMAL_DOCU_LINK = '/IAM/UserGuide/Introduce/README.md'; // const GRADE_DOCU_LINK = '/权限中心/产品白皮书/场景案例/GradingManager.md'; const docuLinkMap = new Map([ @@ -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); diff --git a/frontend/src/language/lang/en.js b/frontend/src/language/lang/en.js index 412a65d2a..a525bdc78 100644 --- a/frontend/src/language/lang/en.js +++ b/frontend/src/language/lang/en.js @@ -178,6 +178,7 @@ export const m = { '用户包含': 'User includes', '产品文档': 'Documentation', '问题反馈': 'Feedback', + '开源社区': 'Open Source', '正在同步中': 'Syncing', '新增': 'Add', '申请新建': 'Apply for new', diff --git a/frontend/src/language/lang/zh.js b/frontend/src/language/lang/zh.js index 536c163a6..8c476adf4 100644 --- a/frontend/src/language/lang/zh.js +++ b/frontend/src/language/lang/zh.js @@ -176,6 +176,7 @@ export const m = { '用户包含': '用户包含', '产品文档': '产品文档', '问题反馈': '问题反馈', + '开源社区': '开源社区', '正在同步中': '正在同步中', '新增': '新增', '申请新建': '申请新建', diff --git a/frontend/src/views/grading-admin/index.vue b/frontend/src/views/grading-admin/index.vue index f04ef30d5..bf331f50a 100644 --- a/frontend/src/views/grading-admin/index.vue +++ b/frontend/src/views/grading-admin/index.vue @@ -864,7 +864,7 @@ }, handleOpenDocu () { - const GRADE_DOCU_LINK = '/IAM/1.12/UserGuide/Feature/ManagerCreate.md'; + const GRADE_DOCU_LINK = '/IAM/UserGuide/Feature/ManagerCreate.md'; window.open(`${window.BK_DOCS_URL_PREFIX}${GRADE_DOCU_LINK}`); } diff --git a/frontend/src/views/my-manage-space/index.vue b/frontend/src/views/my-manage-space/index.vue index b98a05eb2..b0c8f53de 100644 --- a/frontend/src/views/my-manage-space/index.vue +++ b/frontend/src/views/my-manage-space/index.vue @@ -969,7 +969,7 @@ ); }, handleOpenDocu () { - const GRADE_DOCU_LINK = '/IAM/1.12/UserGuide/Feature/UserApply.md'; + const GRADE_DOCU_LINK = '/IAM/UserGuide/Feature/UserApply.md'; window.open(`${window.BK_DOCS_URL_PREFIX}${GRADE_DOCU_LINK}`); } } From bdfe2faf8fbe52b93976e894105ad39d96d7479c Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Mon, 23 Sep 2024 18:09:10 +0800 Subject: [PATCH 05/13] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=AE=9E=E4=BE=8B=E8=AF=A6=E6=83=85path=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E4=B8=8Ecount=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/render-resource/detail.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/render-resource/detail.vue b/frontend/src/components/render-resource/detail.vue index 32c6b6b9b..1daad4194 100644 --- a/frontend/src/components/render-resource/detail.vue +++ b/frontend/src/components/render-resource/detail.vue @@ -17,7 +17,7 @@ From 714b9ef89cbebb303bfd003ff37a70161337501f Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Mon, 23 Sep 2024 18:30:58 +0800 Subject: [PATCH 06/13] =?UTF-8?q?fix:=20=E7=BB=9F=E4=B8=80=E6=A0=B9?= =?UTF-8?q?=E6=8D=AEdisplayPath=E5=8E=BB=E6=8E=89=E9=87=8D=E5=A4=8Dpath?= =?UTF-8?q?=E9=93=BE=E8=B7=AF=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/model/related-resource-types.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/model/related-resource-types.js b/frontend/src/model/related-resource-types.js index 216c434c1..ac05425d4 100644 --- a/frontend/src/model/related-resource-types.js +++ b/frontend/src/model/related-resource-types.js @@ -25,6 +25,7 @@ */ import { language, il8n } from '@/language'; +import { uniqWith, isEqual, isArray } from 'lodash'; import Condition from './condition'; const isCn = language === 'zh-cn'; @@ -120,7 +121,8 @@ export default class RelateResourceTypes { } if (item.instance) { item.instance.forEach(ins => { - const pathLen = ins.path.length; + const curPath = uniqWith(ins.path, isEqual); + const pathLen = isArray(curPath) ? curPath.length : 0; if (pathLen > 0) { if (!instanceStrMap[ins.name]) { instanceStrMap[ins.name] = pathLen; From 146b67980fe87f8a1711763a21cdefb01cf37738 Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Tue, 24 Sep 2024 16:16:46 +0800 Subject: [PATCH 07/13] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=94=B1?= =?UTF-8?q?=E4=BA=8E=E6=8B=93=E6=89=91=E5=AE=9E=E4=BE=8B=E6=98=AF=E6=89=81?= =?UTF-8?q?=E5=B9=B3=E5=8C=96=E7=BB=93=E6=9E=84=E6=97=A0=E6=B3=95=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E5=AE=9E=E4=BE=8B=E4=BD=9C=E7=94=A8=E5=9F=9F=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=EF=BC=8C=E4=BC=9A=E5=AD=98=E5=9C=A8=E5=88=86=E7=BA=A7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=8E=88=E6=9D=83=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E6=98=AF=E7=88=B6=E7=BA=A7=EF=BC=8C=E4=BD=86?= =?UTF-8?q?=E6=98=AF=E9=80=89=E6=8B=A9=E5=AD=90=E9=9B=86=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=85=B3=E8=81=94=E6=93=8D=E4=BD=9C=E4=BC=9A=E9=80=A0=E6=88=90?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=94=99=E4=B9=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/render-instance-table.vue | 52 +++++++++++++------ 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/frontend/src/views/group/components/render-instance-table.vue b/frontend/src/views/group/components/render-instance-table.vue index af7baedeb..2bd5f25d2 100644 --- a/frontend/src/views/group/components/render-instance-table.vue +++ b/frontend/src/views/group/components/render-instance-table.vue @@ -1244,35 +1244,43 @@ curData.resource_groups[this.curGroupIndex].related_resource_types = [curData.resource_groups[this.curGroupIndex] .related_resource_types[this.curResIndex]]; curData.resource_groups[this.curGroupIndex].related_resource_types[0].condition = curPayload; - const relatedList = _.cloneDeep(this.tableList.filter(item => { + const relatedList = this.tableList.filter(item => { return !item.isAggregate && relatedActions.includes(item.id) && curData.detail.system.id === item.detail.system.id && item.resource_groups[this.curGroupIndex] - && !item.resource_groups[this.curGroupIndex].related_resource_types.every(sub => sub.empty); - })); + && item.resource_groups[this.curGroupIndex].related_resource_types.every(sub => !(sub.hasOwnProperty('empty') && sub.empty)); + }); if (relatedList.length > 0) { relatedList.forEach(item => { delete item.policy_id; item.resource_groups[this.curGroupIndex].related_resource_types.forEach(resItem => { - resItem.condition.forEach(conditionItem => { - conditionItem.instances = conditionItem.instance || []; - conditionItem.attributes = conditionItem.attribute || []; - delete conditionItem.instance; - delete conditionItem.attribute; - }); + if (resItem.condition.length && resItem.condition[0] !== 'none') { + resItem.condition.forEach(conditionItem => { + conditionItem.instances = conditionItem.instance || []; + conditionItem.attributes = conditionItem.attribute || []; + delete conditionItem.instance; + delete conditionItem.attribute; + }); + } }); item.expired_at = PERMANENT_TIMESTAMP; }); } curData.resource_groups = curData.resource_groups.filter(item => item.related_resource_types); - const targetPolicies = relatedList.filter(item => - item.resource_groups[this.curGroupIndex].related_resource_types - && item.resource_groups[this.curGroupIndex].related_resource_types.length - && (item.resource_groups[this.curGroupIndex].related_resource_types[0].condition.length === 0 - || item.resource_groups[this.curGroupIndex].related_resource_types[0].condition.some( - (v) => v.instances.length > 0 || v.attributes.length > 0)) - ); + const targetPolicies = relatedList.filter(item => { + const relatedTypeList = item.resource_groups[this.curGroupIndex].related_resource_types; + return relatedTypeList + && relatedTypeList.length + && (relatedTypeList[0].condition.length === 0 + || (relatedTypeList[0].condition.length > 0 + && relatedTypeList[0].condition[0] !== 'none' + && relatedTypeList[0].condition.some((v) => + (v.instances.length > 0 && v.instances.some((p) => p.path.length > 0)) + || v.attributes.length > 0) + ) + ); + }); try { const res = await this.$store.dispatch('permApply/getRelatedPolicy', { source_policy: curData, @@ -1330,8 +1338,16 @@ resource.instances.forEach((ins) => { ins.path.forEach((p, pathIndex) => { if (p.length > 0) { + // 处理授权范围是父级,但是选择了子集数据,需要查找所选数据是不是属于授权范围内的子集数据 + let curParentChain = []; + const tempPath = p.filter(v => v.id !== '*'); + if (tempPath.length) { + curParentChain = tempPath.slice(0, tempPath.length - 1); + } + // 判断授权范围是不是父级数据 + const isExistParent = curParentChain.filter((subPath) => scopeInsList.includes(`${subPath.id}&${subPath.name}&${subPath.type}`)); // 只获取授权范围内的资源实例 - ins.path[pathIndex] = p.filter((subPath) => scopeInsList.includes(`${subPath.id}&${subPath.name}&${subPath.type}`)); + ins.path[pathIndex] = p.filter((subPath) => scopeInsList.includes(`${subPath.id}&${subPath.name}&${subPath.type}`) || isExistParent.length > 0); } }); // 因为path链路是多维数组且无法确定链路数量,所以这里需要过滤掉空数组 @@ -1340,6 +1356,8 @@ ins.paths = _.cloneDeep(ins.path); } }); + // 这里会存在path的内容不在授权范围内会被过滤掉,而path内容是必填项 + resource.instances = resource.instances.filter((k) => k.path && k.path.length > 0); if (resource.attributes && resource.attributes.length > 0 && scopeAttributeList && scopeAttributeList.length > 0 ) { From 2abd1f1fca03728c70ff09450c27ea2055ba8bd4 Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Tue, 24 Sep 2024 16:26:17 +0800 Subject: [PATCH 08/13] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=81=B6?= =?UTF-8?q?=E5=8F=91path=E8=A7=86=E5=9B=BE=E5=B1=82=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E4=B8=8E=E5=AE=9E=E9=99=85=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E5=AE=9E=E4=BE=8B=E6=95=B0=E9=87=8F=E4=B8=8D?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/model/instance.js | 7 ++++--- frontend/src/model/related-resource-types.js | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend/src/model/instance.js b/frontend/src/model/instance.js index 653c252d7..e57ae9c9d 100644 --- a/frontend/src/model/instance.js +++ b/frontend/src/model/instance.js @@ -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({ @@ -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 }); diff --git a/frontend/src/model/related-resource-types.js b/frontend/src/model/related-resource-types.js index ac05425d4..5de4dc405 100644 --- a/frontend/src/model/related-resource-types.js +++ b/frontend/src/model/related-resource-types.js @@ -121,8 +121,8 @@ export default class RelateResourceTypes { } if (item.instance) { item.instance.forEach(ins => { - const curPath = uniqWith(ins.path, isEqual); - const pathLen = isArray(curPath) ? curPath.length : 0; + const curPath = isArray(ins.path) ? uniqWith(ins.path, isEqual) : []; + const pathLen = curPath.length; if (pathLen > 0) { if (!instanceStrMap[ins.name]) { instanceStrMap[ins.name] = pathLen; From 197a7e60ef4aa5f18fa52d1e9c42e070a7241325 Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Tue, 24 Sep 2024 18:14:02 +0800 Subject: [PATCH 09/13] =?UTF-8?q?feature:=20=E5=AF=B9=E6=8E=A5=E8=93=9D?= =?UTF-8?q?=E7=9B=BE=E7=94=A8=E6=88=B7=E7=BB=84=E6=9D=83=E9=99=90=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2iframe=E4=BC=A0=E9=80=92=E4=BA=8B=E4=BB=B6=E9=9C=80?= =?UTF-8?q?=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/group/detail/group-perm-new.vue | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/group/detail/group-perm-new.vue b/frontend/src/views/group/detail/group-perm-new.vue index 923ef21ea..98c8775b8 100644 --- a/frontend/src/views/group/detail/group-perm-new.vue +++ b/frontend/src/views/group/detail/group-perm-new.vue @@ -98,7 +98,7 @@