Serge Bazanski | 7d311e9 | 2020-10-10 17:57:44 +0200 | [diff] [blame] | 1 | // This file was generated by https://github.com/grafana/dashboard-spec |
| 2 | |
| 3 | { |
| 4 | new( |
| 5 | datasource='default', |
| 6 | description=null, |
| 7 | repeat=null, |
| 8 | repeatDirection=null, |
| 9 | title=null, |
| 10 | transparent=false, |
| 11 | ):: { |
| 12 | [if datasource != null then 'datasource']: datasource, |
| 13 | [if description != null then 'description']: description, |
| 14 | [if repeat != null then 'repeat']: repeat, |
| 15 | [if repeatDirection != null then 'repeatDirection']: repeatDirection, |
| 16 | [if title != null then 'title']: title, |
| 17 | [if transparent != null then 'transparent']: transparent, |
| 18 | type: 'stat', |
| 19 | |
| 20 | setFieldConfig( |
| 21 | max=null, |
| 22 | min=null, |
| 23 | thresholdMode='absolute', |
| 24 | unit=null, |
| 25 | ):: self {} |
| 26 | + { fieldConfig+: { defaults+: { [if max != null then 'max']: max } } } |
| 27 | + { fieldConfig+: { defaults+: { [if min != null then 'min']: min } } } |
| 28 | + { fieldConfig+: { defaults+: { thresholds+: { [if thresholdMode != null then 'mode']: thresholdMode } } } } |
| 29 | + { fieldConfig+: { defaults+: { [if unit != null then 'unit']: unit } } } |
| 30 | , |
| 31 | |
| 32 | setGridPos( |
| 33 | h=8, |
| 34 | w=12, |
| 35 | x=null, |
| 36 | y=null, |
| 37 | ):: self {} |
| 38 | + { gridPos+: { [if h != null then 'h']: h } } |
| 39 | + { gridPos+: { [if w != null then 'w']: w } } |
| 40 | + { gridPos+: { [if x != null then 'x']: x } } |
| 41 | + { gridPos+: { [if y != null then 'y']: y } } |
| 42 | , |
| 43 | |
| 44 | setOptions( |
| 45 | calcs=['mean'], |
| 46 | colorMode='value', |
| 47 | fields=null, |
| 48 | graphMode='none', |
| 49 | justifyMode='auto', |
| 50 | orientation='auto', |
| 51 | textMode='auto', |
| 52 | values=false, |
| 53 | ):: self {} |
| 54 | + { options+: { reduceOptions+: { [if calcs != null then 'calcs']: calcs } } } |
| 55 | + { options+: { [if colorMode != null then 'colorMode']: colorMode } } |
| 56 | + { options+: { reduceOptions+: { [if fields != null then 'fields']: fields } } } |
| 57 | + { options+: { [if graphMode != null then 'graphMode']: graphMode } } |
| 58 | + { options+: { [if justifyMode != null then 'justifyMode']: justifyMode } } |
| 59 | + { options+: { [if orientation != null then 'orientation']: orientation } } |
| 60 | + { options+: { [if textMode != null then 'textMode']: textMode } } |
| 61 | + { options+: { reduceOptions+: { [if values != null then 'values']: values } } } |
| 62 | , |
| 63 | |
| 64 | |
| 65 | addPanelLink( |
| 66 | targetBlank=true, |
| 67 | title=null, |
| 68 | url=null, |
| 69 | ):: self {} |
| 70 | + { links+: [ |
| 71 | { |
| 72 | [if targetBlank != null then 'targetBlank']: targetBlank, |
| 73 | [if title != null then 'title']: title, |
| 74 | [if url != null then 'url']: url, |
| 75 | }, |
| 76 | ] }, |
| 77 | |
| 78 | addDataLink( |
| 79 | targetBlank=true, |
| 80 | title=null, |
| 81 | url=null, |
| 82 | ):: self {} |
| 83 | + { fieldConfig+: { defaults+: { links+: [ |
| 84 | { |
| 85 | [if targetBlank != null then 'targetBlank']: targetBlank, |
| 86 | [if title != null then 'title']: title, |
| 87 | [if url != null then 'url']: url, |
| 88 | }, |
| 89 | ] } } }, |
| 90 | |
| 91 | addMapping( |
| 92 | from=null, |
| 93 | id=null, |
| 94 | operator=null, |
| 95 | text=null, |
| 96 | to=null, |
| 97 | type=null, |
| 98 | value=null, |
| 99 | ):: self {} |
| 100 | + { fieldConfig+: { defaults+: { mappings+: [ |
| 101 | { |
| 102 | [if from != null then 'from']: from, |
| 103 | [if id != null then 'id']: id, |
| 104 | [if operator != null then 'operator']: operator, |
| 105 | [if text != null then 'text']: text, |
| 106 | [if to != null then 'to']: to, |
| 107 | [if type != null then 'type']: type, |
| 108 | [if value != null then 'value']: value, |
| 109 | }, |
| 110 | ] } } }, |
| 111 | |
| 112 | addOverride( |
| 113 | matcher=null, |
| 114 | properties=null, |
| 115 | ):: self {} |
| 116 | + { fieldConfig+: { overrides+: [ |
| 117 | { |
| 118 | [if matcher != null then 'matcher']: matcher, |
| 119 | [if properties != null then 'properties']: properties, |
| 120 | }, |
| 121 | ] } }, |
| 122 | |
| 123 | addThresholdStep( |
| 124 | color=null, |
| 125 | value=null, |
| 126 | ):: self {} |
| 127 | + { fieldConfig+: { defaults+: { thresholds+: { steps+: [ |
| 128 | { |
| 129 | [if color != null then 'color']: color, |
| 130 | [if value != null then 'value']: value, |
| 131 | }, |
| 132 | ] } } } }, |
| 133 | |
| 134 | addTarget( |
| 135 | target |
| 136 | ):: self {} |
| 137 | + { targets+: [ |
| 138 | target, |
| 139 | ] }, |
| 140 | |
| 141 | }, |
| 142 | } |