useTable with complex response
Hello, first time here, and first project with refine!
I'm trying to get some data from an api (prometheus alertmanager), and I ran into some issues.
I can get the data from the API, but my problem is with parsing it correctly.
I couldn't find how to either - 1) map the values into a different simple structure (e.g., map fingerprint to id, labels.* to * and so on), or 2) specifiy dataIndex in <Table.Column> props so that it reads the nested values.
An example response can look like this:
{
"annotations": {
"description": "Disk usage is more than 80%\n VALUE = 81.5100154083205\n LABELS = map[instance:some-ip:port job:win_env site:site-name volume:volume-name]",
"summary": "Windows Server disk Space Usage (instance some-ip:port)"
},
"endsAt": "2024-12-29T12:12:04.162Z",
"fingerprint": "3cf84c3fb282409f",
"receivers": [
{
"name": "mail"
}
],
"startsAt": "2024-12-25T06:36:04.162Z",
"status": {
"inhibitedBy": [],
"silencedBy": [],
"state": "active"
},
"updatedAt": "2024-12-29T12:08:04.159Z",
"generatorURL": "generator_url/graph?g0.expr=80+%3C+%28100+-+100+%2A+%28%28windows_logical_disk_free_bytes+%2F+1024+%2F+1024%29+%2F+%28windows_logical_disk_size_bytes+%2F+1024+%2F+1024%29%29%29+%3C+85&g0.tab=1",
"labels": {
"alertname": "WindowsServerDiskSpaceUsage",
"instance": "some-ip:port",
"job": "win_env",
"severity": "minor",
"site": "site-name",
"volume": "volume-name"
}
}
Additional info:
Using Vite, AntD, custom auth (currently none).
I'm trying to get some data from an api (prometheus alertmanager), and I ran into some issues.
I can get the data from the API, but my problem is with parsing it correctly.
I couldn't find how to either - 1) map the values into a different simple structure (e.g., map fingerprint to id, labels.* to * and so on), or 2) specifiy dataIndex in <Table.Column> props so that it reads the nested values.
An example response can look like this:
{
"annotations": {
"description": "Disk usage is more than 80%\n VALUE = 81.5100154083205\n LABELS = map[instance:some-ip:port job:win_env site:site-name volume:volume-name]",
"summary": "Windows Server disk Space Usage (instance some-ip:port)"
},
"endsAt": "2024-12-29T12:12:04.162Z",
"fingerprint": "3cf84c3fb282409f",
"receivers": [
{
"name": "mail"
}
],
"startsAt": "2024-12-25T06:36:04.162Z",
"status": {
"inhibitedBy": [],
"silencedBy": [],
"state": "active"
},
"updatedAt": "2024-12-29T12:08:04.159Z",
"generatorURL": "generator_url/graph?g0.expr=80+%3C+%28100+-+100+%2A+%28%28windows_logical_disk_free_bytes+%2F+1024+%2F+1024%29+%2F+%28windows_logical_disk_size_bytes+%2F+1024+%2F+1024%29%29%29+%3C+85&g0.tab=1",
"labels": {
"alertname": "WindowsServerDiskSpaceUsage",
"instance": "some-ip:port",
"job": "win_env",
"severity": "minor",
"site": "site-name",
"volume": "volume-name"
}
}
Additional info:
Using Vite, AntD, custom auth (currently none).
