From 556e617e88764694d80815a5994313bd40154705 Mon Sep 17 00:00:00 2001 From: Chris Trott <908409+trotttrotttrott@users.noreply.github.com> Date: Mon, 24 May 2021 20:19:51 -0600 Subject: [PATCH] Update grafonnet-7.0 --- grafonnet-7.0/DOCS.md | 51 +++++++++++++++++++++---- grafonnet-7.0/dashboard.libsonnet | 14 +++---- grafonnet-7.0/grafana.libsonnet | 1 + grafonnet-7.0/panel/stat.libsonnet | 12 +++--- grafonnet-7.0/template/custom.libsonnet | 36 +++++++++++++++++ 5 files changed, 93 insertions(+), 21 deletions(-) create mode 100644 grafonnet-7.0/template/custom.libsonnet diff --git a/grafonnet-7.0/DOCS.md b/grafonnet-7.0/DOCS.md index 9e2057f..9e3c09f 100644 --- a/grafonnet-7.0/DOCS.md +++ b/grafonnet-7.0/DOCS.md @@ -11,6 +11,7 @@ * [target](#target) * [prometheus.new](#targetPrometheusnew) * [template](#template) + * [custom.new](#templateCustomnew) * [datasource.new](#templateDatasourcenew) * [query.new](#templateQuerynew) @@ -56,10 +57,6 @@ Instantiate a dashboard. * **refreshIntervals**: (type: array, default: `["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"]`) -#### #addTemplate - -* **template**: (type: object) - #### #addAnnotation * **builtIn**: (type: integer, default: `0`) @@ -78,6 +75,10 @@ Instantiate a dashboard. * **showIn**: (type: integer, default: `0`) +#### #addTemplate + +* **template**: (type: object) + ## panel @@ -530,7 +531,7 @@ Instantiate a dashboard. * **values**: (type: boolean, default: `false`) -#### #addPanelLink +#### #addDataLink * **targetBlank**: (type: boolean, default: `true`) @@ -538,7 +539,7 @@ Instantiate a dashboard. * **url**: (type: string, default: `null`) -#### #addDataLink +#### #addPanelLink * **targetBlank**: (type: boolean, default: `true`) @@ -756,7 +757,41 @@ Instantiate a dashboard. -### tamplate.datasource.new +### template.custom.new + + + +* **allValue**: (type: string, default: `null`) + +* **hide**: (type: integer, default: `0`) + +* **includeAll**: (type: boolean, default: `false`) + +* **label**: (type: string, default: `null`) + +* **multi**: (type: boolean, default: `false`) + +* **name**: (type: string, default: `null`) + +* **query**: (type: string, default: `null`) + +* **queryValue**: (type: string, default: `""`) + +* **skipUrlSync**: (type: string, default: `false`) + + +#### #setCurrent + +* **selected**: (type: boolean, default: `false`) + +* **text**: (type: string, default: `null`) + +* **value**: (type: string, default: `null`) + + + + +### template.datasource.new @@ -790,7 +825,7 @@ Instantiate a dashboard. -### tamplate.query.new +### template.query.new diff --git a/grafonnet-7.0/dashboard.libsonnet b/grafonnet-7.0/dashboard.libsonnet index 8614bf7..faa25c6 100644 --- a/grafonnet-7.0/dashboard.libsonnet +++ b/grafonnet-7.0/dashboard.libsonnet @@ -41,6 +41,13 @@ , + addTemplate( + template + ):: self {} + + { templating+: { list+: [ + template, + ] } }, + addAnnotation( builtIn=0, datasource='default', @@ -64,13 +71,6 @@ }, ] } }, - addTemplate( - template - ):: self {} - + { templating+: { list+: [ - template, - ] } }, - panels: [], _nextPanelID:: 2, diff --git a/grafonnet-7.0/grafana.libsonnet b/grafonnet-7.0/grafana.libsonnet index 738a051..28e65d1 100644 --- a/grafonnet-7.0/grafana.libsonnet +++ b/grafonnet-7.0/grafana.libsonnet @@ -14,6 +14,7 @@ prometheus:: import 'target/prometheus.libsonnet', }, template:: { + custom:: import 'template/custom.libsonnet', datasource:: import 'template/datasource.libsonnet', query:: import 'template/query.libsonnet', }, diff --git a/grafonnet-7.0/panel/stat.libsonnet b/grafonnet-7.0/panel/stat.libsonnet index b817f7b..a14c938 100644 --- a/grafonnet-7.0/panel/stat.libsonnet +++ b/grafonnet-7.0/panel/stat.libsonnet @@ -62,31 +62,31 @@ , - addDataLink( + addPanelLink( targetBlank=true, title=null, url=null, ):: self {} - + { fieldConfig+: { defaults+: { links+: [ + + { links+: [ { [if targetBlank != null then 'targetBlank']: targetBlank, [if title != null then 'title']: title, [if url != null then 'url']: url, }, - ] } } }, + ] }, - addPanelLink( + addDataLink( targetBlank=true, title=null, url=null, ):: self {} - + { links+: [ + + { fieldConfig+: { defaults+: { links+: [ { [if targetBlank != null then 'targetBlank']: targetBlank, [if title != null then 'title']: title, [if url != null then 'url']: url, }, - ] }, + ] } } }, addMapping( from=null, diff --git a/grafonnet-7.0/template/custom.libsonnet b/grafonnet-7.0/template/custom.libsonnet new file mode 100644 index 0000000..3755b62 --- /dev/null +++ b/grafonnet-7.0/template/custom.libsonnet @@ -0,0 +1,36 @@ +// This file was generated by https://github.com/grafana/dashboard-spec + +{ + new( + allValue=null, + hide=0, + includeAll=false, + label=null, + multi=false, + name=null, + query=null, + queryValue='', + skipUrlSync=false, + ):: { + [if allValue != null then 'allValue']: allValue, + [if hide != null then 'hide']: hide, + [if includeAll != null then 'includeAll']: includeAll, + [if label != null then 'label']: label, + [if multi != null then 'multi']: multi, + [if name != null then 'name']: name, + [if query != null then 'query']: query, + [if queryValue != null then 'queryValue']: queryValue, + [if skipUrlSync != null then 'skipUrlSync']: skipUrlSync, + type: 'custom', + + setCurrent( + selected=false, + text=null, + value=null, + ):: self {} + + { current+: { [if selected != null then 'selected']: selected } } + + { current+: { [if text != null then 'text']: text } } + + { current+: { [if value != null then 'value']: value } }, + + }, +}