VolkovLabs / business-forms

The Business Forms panel is a conceptually new plugin for Grafana. It is the first plugin that allows inserting and updating application data, as well as modifying configuration directly from your Grafana dashboard.
https://docs.volkovlabs.io
Apache License 2.0
87 stars 10 forks source link

Method changing to OPTIONS even if POST is selected #497

Closed vanimesh closed 1 month ago

vanimesh commented 1 month ago

Hi Team,

The Method changing to OPTIONS even if POST is selected. Below is he json of the configuration { "__inputs": [], "__elements": {}, "__requires": [ { "type": "grafana", "id": "grafana", "name": "Grafana", "version": "9.3.6" }, { "type": "panel", "id": "volkovlabs-form-panel", "name": "Data Manipulation", "version": "3.8.0" } ], "annotations": { "list": [ { "builtIn": 1, "datasource": { "type": "grafana", "uid": "-- Grafana --" }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "target": { "limit": 100, "matchAny": false, "tags": [], "type": "dashboard" }, "type": "dashboard" } ] }, "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, "id": null, "links": [], "liveNow": true, "panels": [ { "datasource": { "type": "datasource", "uid": "grafana" }, "gridPos": { "h": 9, "w": 13, "x": 6, "y": 0 }, "id": 1, "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", "title": "Confirm update request" }, "elementValueChanged": "", "elements": [ { "id": "id", "labelWidth": 10, "section": "", "title": "id", "tooltip": "", "type": "number", "uid": "436d1ba1-ff40-470a-9985-8ec964b3a51b", "unit": "", "value": 0 }, { "id": "ciname", "labelWidth": 10, "options": [ { "id": "DATABASE", "label": "DATABASE", "type": "string", "value": "DATABASE" } ], "optionsSource": "Custom", "section": "", "title": "ciname", "tooltip": "", "type": "select", "uid": "771f78ae-a9a5-4e72-9d55-e788ccdb3be0", "unit": "", "value": "" } ], "initial": { "code": "console.log(data, response, initial, elements);\n\nreturn;\n\n/**\n * Data Source\n * Requires form elements to be defined\n */\nconst dataQuery = toDataQueryResponse(response);\nconsole.log(dataQuery);", "contentType": "application/json", "getPayload": "return {\n rawSql: '',\n format: 'table',\n}", "highlight": false, "highlightColor": "red", "method": "-", "url": "https://zmonitor-tooling.eu.airbus.corp/apis/importcsv.php" }, "layout": { "orientation": "horizontal", "padding": 10, "variant": "single" }, "reset": { "backgroundColor": "purple", "foregroundColor": "yellow", "icon": "process", "text": "Reset", "variant": "hidden" }, "resetAction": { "code": "console.log(data, response, initial, elements);", "confirm": false, "getPayload": "return {\n rawSql: '',\n format: 'table',\n}", "mode": "initial" }, "saveDefault": { "icon": "save", "text": "Save Default", "variant": "hidden" }, "submit": { "backgroundColor": "purple", "foregroundColor": "yellow", "icon": "upload", "text": "Submit", "variant": "primary" }, "sync": true, "update": { "code": "if (response && response.ok) {\n notifySuccess(['Update', 'File uploaded Succesfully for further processing', Request.payload]);\n locationService.reload();\n} else {\n notifyError([\"Error\", 'Error while uploading the file Please Contact DIOM Team']);\n}", "confirm": false, "contentType": "application/json", "getPayload": "const payload = {};\n\nelements.forEach((element) => {\n if (!element.value) {\n return;\n }\n\n payload[element.id] = element.value;\n})\n\nreturn payload;\n", "header": [], "method": "POST", "payloadMode": "all", "url": "https://zmonitor-tooling.eu.airbus.corp/apis/deleteMM.php?user=${__user.login}&email=${__user.email}" }, "updateEnabled": "auto" }, "pluginVersion": "3.8.0", "targets": [ { "datasource": { "type": "datasource", "uid": "grafana" }, "hide": false, "refId": "A" } ], "title": "Upload File", "type": "volkovlabs-form-panel" } ], "refresh": "", "schemaVersion": 37, "style": "dark", "tags": [], "templating": { "list": [] }, "time": { "from": "now-6h", "to": "now" }, "timepicker": { "hidden": false, "refresh_intervals": [ "1m", "5m", "15m", "30m", "1h", "2h", "1d" ] }, "timezone": "", "title": "CSV Copy", "uid": "VeWLpmgHk", "version": 2, "weekStart": "" }

mikhail-vl commented 1 month ago

@vanimesh 'OPTIONS' is required for preflight-check based on the security guidelines performed by the browser. API server should be able to respond to it.

When this check succeed then POST request will be performed.