Skip to content

Code Insights: Support filter panel insight creation flow in gql api

Administrator requested to merge vk/gql-fix-filters-insight-creation-flow into main

Created by: vovakulikov

Closes https://github.com/sourcegraph/sourcegraph/issues/27892

Context

This PR adds support of "save as copy" feature in GQL API. A few notes about implementation. Our backend doesn't support filters in insight creation input mutation. Because of that, we have to create insight first and then call the second network request - updateLineChart mutation (this mutation support filters as an input). After that, we have to update our local cache in apollo to see newly created insight in the dashboard where the user clicked save as new.

Note: this feature doesn't work in virtual dashboards. See https://github.com/sourcegraph/sourcegraph/issues/27906

How to test

  1. Go to any dashboard except virtual (all insights)
  2. Try to create insight through the filters panel
  3. You should see that newly created insight appeared in the dashboard and should have predefined filters that original insight has (an insight that was used to create the current one).
  4. After refreshing the page everything should stay the same.

Merge request reports

Loading