Skip to content

Commit

Permalink
Merge pull request #638 from veops/dev_ui_ipam
Browse files Browse the repository at this point in the history
fix(ui): ipam - filter search value error
  • Loading branch information
LHRUN authored Nov 12, 2024
2 parents 03fdf5c + 5fa18ee commit 6f13321
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
14 changes: 9 additions & 5 deletions cmdb-ui/src/components/CMDBFilterComp/expression.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@
:normalizer="
(node) => {
return {
id: String(node[0] || ''),
label: node[1] ? node[1].label || node[0] : node[0],
children: node.children && node.children.length ? node.children : undefined,
id: node.id,
label: node.label,
children: node.children,
}
}
"
Expand Down Expand Up @@ -352,8 +352,12 @@ export default {
},
getChoiceValueByProperty(property) {
const _find = this.canSearchPreferenceAttrList.find((item) => item.name === property)
if (_find) {
return _find.choice_value
if (_find?.choice_value?.length) {
return _find.choice_value.map((node) => ({
id: String(node?.[0] ?? ''),
label: node?.[1]?.label || node?.[0] || '',
children: node?.children?.length ? node.children : undefined
}))
}
return []
},
Expand Down
3 changes: 2 additions & 1 deletion cmdb-ui/src/modules/cmdb/views/ipam/components/ipamTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<div class="ipam-tree-main">
<a-tree
v-if="treeData.length"
autoExpandParent
:treeData="filterTreeData"
:selectedKeys="treeKey ? [treeKey] : []"
:defaultExpandedKeys="treeKey ? [treeKey] : []"
Expand Down Expand Up @@ -238,7 +239,7 @@ export default {
}
}

& > li:first-child {
.ipam-tree-node-all {
.ant-tree-switcher {
display: none;
}
Expand Down
1 change: 1 addition & 0 deletions cmdb-ui/src/modules/cmdb/views/ipam/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ export default {
showCatalogBtn: rootShowCatalogBtn,
showSubnetBtn: rootShowSubnetBtn,
parentId: '',
class: 'ipam-tree-node-all'
})

this.treeData = treeData
Expand Down

0 comments on commit 6f13321

Please sign in to comment.