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
86 stars 10 forks source link

Synchronize with data (dashboard updates) disabled - disables the use of dashboard variables #391

Closed markomedin closed 7 months ago

markomedin commented 7 months ago

Hi volkovlabs,

First thank you for the amazing work. Love the improvements with every new release. With the option now of disabling "Synchronize with data" we can have our other panels refresh on a set frequency without affecting the data manipulation panel.

The only issue I now see is that the change of value of the dashboard variables does not apply on the data manipulation panel , and if we use them in the code of the data manipulation panel for configuration, they don't take effect.

Can this be somehow changed so we can still use dashboard variables.

A running example to replicate the issue would be a dashboard variable with a dropdown select options and having a read-only field in the data manipulation panel to display it. Using this in an initial request elements[0].value = '$dashboard_variable' Disabling/enabling the "Synchronize with data" the option stops/starts the synchronisation between the two.

Thank you in advance. :)

asimonok commented 7 months ago

@markomedin thanks for the submitting the issue. The only way to use variables in data manipulation is to enable synchonize.

Clearing form values have been fixed in https://github.com/VolkovLabs/volkovlabs-form-panel/pull/356 so if you don't have initial values for the fields then the enabled syncronization should be working for you in the latest version.

Please let us know if there is anything else

markomedin commented 7 months ago

Ok, thank you. Since we cant use synchrinization enabled for our use case is it then possible to use a form element value for a query for another element of the same form. For example my form has a string input element and a dropdown select element. The dropdown select element is populated via a query, but the query would have to have the value of the string input element to filter out the query result. So in practice you would enter a text and you would select an available option based on your text input. Within the same form. Is this possible to do and if you can provide an example. Thank you.

asimonok commented 7 months ago

@markomedin you should keep current text input within the variable (a text box variable) and filter available options by that in the panel query. It's a very similar what described here - https://volkovlabs.io/blog/form-panel-use-variables-20240301/

Instead of dropdown and a query variable, text box variable should be used for your use case. Then you can pass the current input to initial values query (with static datasource) and then sync option will work and entered input value will be kept