insights: Creating insights in LAM also adds them to global dashboard
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.)
- The background license check process will now automatically create the LAM dashboard when it freezes insights, and add any unfrozen insights to the dashboard.
- The
createPieChartSearchInsight
andcreateLineChartSearchInsight
follow the logic outlined in the issue.
Other changes:
-
GetDashboards
now takes an array forID
(similar toUserID
andOrgID
) to support querying for multiple dashboards at once. -
GetDashboards
also takes aWithoutAuthorization
parameter to fetch dashboards for internal code use and ignore user permissions.
Test plan
(For testing locally.)
Background process:
- Make sure all insights are unfrozen.
UPDATE insight_view SET is_frozen = FALSE;
- Use a starter license. (See Test Plan here for info)
- 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:
- 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.
- 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.)