From 34528c1d08ee7e7935d9183b7a1b04d3e777d02e Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Wed, 16 Oct 2024 12:13:42 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=BB=84=E3=80=81=E4=BA=8C=E7=BA=A7=E7=AE=A1=E7=90=86=E7=A9=BA?= =?UTF-8?q?=E9=97=B4=E4=B8=BB=E6=93=8D=E4=BD=9C=E4=B8=8B=E5=85=B3=E8=81=94?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E7=9A=84=E8=B5=84=E6=BA=90=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E6=8E=89=E6=97=A0=E9=99=90=E5=88=B6=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E5=81=B6=E7=8E=B0=E6=8E=88=E6=9D=83=E8=BE=B9?= =?UTF-8?q?=E7=95=8C=E6=BA=A2=E5=87=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/group/components/render-instance-table.vue | 11 ++++++----- .../components/render-instance-table.vue | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/frontend/src/views/group/components/render-instance-table.vue b/frontend/src/views/group/components/render-instance-table.vue index 87bbae34e..5aa523995 100644 --- a/frontend/src/views/group/components/render-instance-table.vue +++ b/frontend/src/views/group/components/render-instance-table.vue @@ -1338,11 +1338,12 @@ 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); - } + // let curParentChain = []; + // const tempPath = p.filter(v => v.id !== '*'); + // if (tempPath.length) { + // curParentChain = tempPath.slice(0, tempPath.length - 1); + // } + const curParentChain = p.slice(0, p.length - 1); // 判断授权范围是不是父级数据 const isExistParent = curParentChain.filter((subPath) => scopeInsList.includes(`${subPath.id}&${subPath.name}&${subPath.type}`)); // 只获取授权范围内的资源实例 diff --git a/frontend/src/views/manage-spaces/secondary-manage-space/components/render-instance-table.vue b/frontend/src/views/manage-spaces/secondary-manage-space/components/render-instance-table.vue index 27238e91d..662395ac8 100644 --- a/frontend/src/views/manage-spaces/secondary-manage-space/components/render-instance-table.vue +++ b/frontend/src/views/manage-spaces/secondary-manage-space/components/render-instance-table.vue @@ -1017,11 +1017,12 @@ 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); - } + // let curParentChain = []; + // const tempPath = p.filter(v => v.id !== '*'); + // if (tempPath.length) { + // curParentChain = tempPath.slice(0, tempPath.length - 1); + // } + const curParentChain = p.slice(0, p.length - 1); // 判断授权范围是不是父级数据 const isExistParent = curParentChain.filter((subPath) => scopeInsList.includes(`${subPath.id}&${subPath.name}&${subPath.type}`)); // 只获取授权范围内的资源实例 From 1cffa0f77bc5f81d4c4618b00b77cc7f9ae67e1c Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Wed, 6 Nov 2024 10:54:30 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dchild=5Ftype?= =?UTF-8?q?=E5=8F=96=E5=80=BC=E9=94=99=E8=AF=AF=E5=AF=BC=E8=87=B4=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=B1=95=E5=BC=80=E9=9D=9E=E6=9C=80=E5=90=8E=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E8=8A=82=E7=82=B9=E6=8B=93=E6=89=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/choose-ip/grade/index.vue | 2 +- frontend/src/components/choose-ip/index.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/choose-ip/grade/index.vue b/frontend/src/components/choose-ip/grade/index.vue index 6fb0b1df5..dc6b6f835 100644 --- a/frontend/src/components/choose-ip/grade/index.vue +++ b/frontend/src/components/choose-ip/grade/index.vue @@ -1355,7 +1355,7 @@ async handleAsyncNodes (node, index, flag) { const chainLen = this.curChain.length; // 兼容如果是实例视图最后一个节点且child_type为空,则代表没有下一级不需要调接口 - if (!node.child_type && node.level + 1 >= chainLen) { + if (!node.childType && node.level + 1 >= chainLen) { node.expanded = false; node.async = false; 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 7ccc76a77..59c623a25 100644 --- a/frontend/src/components/choose-ip/index.vue +++ b/frontend/src/components/choose-ip/index.vue @@ -1105,7 +1105,7 @@ console.log('handleAsyncNodes', node, index); const chainLen = this.curChain.length; // 兼容如果是实例视图最后一个节点且child_type为空,则代表没有下一级不需要调接口 - if (!node.child_type && node.level + 1 >= chainLen) { + if (!node.childType && node.level + 1 >= chainLen) { node.expanded = false; node.async = false; this.emptyTreeData = formatCodeData(0, this.emptyData, true); From 789fad194b27d51177fe829a3066dda6b167138a Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Wed, 6 Nov 2024 16:21:02 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20=E5=8F=AA=E6=9C=89=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=BB=84=E6=A8=A1=E5=9D=97=E4=B8=94=E8=AF=A5=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=BB=84=E5=AD=98=E5=9C=A8=E6=89=8D=E8=83=BD=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=AE=9E=E4=BE=8B=E5=B7=AE=E5=BC=82=E5=AF=B9?= =?UTF-8?q?=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/render-instance-table.vue | 3 +- .../components/render-instance-table.vue | 41 ------------------- .../components/render-instance-table.vue | 41 ------------------- 3 files changed, 2 insertions(+), 83 deletions(-) diff --git a/frontend/src/views/group/components/render-instance-table.vue b/frontend/src/views/group/components/render-instance-table.vue index 5aa523995..75d278d0a 100644 --- a/frontend/src/views/group/components/render-instance-table.vue +++ b/frontend/src/views/group/components/render-instance-table.vue @@ -516,7 +516,8 @@ if (this.curIndex === -1) { return false; } - return this.tableList[this.curIndex].policy_id !== ''; + // 预览模板需要groupId + return this.tableList[this.curIndex].policy_id !== '' && this.groupId; }, isShowView () { return (payload) => { diff --git a/frontend/src/views/manage-spaces/components/render-instance-table.vue b/frontend/src/views/manage-spaces/components/render-instance-table.vue index e9b4a1a1f..6dea95740 100644 --- a/frontend/src/views/manage-spaces/components/render-instance-table.vue +++ b/frontend/src/views/manage-spaces/components/render-instance-table.vue @@ -169,7 +169,6 @@
{{ $t(`m.common['保存']`) }} - {{ $t(`m.common['预览']`) }} {{ $t(`m.common['取消']`) }}
@@ -341,12 +340,6 @@ .related_resource_types[this.curResIndex]; return curData.selectionMode; }, - isShowPreview () { - if (this.curIndex === -1) { - return false; - } - return this.tableList[this.curIndex].policy_id !== ''; - }, // 处理无限制和聚合后多个tab数据结构不兼容情况 formatDisplayValue () { return (payload) => { @@ -716,40 +709,6 @@ this.curGroupIndex = -1; }, - handlerResourcePreview () { - const { id } = this.tableList[this.curIndex].resource_groups[this.curGroupIndex]; - const { system_id, type, name } = this.tableList[this.curIndex].resource_groups[this.curGroupIndex] - .related_resource_types[this.curResIndex]; - const condition = []; - const conditionData = this.$refs.renderResourceRef.handleGetPreviewValue(); - conditionData.forEach(item => { - const { id, attribute, instance } = item; - condition.push({ - id, - attributes: attribute ? attribute.filter(item => item.values.length > 0) : [], - instances: instance ? instance.filter(item => item.path.length > 0) : [] - }); - }); - this.previewResourceParams = { - id: this.templateId, - policy_id: this.tableList[this.curIndex].policy_id, - resource_group_id: id, - related_resource_type: { - system_id, - type, - name, - condition: condition.filter(item => item.attributes.length > 0 || item.instances.length > 0) - }, - action_id: this.tableList[this.curIndex].id, - reverse: true, - groupId: this.groupId, - isTemplate: this.tableList[this.curIndex].isTemplate, - isNotLimit: conditionData.length === 0 - }; - this.previewDialogTitle = this.$t(`m.info['操作侧边栏操作的资源实例差异对比']`, { value: `${this.$t(`m.common['【']`)}${this.tableList[this.curIndex].name}${this.$t(`m.common['】']`)}` }); - this.isShowPreviewDialog = true; - }, - handlerConditionMouseover (payload) { if (Object.keys(this.curCopyParams).length < 1 && this.curCopyMode === 'normal') { return; diff --git a/frontend/src/views/manage-spaces/secondary-manage-space/components/render-instance-table.vue b/frontend/src/views/manage-spaces/secondary-manage-space/components/render-instance-table.vue index 662395ac8..f572eed1e 100644 --- a/frontend/src/views/manage-spaces/secondary-manage-space/components/render-instance-table.vue +++ b/frontend/src/views/manage-spaces/secondary-manage-space/components/render-instance-table.vue @@ -207,7 +207,6 @@ data-test-id="group_btn_resourceInstanceSubmit"> {{ $t(`m.common['保存']`) }} - {{ $t(`m.common['预览']`) }} {{ $t(`m.common['取消']`) }} @@ -457,12 +456,6 @@ .related_resource_types[this.curResIndex]; return curData.selectionMode; }, - isShowPreview () { - if (this.curIndex === -1) { - return false; - } - return this.tableList[this.curIndex].policy_id !== ''; - }, isShowView () { return (payload) => { return !payload.isEmpty; @@ -1221,40 +1214,6 @@ // this.$emit('handleAggregateAction', false) // } }, - handleResourcePreview () { - // debugger - window.changeDialog = true; - // eslint-disable-next-line max-len - const { system_id, type, name } = this.tableList[this.curIndex].resource_groups[this.curGroupIndex].related_resource_types[this.curResIndex]; - const condition = []; - const conditionData = this.$refs.renderResourceRef.handleGetPreviewValue(); - conditionData.forEach(item => { - const { id, attribute, instance } = item; - condition.push({ - id, - attributes: attribute ? attribute.filter(item => item.values.length > 0) : [], - instances: instance ? instance.filter(item => item.path.length > 0) : [] - }); - }); - this.previewResourceParams = { - id: this.templateId, - action_id: this.tableList[this.curIndex].id, - related_resource_type: { - system_id, - type, - name, - condition: condition.filter(item => item.attributes.length > 0 || item.instances.length > 0) - }, - reverse: true, - groupId: this.groupId, - policy_id: this.tableList[this.curIndex].policy_id, - resource_group_id: this.tableList[this.curIndex].resource_groups[this.curGroupIndex].id, - isTemplate: this.tableList[this.curIndex].isTemplate, - isNotLimit: conditionData.length === 0 - }; - this.previewDialogTitle = this.$t(`m.info['操作侧边栏操作的资源实例差异对比']`, { value: `${this.$t(`m.common['【']`)}${this.tableList[this.curIndex].name}${this.$t(`m.common['】']`)}` }); - this.isShowPreviewDialog = true; - }, handlerConditionMouseover (payload) { if (Object.keys(this.curCopyParams).length < 1 && this.curCopyMode === 'normal') { return; From ed1c0604136ee8b462cf673516a9dfec8218960f Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Wed, 6 Nov 2024 16:52:56 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=97=A0=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=AE=9E=E4=BE=8B=E5=92=8C=E5=B1=9E=E6=80=A7=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=E9=A2=84=E8=A7=88=E5=B7=AE=E5=BC=82=E5=AF=B9?= =?UTF-8?q?=E6=AF=94=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/render-instance-table.vue | 37 +------------------ .../components/preview-resource-dialog.vue | 11 ++++-- 2 files changed, 9 insertions(+), 39 deletions(-) diff --git a/frontend/src/views/grading-admin/components/render-instance-table.vue b/frontend/src/views/grading-admin/components/render-instance-table.vue index 0b4215480..3a51145fc 100644 --- a/frontend/src/views/grading-admin/components/render-instance-table.vue +++ b/frontend/src/views/grading-admin/components/render-instance-table.vue @@ -166,7 +166,6 @@
{{ $t(`m.common['保存']`) }} - {{ $t(`m.common['预览']`) }} {{ $t(`m.common['取消']`) }}
@@ -332,12 +331,6 @@ .related_resource_types[this.curResIndex]; return curData.selectionMode; }, - isShowPreview () { - if (this.curIndex === -1) { - return false; - } - return this.tableList[this.curIndex].policy_id !== ''; - }, // 处理无限制和聚合后多个tab数据结构不兼容情况 formatDisplayValue () { return (payload) => { @@ -707,35 +700,7 @@ this.curResIndex = -1; this.curGroupIndex = -1; }, - - handlerResourcePreview () { - const { id } = this.tableList[this.curIndex].resource_groups[this.curGroupIndex]; - const { system_id, type, name } = this.tableList[this.curIndex].resource_groups[this.curGroupIndex] - .related_resource_types[this.curResIndex]; - const condition = []; - const conditionData = this.$refs.renderResourceRef.handleGetPreviewValue(); - conditionData.forEach(item => { - const { id, attribute, instance } = item; - condition.push({ - id, - attributes: attribute ? attribute.filter(item => item.values.length > 0) : [], - instances: instance ? instance.filter(item => item.path.length > 0) : [] - }); - }); - this.previewResourceParams = { - policy_id: this.tableList[this.curIndex].policy_id, - resource_group_id: id, - related_resource_type: { - system_id, - type, - name, - condition: condition.filter(item => item.attributes.length > 0 || item.instances.length > 0) - } - }; - this.previewDialogTitle = this.$t(`m.info['操作侧边栏操作的资源实例差异对比']`, { value: `${this.$t(`m.common['【']`)}${this.tableList[this.curIndex].name}${this.$t(`m.common['】']`)}` }); - this.isShowPreviewDialog = true; - }, - + handlerConditionMouseover (payload) { if (Object.keys(this.curCopyParams).length < 1 && this.curCopyMode === 'normal') { return; diff --git a/frontend/src/views/group/components/preview-resource-dialog.vue b/frontend/src/views/group/components/preview-resource-dialog.vue index 2fa458de2..2a35bc404 100644 --- a/frontend/src/views/group/components/preview-resource-dialog.vue +++ b/frontend/src/views/group/components/preview-resource-dialog.vue @@ -73,13 +73,18 @@ this.isLoading = true; const isTemplate = this.params.isTemplate; const method = isTemplate ? 'groupTemplateCompare' : 'groupPolicyCompare'; + const { groupId, related_resource_type, resource_group_id } = this.params; const requestParams = { - id: this.params.groupId, + id: groupId, data: { - related_resource_type: this.params.related_resource_type, - resource_group_id: this.params.resource_group_id + related_resource_type, + resource_group_id } }; + // 无实例和属性条件不需要调用接口 + if (!related_resource_type.condition.length) { + return; + } if (!isTemplate) { requestParams.data.policy_id = this.params.policy_id; } else { From 3f78e5be28a99ee784a18a024a7aab41cbe05d2a Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Wed, 6 Nov 2024 17:05:36 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix:=20=20=E4=BF=AE=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BB=84=E6=97=A0=E8=B5=84=E6=BA=90=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E5=92=8C=E5=B1=9E=E6=80=A7=E6=9D=A1=E4=BB=B6=E6=97=B6=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E5=B7=AE=E5=BC=82=E5=AF=B9=E6=AF=94=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/group/components/preview-resource-dialog.vue | 8 ++++---- .../src/views/group/components/render-instance-table.vue | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/src/views/group/components/preview-resource-dialog.vue b/frontend/src/views/group/components/preview-resource-dialog.vue index 2a35bc404..cdb5719e1 100644 --- a/frontend/src/views/group/components/preview-resource-dialog.vue +++ b/frontend/src/views/group/components/preview-resource-dialog.vue @@ -70,19 +70,18 @@ methods: { async fetchData () { // debugger - this.isLoading = true; const isTemplate = this.params.isTemplate; const method = isTemplate ? 'groupTemplateCompare' : 'groupPolicyCompare'; - const { groupId, related_resource_type, resource_group_id } = this.params; + const { groupId, related_resource_type, resource_group_id: resourceGroupId } = this.params; const requestParams = { id: groupId, data: { related_resource_type, - resource_group_id + resource_group_id: resourceGroupId } }; // 无实例和属性条件不需要调用接口 - if (!related_resource_type.condition.length) { + if (!related_resource_type.condition.length || !resourceGroupId) { return; } if (!isTemplate) { @@ -91,6 +90,7 @@ requestParams.templateId = this.params.id; requestParams.data.action_id = this.params.action_id; } + this.isLoading = true; try { const res = await this.$store.dispatch(`userGroup/${method}`, requestParams); this.conditionData = res.data.map(item => new CompareCondition(item)); diff --git a/frontend/src/views/group/components/render-instance-table.vue b/frontend/src/views/group/components/render-instance-table.vue index 75d278d0a..1ec69998a 100644 --- a/frontend/src/views/group/components/render-instance-table.vue +++ b/frontend/src/views/group/components/render-instance-table.vue @@ -513,11 +513,12 @@ return curData.selectionMode; }, isShowPreview () { - if (this.curIndex === -1) { + if (this.curIndex === -1 || this.curGroupIndex === -1) { return false; } - // 预览模板需要groupId - return this.tableList[this.curIndex].policy_id !== '' && this.groupId; + // 预览模板需要groupId和resourceGroupId + const { policy_id: policyId, resource_groups: resourceGroups } = this.tableList[this.curIndex]; + return policyId !== '' && resourceGroups[this.curGroupIndex].id && this.groupId; }, isShowView () { return (payload) => { From a6cc2e528516c2a39e684acceb00b13dc1e617b9 Mon Sep 17 00:00:00 2001 From: nannan00 <17491932+nannan00@users.noreply.github.com> Date: Thu, 7 Nov 2024 14:42:49 +0800 Subject: [PATCH 6/6] docs: v1.10.37 version log --- saas/VERSION | 2 +- saas/resources/version_log/change_log.md | 11 +++++++++++ saas/resources/version_log/change_log_en.md | 11 +++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/saas/VERSION b/saas/VERSION index f745fc065..b5e7929e7 100644 --- a/saas/VERSION +++ b/saas/VERSION @@ -1 +1 @@ -1.10.36 +1.10.37 diff --git a/saas/resources/version_log/change_log.md b/saas/resources/version_log/change_log.md index 7c178d9f0..eecd488b6 100644 --- a/saas/resources/version_log/change_log.md +++ b/saas/resources/version_log/change_log.md @@ -1,3 +1,14 @@ + +# V1.10.37 版本更新日志 + +### 缺陷修复 +* 修复用户组无资源实例和属性条件时预览差异对比报错 +* 只有用户组模块且该用户组存在才能预览资源实例差异对比 +* 修复child_type取值错误导致无法展开非最后一个节点拓扑 +* 修复用户组、二级管理空间主操作下关联操作的资源实例过滤掉无限制后,会偶现授权边界溢出问题 + +--- + # V1.10.36 版本更新日志 diff --git a/saas/resources/version_log/change_log_en.md b/saas/resources/version_log/change_log_en.md index 9b547e92d..0c6cdc052 100644 --- a/saas/resources/version_log/change_log_en.md +++ b/saas/resources/version_log/change_log_en.md @@ -1,3 +1,14 @@ + +# V1.10.37 Version Update Log + +### Fixes +* Fixed an error when previewing difference comparisons if a user group has no resource instances and attribute conditions. +* Resource instance difference comparisons can only be previewed if the user group module exists and the user group itself exists. +* Fixed an issue where incorrect child_type values prevented the expansion of non-terminal node topologies. +* Resolved an issue where, in the main operations of user groups and secondary management spaces, removing unrestricted resource instances from associated operations occasionally caused authorization boundary overflows. + +--- + # V1.10.36 Version Update Log