VolkovLabs / business-forms

Insert, update application data, and modify configuration for @grafana
https://docs.volkovlabs.io
Apache License 2.0
85 stars 11 forks source link

Changes to custom code fields will not save unless other fields have changed. #111

Closed westonforbes closed 1 year ago

westonforbes commented 1 year ago

Hello, First off, I love this plugin, thank you for making it, but I did find a issue that is proving to be quite annoying.

I am trying to make changes to some of my custom code under the Initial request field. image However, when I click apply, the changes will not retain. The only way I can get them to retain is if I make some changes to other options, then sometimes it retains. I've tried to find a field I can change that will reliably cause it to update but I've yet to find a reliable pattern.

Grafana build V9.1.6

Thanks for the great plugin.

westonforbes commented 1 year ago

I take it back...Now none of my changes are retaining with the plugin. Something with the whole plugin is bugging out. Hmmm...

rantinray commented 1 year ago

@westonforbes I had the same problem. I found that the only way to save the custom code was to hit the "save" dashboard button from within the edit panel. Then I had to "reload" the page to make sure it was available to test. I am not sure this is what was expected, but it is what I had to do. Hope this helps.

westonforbes commented 1 year ago

@rantinray Thanks for the input. That worked...This time. I found some other ways, like toggling a feature, that would work for a bit then stop working. So I'm not 100% convinced that'll work every time but thanks!

For the developer: It seems to be something bugged out inside the panel, I created another panel with the similar settings and its not doing it...mystery. Here is the JSON Model for the buggy panel....

Actually, trying to copy the JSON model to this thread with markdown may have revealed the problem...Could the backtick in my code next to "Reported Value" be causing it to prematurely escape and causing the glitch out? I dunno, I need to move with things...but maybe.

{ "id": 2, "gridPos": { "h": 15, "w": 6, "x": 0, "y": 8 }, "type": "volkovlabs-form-panel", "title": "Panel Title", "datasource": { "uid": "Xw5iJRH4z", "type": "mssql" }, "options": { "initial": { "method": "-", "contentType": "application/json", "code": "elements.map((element) => {\r\n if (element.id === 'DATE') {\r\n alert(Reported Value: ${element.value});\r\n }\r\n});\r\nonOptionsChange(options);", "highlight": false, "highlightColor": "red" }, "update": { "method": "POST", "contentType": "application/json", "code": "", "confirm": false, "url": "http://10.5.51.100:3001" }, "layout": { "variant": "single" }, "buttonGroup": { "orientation": "center", "size": "md" }, "submit": { "variant": "primary", "foregroundColor": "yellow", "backgroundColor": "purple", "icon": "cloud-upload", "text": "Submit" }, "reset": { "variant": "hidden", "foregroundColor": "yellow", "backgroundColor": "purple", "icon": "process", "text": "Reset" }, "elements": [ { "id": "DATE", "labelWidth": 10, "section": "", "title": "For Date", "tooltip": "", "type": "datetime", "value": "2022-11-15T17:14:21.000Z" }, { "id": "AV_01", "labelWidth": 10, "section": "", "title": "AV-01", "tooltip": "", "type": "number", "value": "10" }, { "id": "AV_02", "labelWidth": 10, "section": "", "title": "AV-02", "tooltip": "", "type": "number", "value": "9" }, { "id": "AV_03", "labelWidth": 10, "section": "", "title": "AV-03", "tooltip": "", "type": "number", "value": "8" }, { "id": "BOWL_01", "labelWidth": 10, "min": 0, "section": "", "title": "BOWL-01", "tooltip": "", "type": "number", "value": "" }, { "id": "BOWL_02", "labelWidth": 10, "section": "", "title": "BOWL-02", "tooltip": "", "type": "number", "value": "6" }, { "id": "BOWL_03", "labelWidth": 10, "section": "", "title": "BOWL-03", "tooltip": "", "type": "number", "value": "" }, { "id": "BOWL_04", "labelWidth": 10, "section": "", "title": "BOWL-04", "tooltip": "", "type": "number", "value": "" }, { "id": "BOWL_05", "labelWidth": 10, "section": "", "title": "BOWL-05", "tooltip": "", "type": "number", "value": "3" }, { "id": "BOWL_06", "labelWidth": 10, "section": "", "title": "BOWL_06", "tooltip": "", "type": "number", "value": "2" } ] } }

mikhail-vl commented 1 year ago

@westonforbes Thank you for reporting the issue. It may be related to the custom code and how it's saved in the Dashboard's JSON file.

We are working on updating the panel this week and I will look into it.

mikhail-vl commented 1 year ago

@westonforbes I experienced the same issue on 9.2.2, which was not the case before 9.1.0...

I am releasing a new version with some required features, which I can't delay to fix this issue. I have some ideas about why it's happening and will look into it.