Skip to content

insights: Creating insights in LAM also adds them to global dashboard

Administrator requested to merge insights/lam-api into main

Created by: CristinaBirkel

Part of https://github.com/sourcegraph/sourcegraph/issues/32796

Description

At a high level, this PR is handling an automatically created dashboard for Limited Access Mode that will be useful for brand new customers who do not have any existing global dashboards, (and cannot create one in Limited Access Mode.)

  1. The background license check process will now automatically create the LAM dashboard when it freezes insights, and add any unfrozen insights to the dashboard.
  2. The createPieChartSearchInsight and createLineChartSearchInsight follow the logic outlined in the issue.

Other changes:

  • GetDashboards now takes an array for ID (similar to UserID and OrgID) to support querying for multiple dashboards at once.
  • GetDashboards also takes a WithoutAuthorization parameter to fetch dashboards for internal code use and ignore user permissions.

Test plan

(For testing locally.)

Background process:

  1. Make sure all insights are unfrozen. UPDATE insight_view SET is_frozen = FALSE;
  2. Use a starter license. (See Test Plan here for info)
  3. Start sourcegraph and verify: a. A LAM dashboard has been created b. Any remaining unfrozen insights (up to 2) are attached to the LAM dashboard

createPieChartSearchInsight and createLineChartSearchInsight, for each:

  1. Verify that you CANNOT: a. Create an insight when 2 or more unfrozen insights already exist. b. Create an insight attached to a non-global dashboard.
  2. Verity that you CAN: a. Create a new insight that is not attached to a dashboard. (Will result in being attached only to the LAM dashboard.) b. Create a new insight that is attached to a global dashboard. (Will result in being attached to LAM dashboard and specified global dashboard.)

Merge request reports

Loading