weaveworks / grafanalib

Python library for building Grafana dashboards
Apache License 2.0
1.86k stars 309 forks source link

Added sortBy parameter to Table panel #612

Closed Git-Lior closed 1 year ago

Git-Lior commented 1 year ago

What does this do?

This change allows sorting table rows by their fields

Why is it a good idea?

This is a useful feature which is supported in grafana v8: https://grafana.com/docs/grafana/v8.0/panels/visualizations/table/#sort-column

Context

sortBy in grafana's Table panel options: https://github.com/grafana/grafana/blob/v8.0.x/public/app/plugins/panel/table/models.gen.ts#L17

The name for TableSortByField was inspired by the matching type in grafana: https://github.com/grafana/grafana/blob/main/packages/grafana-ui/src/components/Table/types.ts#L24