Code Insights: Add assign to dashboard functionality
Created by: vovakulikov
Closes https://github.com/sourcegraph/sourcegraph/issues/22233
Background
This PR adds add/remove insight to the dashboard feature. Currently, this PR contains changes for UI (add/remove insight to the dashboard modal) and a new sharing level system for insights and dashboards. Let's take a bit closer to these two subjects.
Sharing system
At the moment dashboards and insights are working via user settings and settings cascade. So we have to take into account some tech limitations and details. Naturally, dashboards like settings cascade have sharing levels (you can see that on the screenshot below)
- Global - this level contains all global insights and global dashboards (these entities are available for all users on sg instances.
- Org level- this level contains all insights from the Global level and from this org level. So it's possible to have some global insights in your org-level custom dashboards. But with this system, we don't have access to insights from other organizations. If we want to share an insight across organizations we have to share it via global level.
- Personal/User - this level contains all insights from the Global level, from all org-level, that user was included, and personal/public insights.
The creation UI has this setting (visibility of insight) when you create or edit your insight.
Important note This PR doesn't implement the Global level. That will be done in the next PR.
UI (add/remove insight modal)
For the UI part of this functionality, this PR adds a modal window with some form for adding/removing insights from the dashboard (see screenshot below)
Lists of insights that might be included in a dashboard calculated according to logic that we described above about sharing levels. Org dashboards only can have insights from the global levels, personal/user dashboards can have insights from all available orgs and personal insights themselves.
What has been done (tech details)
-
Support dashboard's insight-ownership in edit Page -
Implement add to dashboard UI (modal) -
Connect add to dashboard UI with settings cascade
Limitations and cuts the scope
- Since users are able to add/remove insights from the dashboard via modal window I omit adding remove from this dashboard context action item.
- Delete insight now doesn't remove insight ID from dashboard configurations files in the setting cascade (it will be done in the next PR)