-
Notifications
You must be signed in to change notification settings - Fork 50
table panel builder: hideFrom viz doesn't work #1348
Description
Hello,
I am building a custom visualisation. Before I used this to hide all columns except specific ones:
return PanelBuilders.table()
.setCustomFieldConfig('hidden', true)
.setOverrides((b) => {
b.matchFieldsWithName('name')
.overrideCustomFieldConfig('hidden', false)
})
.build()However in the newer versions you're supposed to use hideFrom instead of hidden.
return PanelBuilders.table()
.setCustomFieldConfig('hideFrom', { viz: true })
.setOverrides((b) => {
b.matchFieldsWithName('name')
.overrideCustomFieldConfig('hideFrom', { viz: false })
// ^^^ this breaks because legend and tooltip are also required
})
.build()legend and tooltip are also required in the override. That's fine, then we'll add them.
return PanelBuilders.table()
.setCustomFieldConfig('hideFrom', { viz: true })
.setOverrides((b) => {
b.matchFieldsWithName('name')
.overrideCustomFieldConfig('hideFrom', { viz: false, legend: false, tooltip: false })
})
.build()Now this compiles, but it doesn't actually work. When looking at the scene-debugger the override for hideFrom is completely gone and no data shows.
So I looked at a dashboard JSON. This stores the overrides like this:
"overrides": [
{
"matcher": {
"id": "byName",
"options": "name"
},
"properties": [
{
"id": "custom.hideFrom.viz",
^^^^ this is the weird part
"value": true
}
]
}
]Then I tried to use the PanelBuilder like this:
return PanelBuilders.table()
.setCustomFieldConfig('hideFrom', { viz: true })
.setOverrides((b) => {
b.matchFieldsWithName('name')
.overrideCustomFieldConfig('hideFrom.viz', false)
})
.build()And this actually works, but it does give an error in the compiler!
Interestingly enough, the transformer organize, stores the fieldConfig like this:
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"hideFrom": {
"viz": false
},
"inspect": false
},Which is the structured way again.
With the hidden fields overrides broken, my custom UI doesn't work anymore.
For now I've suppressed the error with // @ts-ignore