Skip to content

Button to delete sensor data #2091

@nhoening

Description

@nhoening

As a user, I sometimes want to delete sensor data (for instance, to start over with my project).
As of now, I can only delete the sensor to get rid of data.

Add a new "Delete data" action item to the sensor page, below the "Forecast" button. It opens a small dialogue, similar to the other actions in the sidepanel:

  • It should let the user choose all data (default, "All sources") or one specific data source (of the sources that are linked to this sensor's data).
  • It should let the user choose a "from" and "until" time (with a datetime selection dialogue like in the forecast action)
  • Clicking "Delete" asks for confirmation (like "Delete this sensor" does), then calls the DELETE /api/v3_0/sensors/{id}/data endpoint and display a Toast "Data deletion in progress ...". On success or failure response, another Toast message is displayed.
  • On success, evict a dataDeleted event. The graph template should react to it and reload the graph.

Only display the action if the user can delete data (use {% if user_can_delete_sensor %}).

The API endpoint currently deletes all data.

  • Expand it with extra parameters source, from and until. These should be described in @use_kwargs with location json. All are optional - a missing source means all sources.
  • add a test which uses each.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions