Skip to content

insights: add mutation for deleting a dashboard

Administrator requested to merge insights/api/delete-dashboard into main

Created by: CristinaBirkel

Closes #25649 (closed)

Description

Adds a mutation for deleteInsightsDashboard.

Note: I added the resolver right into resolver.go rather than adding a wrapper and having it call another function in dashboard_resolver.go. It seemed more straightforward to implement it there since it's not doing anything fancy, but let me know if you had something else in mind!

Testing Steps

Since there's no way to create a dashboard through the API (yet!) you'll have to add some manually into the dashboard table. Then query for dashboards:

query insightDashboards {
	insightDashboards(first: 10) {
		nodes {
			id, title
    }
  }
}

Then you can use one of those ids to call delete, for example:

mutation {
  deleteInsightsDashboard(id:"ZGFzaGJvYXJkOnsiSWRUeXBlIjoicmVhbCIsIkFyZyI6M30=") { alwaysNil }
}

Then verify in the database that the deleted_at column now contains a timestamp, and you can also check that that same dashboard doesn't still show when running the original query again.

Merge request reports

Loading