Skip to content

Code Insights: Move insights to the enterprise version

Created by: vovakulikov

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

Context

This PR moves code insights codebase from ./src/insights/ to ./src/enterprise/insights. We already moved some parts from the code insight codebase to simplify this PR codebase migration. https://github.com/sourcegraph/sourcegraph/pull/24677. In this PR we do two things

  • Most obvious and important thing we move the codebase
  • We introduce a new system for the extension view rendering for the OSS version and for the enterprise version.

Extension views section component

At the moment we have code insights not only on the dashboard page but we render them on the directory and home (search) page. Historically at some point, we used the Extension API for fetching data for code insights. For that, we had introduced some extension API methods getHomepageViews, getDirectoryView, ..etc. At the moment we don't use this API for code insights since we had moved our data fetching from Extension API to the main app (PR https://github.com/sourcegraph/sourcegraph/pull/24559). But we still want to support these extension views. But we have code insights only in the enterprise version. In order to render extension like views on in OSS version and render extension like views with Code insights view in the enterprise version, this PR introduces component separation. You can find this system in /src/insights/sections/ components.

How to test

  1. Check the OSS version (directory and homepage) of the sourcegraph. You should be able to see the only extensions like views like the Codecov or Snyk extensions views.
  2. Check enterprise version (directory and homepage) you have to see extension and code insights views.
  3. Check that only in enterprise version you can see create code insight from the search page (1-click creation flow)

Known issues/Work in progress

  1. We should update Code Insights doc code links since this PR moves code insight codebase.
  2. We still have to fix enterprise imports
  3. Hide insight navigation item in OSS version

Merge request reports

Loading