Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add table column filter for dashboards #2088

Merged
merged 2 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions cmd/tools/grafana/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,27 @@ func checkRate1m(t *testing.T, path string, data []byte) {
}
}

func TestTableFilter(t *testing.T) {
visitDashboards(
[]string{"../../../grafana/dashboards/cmode", "../../../grafana/dashboards/storagegrid"},
func(path string, data []byte) {
checkTableFilter(t, path, data)
})
}

func checkTableFilter(t *testing.T, path string, data []byte) {
dashPath := shortPath(path)
visitAllPanels(data, func(path string, key, value gjson.Result) {
panelType := value.Get("type").String()
if panelType == "table" {
isFilterable := value.Get("fieldConfig.defaults.custom.filterable").String()
if isFilterable != "true" {
t.Errorf(`dashboard=%s path=panels[%d] does not enable filtering for the table`, dashPath, key.Int())
}
}
})
}

func TestTitlesOfTopN(t *testing.T) {
visitDashboards(
[]string{"../../../grafana/dashboards/cmode", "../../../grafana/dashboards/storagegrid"},
Expand Down
2 changes: 1 addition & 1 deletion grafana/dashboards/cmode/aggregate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3087,7 +3087,7 @@
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 2,
"mappings": [],
Expand Down
6 changes: 3 additions & 3 deletions grafana/dashboards/cmode/cdot.json
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 0,
"mappings": [],
Expand Down Expand Up @@ -791,7 +791,7 @@
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 0,
"mappings": [],
Expand Down Expand Up @@ -921,7 +921,7 @@
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 0,
"mappings": [],
Expand Down
18 changes: 9 additions & 9 deletions grafana/dashboards/cmode/cluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 1,
"mappings": [],
Expand Down Expand Up @@ -218,7 +218,7 @@
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 1,
"mappings": [],
Expand Down Expand Up @@ -316,7 +316,7 @@
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 0,
"mappings": [],
Expand Down Expand Up @@ -414,7 +414,7 @@
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 0,
"mappings": [],
Expand Down Expand Up @@ -513,7 +513,7 @@
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 0,
"mappings": [],
Expand Down Expand Up @@ -612,7 +612,7 @@
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 0,
"mappings": [],
Expand Down Expand Up @@ -983,7 +983,7 @@
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 0,
"mappings": [],
Expand Down Expand Up @@ -1090,7 +1090,7 @@
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 0,
"mappings": [],
Expand Down Expand Up @@ -1586,7 +1586,7 @@
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 0,
"mappings": [],
Expand Down
8 changes: 4 additions & 4 deletions grafana/dashboards/cmode/compliance.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 0,
"mappings": [],
Expand Down Expand Up @@ -506,7 +506,7 @@
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -1659,7 +1659,7 @@
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 0,
"mappings": [],
Expand Down Expand Up @@ -2002,7 +2002,7 @@
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down
6 changes: 3 additions & 3 deletions grafana/dashboards/cmode/data_protection_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -737,7 +737,7 @@
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -1265,7 +1265,7 @@
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down
6 changes: 3 additions & 3 deletions grafana/dashboards/cmode/disk.json
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@
"custom": {
"align": null,
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 2,
"mappings": [],
Expand Down Expand Up @@ -760,7 +760,7 @@
"custom": {
"align": null,
"displayMode": "auto",
"filterable": false
"filterable": true
},
"decimals": 2,
"mappings": [],
Expand Down Expand Up @@ -1346,7 +1346,7 @@
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down
25 changes: 16 additions & 9 deletions grafana/dashboards/cmode/health.json
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,8 @@
},
"custom": {
"align": "auto",
"displayMode": "auto"
"displayMode": "auto",
"filterable": true
},
"decimals": 0,
"mappings": [],
Expand Down Expand Up @@ -757,7 +758,8 @@
},
"custom": {
"align": "auto",
"displayMode": "auto"
"displayMode": "auto",
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -1661,7 +1663,7 @@
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -2047,7 +2049,7 @@
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -2462,7 +2464,8 @@
},
"custom": {
"align": "auto",
"displayMode": "auto"
"displayMode": "auto",
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -2562,7 +2565,8 @@
},
"custom": {
"align": "auto",
"displayMode": "auto"
"displayMode": "auto",
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -2728,7 +2732,8 @@
},
"custom": {
"align": "auto",
"displayMode": "auto"
"displayMode": "auto",
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -2816,7 +2821,8 @@
},
"custom": {
"align": "auto",
"displayMode": "auto"
"displayMode": "auto",
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -2920,7 +2926,8 @@
},
"custom": {
"align": "auto",
"displayMode": "auto"
"displayMode": "auto",
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down
19 changes: 12 additions & 7 deletions grafana/dashboards/cmode/lun.json
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@
"custom": {
"align": "auto",
"displayMode": "color-background-solid",
"filterable": false,
"filterable": true,
"width": 0
},
"mappings": [],
Expand Down Expand Up @@ -593,7 +593,8 @@
},
"custom": {
"align": "auto",
"displayMode": "auto"
"displayMode": "auto",
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -696,7 +697,8 @@
},
"custom": {
"align": "auto",
"displayMode": "auto"
"displayMode": "auto",
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -799,7 +801,8 @@
},
"custom": {
"align": "auto",
"displayMode": "color-background-solid"
"displayMode": "color-background-solid",
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -910,7 +913,8 @@
},
"custom": {
"align": "auto",
"displayMode": "auto"
"displayMode": "auto",
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -1013,7 +1017,8 @@
},
"custom": {
"align": "auto",
"displayMode": "auto"
"displayMode": "auto",
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down Expand Up @@ -1115,7 +1120,7 @@
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
"filterable": true
},
"mappings": [],
"thresholds": {
Expand Down
Loading