ui: fix conflict/regression found in AutogenView

After forward merged from 4.18->main, found a regression due to
3c25a35426 where any columns which are
custom functions don't render. Such as metrics columns.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2023-08-11 16:38:52 +05:30
parent 62feb24de6
commit d22a3d517d
1 changed files with 9 additions and 0 deletions

View File

@ -835,6 +835,7 @@ export default {
})
}
const customRender = {}
for (var columnKey of this.columnKeys) {
let key = columnKey
let title = columnKey === 'cidr' && this.columnKeys.includes('ip6cidr') ? 'ipv4.cidr' : columnKey
@ -842,9 +843,11 @@ export default {
if ('customTitle' in columnKey && 'field' in columnKey) {
key = columnKey.field
title = columnKey.customTitle
customRender[key] = columnKey[key]
} else {
key = Object.keys(columnKey)[0]
title = Object.keys(columnKey)[0]
customRender[key] = columnKey[key]
}
}
this.columns.push({
@ -981,6 +984,12 @@ export default {
for (let idx = 0; idx < this.items.length; idx++) {
this.items[idx].key = idx
for (const key in customRender) {
const func = customRender[key]
if (func && typeof func === 'function') {
this.items[idx][key] = func(this.items[idx])
}
}
if (this.$route.path.startsWith('/ldapsetting')) {
this.items[idx].id = this.items[idx].hostname
}