Grafana username/password are collected from the user instead of API key. These credentials are used to generate the correct API key with admin permissions.
Previously, the user had to follow instructions to generate an API token with the correct permissions (admin).
Bug fix: Only display Configure Dashboard panels for Grafana dashboards which correspond to an Event in the database.
If the user creates a new dashboard on grafana with a new name not related to any event, this should be invisible to the mercury UI.
Previously, mercury would display all dashboards, even though some of them don't actually correspond to events. The user could then add sensor panels to that dashboard, but there is no way for data to get there, so this won't b useful to the user.
Now, only event dashboards will be shown.
Issue #535: Add GPS panel query/support to Grafana integration
Update the Grafana class to support creating 3 panel types: regular graph (type that was made previously), map (using the TrackMap plugin), and gauge.
Update Grafana.create_panel_query to create a special type of query if panel_type=="map". The TrackMap plugin requires specific field names, while graph and gauge types can be built using the previous approach.
Update Grafana.update_panel_sensor to update the graph type when the sensor is updated.
Update sensor.html, sensor.py, and sensor.js to support choosing graph type:
Issue #571: Documentation for Configure Grafana page
Change Configure Grafana page to have 3 views: Existing Grafana Hosts, Add Grafana Host, and Help, which can be toggled between using buttons.
Display Configure Dashboard view within an iframe embedded directly in the Existing Grafana Hosts view (previously was a separate view).
Add skeleton and first parts of help section.
Warn before deleting sensor - warn the user before a sensor is deleted that measurements will be deleted. Improved the previous warning implementation for updating a sensor.
Grafanaclass updates
Add delete_all_dashboards and delete_all_datasources methods to Grafana.
Invoke these methods to clear the test instances before/after running the tests.
Invoke these methods when the user deletes a GFConfig.
Add extra check to Grafana.create_postgres_datasource to avoid throwing an error when an empty string is passed to the method. Add a test for Grafana.create_postgres_datasource to confirm that this fix was successful.
Add a validate_credentials call to Grafana.delete_datasource_by_name to confirm that the API credentials are valid before attempting to delete the datasource.
Leave the datasource empty when creating a panel to set it as default in the Grafana UI without having to know the datasource name.
Check that hostname is not already taken when creating a GFConfig, sending error or success message to the messages framework.
Update refresh rate to 1s.
Types of Changes
[x] Feature (non-breaking change which adds functionality)
[x] Bug Fix (non-breaking change that fixes an issue)
[ ] Breaking Change (feature/fix that causes existing features to not work as expected)
[x] Documentation
Checklist
[?] I have read the [contribute]contributing doc ? Not sure where this is
[x] Classes, scripts, and environment variables follow existing naming convention
[x] Lint and Unit tests pass locally
[n/a] New features on hardware have been tested on a local Raspberry Pi
[x] Mention new programs/binaries if any must be installed along with this change
Adding django-js-reverse to requirements.txt. It allows our javascript code to use Django's reverse system to retrieve URLs, without having to embed these urls in the html.
[x] Mention new environment variables if any have been added to hardware/env file
Grafana Documentation, GPS Integration, & Bug Fixes
Description
Grafana integration now takes username/password:
Bug fix: Only display Configure Dashboard panels for Grafana dashboards which correspond to an Event in the database.
Issue #535: Add GPS panel query/support to Grafana integration
Update the Grafana class to support creating 3 panel types: regular graph (type that was made previously), map (using the TrackMap plugin), and gauge.
Update Grafana.create_panel_query to create a special type of query if panel_type=="map". The TrackMap plugin requires specific field names, while graph and gauge types can be built using the previous approach.
Update Grafana.update_panel_sensor to update the graph type when the sensor is updated.
Update sensor.html, sensor.py, and sensor.js to support choosing graph type:
Issue #571: Documentation for Configure Grafana page
Warn before deleting sensor - warn the user before a sensor is deleted that measurements will be deleted. Improved the previous warning implementation for updating a sensor.
Grafana
class updatesdelete_all_dashboards
anddelete_all_datasources
methods to Grafana.Grafana.create_postgres_datasource
to avoid throwing an error when an empty string is passed to the method. Add a test forGrafana.create_postgres_datasource
to confirm that this fix was successful.validate_credentials
call toGrafana.delete_datasource_by_name
to confirm that the API credentials are valid before attempting to delete the datasource.Check that hostname is not already taken when creating a GFConfig, sending error or success message to the messages framework.
Update refresh rate to 1s.
Types of Changes
Checklist
[?] I have read the [contribute]contributing doc ? Not sure where this is
[x] Classes, scripts, and environment variables follow existing naming convention
[x] Lint and Unit tests pass locally
[n/a] New features on hardware have been tested on a local Raspberry Pi
[x] Mention new programs/binaries if any must be installed along with this change
django-js-reverse
torequirements.txt
. It allows our javascript code to use Django's reverse system to retrieve URLs, without having to embed these urls in the html.[x] Mention new environment variables if any have been added to hardware/env file
[x] Test coverage should not drop more than 3%