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

fix: changed var label to ne null from empty #3385

Merged
merged 1 commit into from
Dec 17, 2024
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
18 changes: 18 additions & 0 deletions cmd/tools/grafana/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1713,6 +1713,24 @@ func checkVariablesAreFSxFriendly(t *testing.T, path string, data []byte) {
})
}

func TestLabelsNullVariables(t *testing.T) {
VisitDashboards(cDotDashboards,
func(path string, data []byte) {
checkVariablesLabelNull(t, path, data)
})
}

func checkVariablesLabelNull(t *testing.T, path string, data []byte) {
gjson.GetBytes(data, "templating.list").ForEach(func(key, value gjson.Result) bool {
if value.Get("label").Type != gjson.Null && value.Get("label").ClonedString() == "" {
varName := value.Get("name").ClonedString()
t.Errorf("dashboard=%s path=templating.list[%s]. variable=%s label should not be empty",
ShortPath(path), key.ClonedString(), varName)
}
return true
})
}

var linkPath = regexp.MustCompile(`/d/(.*?)/`)
var supportedLinkedObjects = []string{"cluster", "datacenter", "aggr", "svm", "volume", "node", "qtree", "home_node", "tenant"}
var exceptionPathPanelObject = []string{
Expand Down
10 changes: 5 additions & 5 deletions grafana/dashboards/cmode/cdot.json
Original file line number Diff line number Diff line change
Expand Up @@ -2054,7 +2054,7 @@
"error": null,
"hide": 0,
"includeAll": false,
"label": "",
"label": null,
"multi": true,
"name": "Datacenter",
"options": [],
Expand All @@ -2080,7 +2080,7 @@
"error": null,
"hide": 0,
"includeAll": true,
"label": "",
"label": null,
"multi": true,
"name": "Cluster",
"options": [],
Expand All @@ -2106,7 +2106,7 @@
"error": null,
"hide": 0,
"includeAll": true,
"label": "",
"label": null,
"multi": true,
"name": "SVM",
"options": [],
Expand All @@ -2132,7 +2132,7 @@
"error": null,
"hide": 0,
"includeAll": true,
"label": "",
"label": null,
"multi": true,
"name": "Volume",
"options": [],
Expand Down Expand Up @@ -2251,7 +2251,7 @@
"error": null,
"hide": 0,
"includeAll": false,
"label": "",
"label": null,
"multi": false,
"name": "IncludeRoot",
"options": [
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/cmode/changelogMonitor.json
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@
"error": null,
"hide": 0,
"includeAll": false,
"label": "",
"label": null,
"multi": true,
"name": "Datacenter",
"options": [],
Expand All @@ -1499,7 +1499,7 @@
"error": null,
"hide": 0,
"includeAll": true,
"label": "",
"label": null,
"multi": true,
"name": "Cluster",
"options": [],
Expand Down
6 changes: 3 additions & 3 deletions grafana/dashboards/cmode/cluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -5107,7 +5107,7 @@
"error": null,
"hide": 0,
"includeAll": false,
"label": "",
"label": null,
"multi": true,
"name": "Datacenter",
"options": [],
Expand All @@ -5131,7 +5131,7 @@
"definition": "label_values(cluster_tags{system_type!=\"7mode\", datacenter=~\"$Datacenter\"},tag)",
"hide": 0,
"includeAll": true,
"label": "",
"label": null,
"multi": true,
"name": "Tag",
"options": [],
Expand All @@ -5157,7 +5157,7 @@
"error": null,
"hide": 0,
"includeAll": true,
"label": "",
"label": null,
"multi": true,
"name": "Cluster",
"options": [],
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/cmode/datacenter.json
Original file line number Diff line number Diff line change
Expand Up @@ -3954,7 +3954,7 @@
"error": null,
"hide": 0,
"includeAll": false,
"label": "",
"label": null,
"multi": true,
"name": "Datacenter",
"options": [],
Expand All @@ -3980,7 +3980,7 @@
"error": null,
"hide": 0,
"includeAll": true,
"label": "",
"label": null,
"multi": true,
"name": "Cluster",
"options": [],
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/cmode/health.json
Original file line number Diff line number Diff line change
Expand Up @@ -4436,7 +4436,7 @@
"error": null,
"hide": 0,
"includeAll": false,
"label": "",
"label": null,
"multi": true,
"name": "Datacenter",
"options": [],
Expand All @@ -4462,7 +4462,7 @@
"error": null,
"hide": 0,
"includeAll": true,
"label": "",
"label": null,
"multi": true,
"name": "Cluster",
"options": [],
Expand Down
2 changes: 1 addition & 1 deletion grafana/dashboards/cmode/mcc_cluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -4241,7 +4241,7 @@
"error": null,
"hide": 0,
"includeAll": false,
"label": "",
"label": null,
"multi": false,
"name": "TopResources",
"options": [
Expand Down
2 changes: 1 addition & 1 deletion grafana/dashboards/cmode/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3204,7 +3204,7 @@
"error": null,
"hide": 0,
"includeAll": true,
"label": "",
"label": null,
"multi": true,
"name": "Hostname",
"options": [],
Expand Down
10 changes: 5 additions & 5 deletions grafana/dashboards/cmode/network.json
Original file line number Diff line number Diff line change
Expand Up @@ -4924,7 +4924,7 @@
"error": null,
"hide": 0,
"includeAll": false,
"label": "",
"label": null,
"multi": true,
"name": "Datacenter",
"options": [],
Expand All @@ -4950,7 +4950,7 @@
"error": null,
"hide": 0,
"includeAll": true,
"label": "",
"label": null,
"multi": true,
"name": "Cluster",
"options": [],
Expand All @@ -4976,7 +4976,7 @@
"error": null,
"hide": 0,
"includeAll": true,
"label": "",
"label": null,
"multi": true,
"name": "Node",
"options": [],
Expand All @@ -5002,7 +5002,7 @@
"error": null,
"hide": 0,
"includeAll": true,
"label": "",
"label": null,
"multi": true,
"name": "Eth",
"options": [],
Expand All @@ -5028,7 +5028,7 @@
"error": null,
"hide": 0,
"includeAll": true,
"label": "",
"label": null,
"multi": true,
"name": "FCP",
"options": [],
Expand Down
Loading