Skip to content

Commit

Permalink
feat(ui): dcim - update rack list filter
Browse files Browse the repository at this point in the history
  • Loading branch information
LHRUN committed Nov 27, 2024
1 parent c961e28 commit c3c8602
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 17 additions & 2 deletions cmdb-ui/src/modules/cmdb/views/dcim/components/dcimMain/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@

<a-select
class="dcim-main-row-select"
:getPopupContainer="(trigger) => trigger.parentElement"
v-model="currentRackType"
>
<a-icon slot="suffixIcon" type="caret-down" />
<a-select-option
v-for="(item) in rackTypeSelectOption"
:key="item.value"
:value="item.value"
:class="item.value === 'unitAbnormal' ? 'dcim-main-row-select-unitAbnormal' : ''"
>
{{ item.label }}
</a-select-option>
Expand Down Expand Up @@ -142,7 +144,7 @@ export default {
value: 'table',
icon: 'monitor-list_view'
}
],
]
}
},
computed: {
Expand All @@ -164,6 +166,11 @@ export default {
})
}

selectOption.push({
value: 'unitAbnormal',
label: this.$t('cmdb.dcim.unitAbnormal')
})

return selectOption
},
filterRackList() {
Expand All @@ -174,7 +181,11 @@ export default {
}

if (this.currentRackType !== 'all') {
rackList = rackList.filter((item) => item.rack_type === this.currentRackType)
if (this.currentRackType === 'unitAbnormal') {
rackList = rackList.filter((item) => item.u_slot_abnormal)
} else {
rackList = rackList.filter((item) => item.rack_type === this.currentRackType)
}
}

return rackList
Expand Down Expand Up @@ -312,6 +323,10 @@ export default {
width: 120px;
margin-left: 22px;
flex-shrink: 0;

/deep/ &-unitAbnormal {
border-top: dashed 1px #e8e8e8;
}
}

&-right {
Expand Down
2 changes: 1 addition & 1 deletion cmdb-ui/src/modules/cmdb/views/dcim/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export default {
},

async getRackData() {
await this.getAttrList(DCIM_CITYPE_NAME.RACK, DCIM_CITYPE_NAME.RACK)
await this.getAttrList(DCIM_CITYPE_NAME.RACK, DCIM_TYPE.RACK)

const CITypeRes = await getCIType(DCIM_CITYPE_NAME.RACK)
this.rackCITYpe = CITypeRes?.ci_types?.[0] || {}
Expand Down

0 comments on commit c3c8602

Please sign in to comment.