Commit bf1518f1 authored by Kirstie Cook's avatar Kirstie Cook Committed by Bob Van Landuyt

Add schema for dashboard custom templating variable

Update sample dashboard fixtures
parent 6b415223
...@@ -13,6 +13,17 @@ templating: ...@@ -13,6 +13,17 @@ templating:
options: options:
default_value: 'default' default_value: 'default'
text_variable_simple_syntax: 'default value' text_variable_simple_syntax: 'default value'
custom_variable_simple_syntax: ['value1', 'value2', 'value3']
custom_variable_full_syntax:
label: 'Variable 2'
type: custom
options:
values:
- value: 'value option 1'
text: 'Option 1'
- value: 'value_option_2'
text: 'Option 2'
default: true
panel_groups: panel_groups:
- group: Group A - group: Group A
priority: 1 priority: 1
......
{
"type": "object",
"required": [
"type", "options"
],
"properties": {
"type": { "enum": ["custom"] },
"label": { "type": "string" },
"options": { "$ref": "custom_variable_options.json" }
},
"additionalProperties": false
}
{
"type": "object",
"required": ["values"],
"properties": {
"values": {
"type": "array",
"items": { "$ref": "custom_variable_values.json" }
}
},
"additionalProperties": false
}
{
"type": "object",
"required": ["value"],
"properties": {
"value": { "type": "string" },
"text": { "type": "string" },
"default": { "type": "boolean" }
},
"additionalProperties": false
}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type", "options" "type", "options"
], ],
"properties": { "properties": {
"type": { "type": "string" }, "type": { "enum": ["text"] },
"label": { "type": "string" }, "label": { "type": "string" },
"options": { "$ref": "text_variable_options.json" } "options": { "$ref": "text_variable_options.json" }
}, },
......
...@@ -4,7 +4,12 @@ ...@@ -4,7 +4,12 @@
"^[a-zA-Z0-9_]*$": { "^[a-zA-Z0-9_]*$": {
"anyOf": [ "anyOf": [
{ "$ref": "text_variable_full_syntax.json" }, { "$ref": "text_variable_full_syntax.json" },
{ "type": "string" } { "type": "string" },
{
"type": "array",
"items": { "type": "string" }
},
{ "$ref": "custom_variable_full_syntax.json" }
] ]
} }
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment