Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Multiple initial fields support #508

Merged
merged 9 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 169 additions & 17 deletions provisioning/dashboards/datasource.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,165 @@
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"default": true,
"type": "marcusolsson-static-datasource",
"uid": "P1D2C73DC01F2359B"
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 0
},
"id": 4,
"options": {
"buttonGroup": {
"orientation": "center",
"size": "md"
},
"confirmModal": {
"body": "Please confirm to update changed values",
"cancel": "Cancel",
"columns": {
"include": ["name", "oldValue", "newValue"],
"name": "Label",
"newValue": "New Value",
"oldValue": "Old Value"
},
"confirm": "Confirm",
"elementDisplayMode": "modified",
"title": "Confirm update request"
},
"elementValueChanged": "",
"elements": [
{
"hidden": false,
"id": "String",
"labelWidth": 10,
"queryField": {
"label": "undefined:val-1 category",
"value": "category"
},
"section": "",
"title": "String",
"tooltip": "",
"type": "string",
"uid": "0a15f927-e435-4678-8341-10f0e5caa3fb",
"unit": "",
"value": ""
}
],
"initial": {
"code": "",
"contentType": "application/json",
"getPayload": "return {}",
"highlight": false,
"highlightColor": "red",
"method": "query",
"payload": {}
},
"layout": {
"orientation": "horizontal",
"padding": 10,
"sectionVariant": "default",
"variant": "single"
},
"reset": {
"backgroundColor": "purple",
"foregroundColor": "yellow",
"icon": "process",
"text": "Reset",
"variant": "hidden"
},
"resetAction": {
"code": "if (context.panel.response) {\n context.grafana.notifySuccess(['Update', 'Values updated successfully.']);\n context.grafana.locationService.reload();\n} else {\n context.grafana.notifyError(['Update', 'An error occurred updating values.']);\n}",
"confirm": false,
"getPayload": "return {}",
"mode": "initial",
"payload": {}
},
"saveDefault": {
"icon": "save",
"text": "Save Default",
"variant": "hidden"
},
"submit": {
"backgroundColor": "purple",
"foregroundColor": "yellow",
"icon": "cloud-upload",
"text": "Submit",
"variant": "primary"
},
"sync": true,
"update": {
"code": "",
"confirm": false,
"contentType": "application/json",
"getPayload": "const payload = {};\n\ncontext.panel.elements.forEach((element) => {\n if (!element.value) {\n return;\n }\n\n payload[element.id] = element.value;\n})\n\nreturn payload;",
"method": "-",
"payload": "const payload = {};\n\ncontext.panel.elements.forEach((element) => {\n if (!element.value) {\n return;\n }\n\n payload[element.id] = element.value;\n})\n\nreturn payload;",
"payloadMode": "all"
},
"updateEnabled": "auto"
},
"pluginVersion": "4.6.0",
"targets": [
{
"datasource": {
"type": "marcusolsson-static-datasource",
"uid": "P1D2C73DC01F2359B"
},
"frame": {
"fields": [
{
"config": {},
"name": "value",
"type": "string",
"values": ["val-1", "val-2", "val-3"]
},
{
"config": {},
"name": "category",
"type": "string",
"values": ["cat-1", "cat-2", "cat-3"]
}
],
"meta": {},
"name": "A"
},
"refId": "A"
}
],
"title": "Transform data - for Query Fields",
"transformations": [
{
"id": "partitionByValues",
"options": {
"fields": ["value"],
"keepFields": true,
"naming": {
"asLabels": false
}
}
}
],
"type": "volkovlabs-form-panel"
},
{
"datasource": {
"type": "marcusolsson-static-datasource",
"uid": "P1D2C73DC01F2359B"
},
"fieldConfig": {
"defaults": {
"custom": {
"thresholdsStyle": {
"mode": "color",
"thresholds": []
}
},
"thresholds": {
"mode": "absolute",
"steps": [
Expand All @@ -48,7 +200,7 @@
"h": 35,
"w": 4,
"x": 0,
"y": 0
"y": 8
},
"id": 1,
"options": {
Expand All @@ -58,7 +210,14 @@
"customValue": false,
"displayMode": "table",
"emptyValue": false,
"favorites": true,
"favorites": {
"addQuery": {},
"datasource": "",
"deleteQuery": {},
"enabled": true,
"getQuery": {},
"storage": "browser"
},
"filter": true,
"groupSelection": false,
"header": true,
Expand All @@ -73,9 +232,10 @@
"showTotal": false,
"statusSort": false,
"sticky": true,
"tabsInOrder": true,
"variable": "device"
},
"pluginVersion": "3.1.0",
"pluginVersion": "3.4.0",
"type": "volkovlabs-variable-panel"
},
{
Expand All @@ -87,7 +247,7 @@
"h": 9,
"w": 20,
"x": 4,
"y": 0
"y": 8
},
"id": 2,
"options": {
Expand All @@ -99,11 +259,7 @@
"body": "Please confirm to update changed values",
"cancel": "Cancel",
"columns": {
"include": [
"name",
"oldValue",
"newValue"
],
"include": ["name", "oldValue", "newValue"],
"name": "Label",
"newValue": "New Value",
"oldValue": "Old Value"
Expand Down Expand Up @@ -339,7 +495,7 @@
},
"updateEnabled": "auto"
},
"pluginVersion": "4.1.0",
"pluginVersion": "4.6.0",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -382,7 +538,7 @@
"h": 9,
"w": 20,
"x": 4,
"y": 9
"y": 17
},
"id": 3,
"options": {
Expand All @@ -394,11 +550,7 @@
"body": "Please confirm to update changed values",
"cancel": "Cancel",
"columns": {
"include": [
"name",
"oldValue",
"newValue"
],
"include": ["name", "oldValue", "newValue"],
"name": "Label",
"newValue": "New Value",
"oldValue": "Old Value"
Expand Down Expand Up @@ -611,7 +763,7 @@
},
"updateEnabled": "auto"
},
"pluginVersion": "4.1.0",
"pluginVersion": "4.6.0",
"targets": [
{
"datasource": {
Expand Down
Loading
Loading