blob: 28dc13ae3790a1aa12166b0bf1380b6adb891849 [file] [log] [blame]
Serge Bazanski7d311e92020-10-10 17:57:44 +02001// This file was generated by https://github.com/grafana/dashboard-spec
2
3{
4 new(
5 description=null,
6 editable=true,
7 graphTooltip=0,
8 refresh=null,
9 schemaVersion=25,
10 style='dark',
11 tags=[],
12 timezone=null,
13 title=null,
14 uid=null,
15 ):: {
16 [if description != null then 'description']: description,
17 [if editable != null then 'editable']: editable,
18 [if graphTooltip != null then 'graphTooltip']: graphTooltip,
19 [if refresh != null then 'refresh']: refresh,
20 [if schemaVersion != null then 'schemaVersion']: schemaVersion,
21 [if style != null then 'style']: style,
22 [if tags != null then 'tags']: tags,
23 [if timezone != null then 'timezone']: timezone,
24 [if title != null then 'title']: title,
25 [if uid != null then 'uid']: uid,
26
27 setTime(
28 from='now-6h',
29 to='now',
30 ):: self {}
31 + { time+: { [if from != null then 'from']: from } }
32 + { time+: { [if to != null then 'to']: to } }
33 ,
34
35 setTimepicker(
36 refreshIntervals=['5s', '10s', '30s', '1m', '5m', '15m', '30m', '1h', '2h', '1d'],
37 ):: self {}
38 + { timepicker+: { [if refreshIntervals != null then 'refresh_intervals']: refreshIntervals } }
39 ,
40
41
42 addTemplate(
43 template
44 ):: self {}
45 + { templating+: { list+: [
46 template,
47 ] } },
48
49 addAnnotation(
50 builtIn=0,
51 datasource='default',
52 enable=true,
53 hide=false,
54 iconColor=null,
55 name=null,
56 rawQuery=null,
57 showIn=0,
58 ):: self {}
59 + { annotations+: { list+: [
60 {
61 [if builtIn != null then 'builtIn']: builtIn,
62 [if datasource != null then 'datasource']: datasource,
63 [if enable != null then 'enable']: enable,
64 [if hide != null then 'hide']: hide,
65 [if iconColor != null then 'iconColor']: iconColor,
66 [if name != null then 'name']: name,
67 [if rawQuery != null then 'rawQuery']: rawQuery,
68 [if showIn != null then 'showIn']: showIn,
69 },
70 ] } },
71
72
73 panels: [],
74 _nextPanelID:: 2,
75 addPanel(panel):: self {
76 local nextPanelID = super._nextPanelID,
77 panels+: [
78 panel { id: nextPanelID } +
79 if 'panels' in panel then { panels: std.mapWithIndex(function(i, p) p { id: nextPanelID + i + 1 }, panel.panels) } else {},
80 ],
81 _nextPanelID:: nextPanelID + 1 + (if 'panels' in panel then std.length(panel.panels) else 0),
82 },
83 addPanels(panels):: std.foldl(function(d, p) d.addPanel(p), panels, self),
84 },
85}