Code insights: Adopt GQL API for the creation UI pages
Created by: vovakulikov
UPDATE
This PR is depricated. It got too big IMO for a single request, plus it got muddied up with some merging from main. So I have extracted the important bits out to a new branch and will continue on from there.
Related PR: https://github.com/sourcegraph/sourcegraph/pull/27083
Context
Note: This PR is based on and should merge into this integration PR https://github.com/sourcegraph/sourcegraph/pull/26382
This PR implements minimal surface of GQL API class for code insights backend. Also since we're introducing some UI changes in the creation UI when users use code insights with the GQL backend this PR also adds some changes in the creation forms (hide insight visibility section and replace it with dashboard section). Design is still in review but you can find it here
Work in progress
-
Support query for proper rendering creation UI -
Support lang stats insight creation in createInsight
method API -
Implement proper getInsightById
method usingInsightView
connection query (see latest graphql schema API https://github.com/sourcegraph/sourcegraph/pull/25993/files). At the momentgetInsightById
is partially implemented but it doesn't provide enough information for FE cause now it uses the old Insight connection API where we don't have info about insight types and etc things. With theInsightView
connection, it should be fine we can use__typename
field in the insight view presentation field to be able to distinguish line chart from pie chart (search insight from lang stats insight) We also should be able distinguish FE insight and BE insight (in BE insight we don't have repositories field and this is how we can make a difference between FE and BE insights) -
Implement updateInsight
method. At the moment we don't have any mutation around that even in our latest API schema, This is blocked by BE implementation (need some input from @CristinaBirkel or @coury-clark) -
Check integration and unit tests
Closes https://github.com/sourcegraph/sourcegraph/issues/25877