Skip to content

insights: add mutation to update insight views

Administrator requested to merge insights/api/update-insight-view into main

Created by: CristinaBirkel

Closes #22816

Description

This PR implements the mutation for updates on the LineChartSearchInsight, only to the presentationOptions and the viewControls. So this only updates the properties on the insight_view for now. There will be another PR for modifying the data series.

This deviates slightly from the schema used to create insights so there will be another issue to address that: https://github.com/sourcegraph/sourcegraph/issues/26679

Testing Steps

You can run a query such as this in order to make changes and see the updates:

mutation {
    updateLineChartSearchInsight (
        id: "aW5zaWdodF92aWV3OiJzZWFyY2hJbnNpZ2h0cy5pbnNpZ2h0LnNvTWFueUluc2lnaHRzMiI=",
        input: {
            presentationOptions: {
                title: "Changing the title",
            },
            dataSeries: [],
            viewControls: {
                filters: {
                    includeRepoRegex: "include regex 22",
                    excludeRepoRegex: "exclude regex 22",
                }
            }
        })
    {
        view { id,
                    defaultFilters {
                        excludeRepoRegex,
                        includeRepoRegex
                    }
                    presentation {
                        ... on LineChartInsightViewPresentation {
                          title,
                          seriesPresentation {
                              seriesId,
                              label,
                              color
                          }
                        }
                }
         } 
    }
}

Merge request reports

Loading