-
Hi, I would like to add a value mapping to a stat panel. It is for a service status display. I need the JSON snippet to look like this: {
...
"fieldConfig": {
"defaults": {
"mappings": [
{
"options": {
"0": {
"color": "red",
"index": 0,
"text": "down"
},
"1": {
"color": "green",
"index": 1,
"text": "up"
}
},
"type": "value"
}
]
...
}
}
} I have tried some variations similar to the following, but they don't work:
Do I need to use an |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi, one solution is just to add the JSON directly:
This doesn't feel like the right approach, but it works for now. I don't understand the concept behind how the library works. |
Beta Was this translation helpful? Give feedback.
-
The error messages aren't very good, but I discovered with trial and error, that it's possible to make it work like this + g.panel.stat.standardOptions.withMappings([{
type: 'value',
options: {
'0': {
color: 'red',
index: 1,
text: 'server.com is DOWN',
},
'1': {
color: 'green',
index: 0,
text: 'server.com is UP',
},
},
}]) |
Beta Was this translation helpful? Give feedback.
The error messages aren't very good, but I discovered with trial and error, that it's possible to make it work like this