I am running grafana locally in a docker container, using the official image grafana/grafana:8.4.1. My host machine is a Ubuntu 21.10. I also have a postgres (13) database in another container to store the grafana data.
I have build a custom datasource and custom plugin to interact with an API that I have developed. Everything is working well, I am able to create and save my dashboards. I am able to see them in the database, in the “dashboard” table. I am also able to correctly edit my dashboards using my plugin. However, when I want to change the time range using the Grafana’s time range picker, it does change but it is not saved in the database.
Is it the intended behavior ? I saw in the docs the following “Time settings are saved on a per-dashboard basis.” which I think means it should indeed be saved.
Is it something configurable ? Or is there a fairly easy way to customize the action behind the dashboard “save” button?
I had the same problem, the dashboard came up with time selection “last six hours”.
I changed the timepicker to ‘today’ and saved the dashboard, however, the next time I open the dashboard, the time selection was back to “last six hours”.
Finaly found a way to change the setting permanently (saved in database):
click on “dashboard settings” (wheel on the left side of the time picker)
click on “JSON Model”
near the end (scroll down), there is a key “time”, subkeys “from” and “to”.
change the setting to the desired one (I wanted today, so I changed the text to “now/d” (both from and to))
Make sure you enter a legal value, or the dashboard will become unusable!!.
TIP: before you do this, stop grafana-server, make a copy of the database, start grafana-server, make your changes. You can than always restore the original database if something goes wrong…
edit
you may need to refresh the browser and / or clear the cache
/edit