blob: 28dc13ae3790a1aa12166b0bf1380b6adb891849 [file] [log] [blame]
// This file was generated by https://github.com/grafana/dashboard-spec
{
new(
description=null,
editable=true,
graphTooltip=0,
refresh=null,
schemaVersion=25,
style='dark',
tags=[],
timezone=null,
title=null,
uid=null,
):: {
[if description != null then 'description']: description,
[if editable != null then 'editable']: editable,
[if graphTooltip != null then 'graphTooltip']: graphTooltip,
[if refresh != null then 'refresh']: refresh,
[if schemaVersion != null then 'schemaVersion']: schemaVersion,
[if style != null then 'style']: style,
[if tags != null then 'tags']: tags,
[if timezone != null then 'timezone']: timezone,
[if title != null then 'title']: title,
[if uid != null then 'uid']: uid,
setTime(
from='now-6h',
to='now',
):: self {}
+ { time+: { [if from != null then 'from']: from } }
+ { time+: { [if to != null then 'to']: to } }
,
setTimepicker(
refreshIntervals=['5s', '10s', '30s', '1m', '5m', '15m', '30m', '1h', '2h', '1d'],
):: self {}
+ { timepicker+: { [if refreshIntervals != null then 'refresh_intervals']: refreshIntervals } }
,
addTemplate(
template
):: self {}
+ { templating+: { list+: [
template,
] } },
addAnnotation(
builtIn=0,
datasource='default',
enable=true,
hide=false,
iconColor=null,
name=null,
rawQuery=null,
showIn=0,
):: self {}
+ { annotations+: { list+: [
{
[if builtIn != null then 'builtIn']: builtIn,
[if datasource != null then 'datasource']: datasource,
[if enable != null then 'enable']: enable,
[if hide != null then 'hide']: hide,
[if iconColor != null then 'iconColor']: iconColor,
[if name != null then 'name']: name,
[if rawQuery != null then 'rawQuery']: rawQuery,
[if showIn != null then 'showIn']: showIn,
},
] } },
panels: [],
_nextPanelID:: 2,
addPanel(panel):: self {
local nextPanelID = super._nextPanelID,
panels+: [
panel { id: nextPanelID } +
if 'panels' in panel then { panels: std.mapWithIndex(function(i, p) p { id: nextPanelID + i + 1 }, panel.panels) } else {},
],
_nextPanelID:: nextPanelID + 1 + (if 'panels' in panel then std.length(panel.panels) else 0),
},
addPanels(panels):: std.foldl(function(d, p) d.addPanel(p), panels, self),
},
}