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); 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..cdb5719e1 100644 --- a/frontend/src/views/group/components/preview-resource-dialog.vue +++ b/frontend/src/views/group/components/preview-resource-dialog.vue @@ -70,22 +70,27 @@ 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: resourceGroupId } = 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: resourceGroupId } }; + // 无实例和属性条件不需要调用接口 + if (!related_resource_type.condition.length || !resourceGroupId) { + return; + } if (!isTemplate) { requestParams.data.policy_id = this.params.policy_id; } else { 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 87bbae34e..1ec69998a 100644 --- a/frontend/src/views/group/components/render-instance-table.vue +++ b/frontend/src/views/group/components/render-instance-table.vue @@ -513,10 +513,12 @@ return curData.selectionMode; }, isShowPreview () { - if (this.curIndex === -1) { + if (this.curIndex === -1 || this.curGroupIndex === -1) { return false; } - return this.tableList[this.curIndex].policy_id !== ''; + // 预览模板需要groupId和resourceGroupId + const { policy_id: policyId, resource_groups: resourceGroups } = this.tableList[this.curIndex]; + return policyId !== '' && resourceGroups[this.curGroupIndex].id && this.groupId; }, isShowView () { return (payload) => { @@ -1338,11 +1340,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/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 27238e91d..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; @@ -1017,11 +1010,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}`)); // 只获取授权范围内的资源实例 @@ -1220,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; 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