This repository has been archived by the owner on Feb 11, 2024. It is now read-only.
generated from WalletConnect/rust-http-starter
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Xavier Basty
authored
Apr 4, 2023
1 parent
0cef941
commit 4a63f3a
Showing
7 changed files
with
344 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
local ThresholdMode = { | ||
Absolute: 'absolute', | ||
Percentage: 'percentage', | ||
}; | ||
local FieldColorModeId = { | ||
ContinuousGrYlRd: 'continuous-GrYlRd', | ||
Fixed: 'fixed', | ||
PaletteClassic: 'palette-classic', | ||
PaletteSaturated: 'palette-saturated', | ||
Thresholds: 'thresholds', | ||
}; | ||
local FieldColorSeriesByMode = { | ||
Min: 'min', | ||
Max: 'max', | ||
Last: 'last', | ||
}; | ||
|
||
{ | ||
/** | ||
* Creates a default field config. | ||
* | ||
* @name field_config.default | ||
* | ||
* @param color (optional) Map values to a display color. | ||
* @param custom (optional) ????. | ||
* @param decimals (optional) Significant digits (for display). | ||
* @param description (optional) Human readable field metadata. | ||
* @param displayName (optional) The display value for this field. This supports template variables blank is auto. | ||
* @param displayNameFromDS (optional) This can be used by data sources that return and explicit naming structure for values and labels. | ||
* @param filterable (optional) True if data source field supports ad-hoc filters. | ||
* @param min (optional) | ||
* @param max (optional) | ||
* @param noValue (optional) Alternative to empty string. | ||
* @param path (optional) An explicit path to the field in the datasource. | ||
* @param unit (optional) Numeric Options. | ||
* @param writeable (optional) True if data source can write a value to the path. | ||
* | ||
* @method addThreshold(step) Adds a [threshold](https://grafana.com/docs/grafana/latest/panels/thresholds/) step. Argument format: `{ color: 'green', value: 0 }`. | ||
* @method addThresholds(steps) Adds an array of threshold steps. | ||
* @method addMapping(mapping) Adds a value mapping. | ||
* @method addMappings(mappings) Adds an array of value mappings. | ||
*/ | ||
default( | ||
color=null, | ||
custom={}, | ||
decimals=null, | ||
description=null, | ||
displayName=null, | ||
displayNameFromDS=null, | ||
filterable=null, | ||
min=null, | ||
max=null, | ||
noValue=null, | ||
path=null, | ||
unit=null, | ||
thresholds=null, | ||
writeable=null, | ||
):: { | ||
color: if color != null then color else { | ||
mode: FieldColorModeId.PaletteClassic | ||
}, | ||
custom: custom, | ||
[if decimals != null then 'decimals']: decimals, | ||
[if description != null then 'description']: description, | ||
[if displayName != null then 'displayName']: displayName, | ||
[if displayNameFromDS != null then 'displayNameFromDS']: displayNameFromDS, | ||
[if filterable != null then 'filterable']: filterable, | ||
[if min != null then 'min']: min, | ||
[if max != null then 'max']: max, | ||
[if noValue != null then 'noValue']: noValue, | ||
[if path != null then 'path']: path, | ||
[if unit != null then 'unit']: unit, | ||
[if writeable != null then 'writeable']: writeable, | ||
|
||
thresholds: if thresholds != null then thresholds else { | ||
mode: ThresholdMode.Absolute, | ||
steps: [ | ||
{ | ||
color: "green", | ||
value: null | ||
} | ||
] | ||
}, | ||
} + | ||
|
||
{ | ||
// Thresholds | ||
addThreshold(step):: self { | ||
thresholds+: { | ||
steps+: [step], | ||
} | ||
}, | ||
addThresholds(steps):: std.foldl(function(p, s) p.addThreshold(s), steps, self), | ||
} + | ||
|
||
{ | ||
// Mappings | ||
mappings: [], | ||
addMapping(mapping):: self { | ||
mappings+: [mapping], | ||
}, | ||
addMappings(mappings):: std.foldl(function(p, m) p.addMapping(m), mappings, self), | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,35 @@ | ||
{ | ||
alertCondition:: import 'alert_condition.libsonnet', | ||
alertlist:: import 'alertlist.libsonnet', | ||
dashboard:: import 'dashboard.libsonnet', | ||
template:: import 'template.libsonnet', | ||
text:: import 'text.libsonnet', | ||
timepicker:: import 'timepicker.libsonnet', | ||
row:: import 'row.libsonnet', | ||
link:: import 'link.libsonnet', | ||
annotation:: import 'annotation.libsonnet', | ||
graphPanel:: import 'graph_panel.libsonnet', | ||
logPanel:: import 'log_panel.libsonnet', | ||
tablePanel:: import 'table_panel.libsonnet', | ||
singlestat:: import 'singlestat.libsonnet', | ||
pieChartPanel:: import 'pie_chart_panel.libsonnet', | ||
influxdb:: import 'influxdb.libsonnet', | ||
prometheus:: import 'prometheus.libsonnet', | ||
loki:: import 'loki.libsonnet', | ||
sql:: import 'sql.libsonnet', | ||
graphite:: import 'graphite.libsonnet', | ||
alertCondition:: import 'alert_condition.libsonnet', | ||
barGaugePanel:: import 'bar_gauge_panel.libsonnet', | ||
cloudmonitoring:: import 'cloudmonitoring.libsonnet', | ||
cloudwatch:: import 'cloudwatch.libsonnet', | ||
elasticsearch:: import 'elasticsearch.libsonnet', | ||
heatmapPanel:: import 'heatmap_panel.libsonnet', | ||
dashboard:: import 'dashboard.libsonnet', | ||
dashlist:: import 'dashlist.libsonnet', | ||
pluginlist:: import 'pluginlist.libsonnet', | ||
elasticsearch:: import 'elasticsearch.libsonnet', | ||
fieldConfig:: import 'field_config.libsonnet', | ||
gauge:: error 'gauge is removed, migrate to gaugePanel', | ||
gaugePanel:: import 'gauge_panel.libsonnet', | ||
barGaugePanel:: import 'bar_gauge_panel.libsonnet', | ||
graphPanel:: import 'graph_panel.libsonnet', | ||
graphite:: import 'graphite.libsonnet', | ||
heatmapPanel:: import 'heatmap_panel.libsonnet', | ||
influxdb:: import 'influxdb.libsonnet', | ||
legend:: import 'legend.libsonnet', | ||
link:: import 'link.libsonnet', | ||
logPanel:: import 'log_panel.libsonnet', | ||
loki:: import 'loki.libsonnet', | ||
pieChartPanel:: import 'pie_chart_panel.libsonnet', | ||
pluginlist:: import 'pluginlist.libsonnet', | ||
prometheus:: import 'prometheus.libsonnet', | ||
row:: import 'row.libsonnet', | ||
singlestat:: import 'singlestat.libsonnet', | ||
sql:: import 'sql.libsonnet', | ||
statPanel:: import 'stat_panel.libsonnet', | ||
tablePanel:: import 'table_panel.libsonnet', | ||
template:: import 'template.libsonnet', | ||
text:: import 'text.libsonnet', | ||
timepicker:: import 'timepicker.libsonnet', | ||
timeseriesPanel:: import 'timeseries_panel.libsonnet', | ||
transformation:: import 'transformation.libsonnet', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
/** | ||
* Dashboard panel. | ||
* | ||
* @name timeseries_panel.new | ||
* | ||
* @param title The title of the singlestat panel. | ||
* @method addTarget(target) Adds a target object. | ||
* @method addTargets(targets) Adds an array of targets. | ||
* @method addLink(link) Adds a [panel link](https://grafana.com/docs/grafana/latest/linking/panel-links/). | ||
* @method addLinks(links) Adds an array of links. | ||
*/ | ||
new( | ||
title, | ||
description=null, | ||
datasource=null, | ||
fieldConfig=null, | ||
interval=null, | ||
libraryPanel=null, | ||
maxDataPoints=null, | ||
pluginVersion='8.4.7', | ||
repeat=null, | ||
repeatDirection=null, | ||
repeatPanelId=null, | ||
tags=null, | ||
timeFrom=null, | ||
timeRegions=null, | ||
timeShift=null, | ||
transformations=null, | ||
transparent=null, | ||
):: | ||
self + { | ||
title: title, | ||
[if description != '' then 'description']: description, | ||
[if datasource != null then 'datasource']: datasource, | ||
[if fieldConfig != null then 'fieldConfig']: fieldConfig, | ||
[if interval != null then 'interval']: interval, | ||
[if libraryPanel != null then 'libraryPanel']: libraryPanel, | ||
[if maxDataPoints != null then 'maxDataPoints']: maxDataPoints, | ||
options: {}, | ||
pluginVersion: pluginVersion, | ||
[if repeat != null then 'repeat']: repeat, | ||
[if repeatDirection != null then 'repeatDirection']: repeatDirection, | ||
[if repeatPanelId != null then 'repeatPanelId']: repeatPanelId, | ||
[if tags != null then 'tags']: tags, | ||
[if timeFrom != null then 'timeFrom']: timeFrom, | ||
[if timeRegions != null then 'timeRegions']: timeRegions, | ||
[if timeShift != null then 'timeShift']: timeShift, | ||
[if transparent != null then 'transparent']: transparent, | ||
} + | ||
|
||
{ | ||
// Targets | ||
targets: [], | ||
_nextTarget:: 0, | ||
addTarget(target):: self { | ||
local nextTarget = super._nextTarget, | ||
_nextTarget: nextTarget + 1, | ||
targets+: [target { refId: std.char(std.codepoint('A') + nextTarget) }], | ||
}, | ||
addTargets(targets):: std.foldl(function(p, t) p.addTarget(t), targets, self), | ||
} + | ||
|
||
{ | ||
// Links | ||
links: [], | ||
addLink(link):: self { | ||
links+: [link], | ||
}, | ||
addLinks(links):: std.foldl(function(p, l) p.addLink(l), links, self), | ||
}, | ||
} |
Oops, something went wrong.