Skip to content

Commit

Permalink
Allow configuring sort order for variables (#1014)
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskorn authored Jul 11, 2023
1 parent 4fef6d8 commit 0618da7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions grafana-builder/grafana.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
rows+: [row { panels: panels }],
},

addTemplate(name, metric_name, label_name, hide=0, allValue=null, includeAll=false):: self {
addTemplate(name, metric_name, label_name, hide=0, allValue=null, includeAll=false, sort=2):: self {
templating+: {
list+: [{
allValue: allValue,
Expand All @@ -31,7 +31,7 @@
query: 'label_values(%s, %s)' % [metric_name, label_name],
refresh: 1,
regex: '',
sort: 2,
sort: sort,
tagValuesQuery: '',
tags: [],
tagsQuery: '',
Expand All @@ -41,7 +41,7 @@
},
},

addMultiTemplate(name, metric_name, label_name, hide=0, allValue='.+'):: self {
addMultiTemplate(name, metric_name, label_name, hide=0, allValue='.+', sort=2):: self {
templating+: {
list+: [{
allValue: allValue,
Expand All @@ -60,7 +60,7 @@
query: 'label_values(%s, %s)' % [metric_name, label_name],
refresh: 1,
regex: '',
sort: 2,
sort: sort,
tagValuesQuery: '',
tags: [],
tagsQuery: '',
Expand Down

0 comments on commit 0618da7

Please sign in to comment.