sourcegraph/sourcegraph-public-snapshot

Disable showing "global" option if it's not available anyway - at least for global dashboard

Ouverte

#22 957 ouverte le 19 juil. 2021

 (9 commentaires) (0 réaction) (0 personne assignée)Go (1 374 forks)auto 404
code-insightsgood first issue

Métriques du dépôt

Stars
 (10 290 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

Context

Code Insights page (see /insights) uses the setting cascade to store insights settings. In the setting cascade, we can have three different levels of scope. Personal, Organization, and Global level. Personal is available always if you're an authenticated user. The organization level is available only if your account has an organization and you're part of that organization. And the global level is available for reading always but you have to be an admin of your instance to be able to write/update global levels. And the most important part of sourcegraph instance was configured in some special way (way where you use custom initial global settings file) there is no way to modify global level even if you're an admin.

Problem statement

If an instance is using a settings file (so we can't modify it, so there's no "global" scope for insights) then we should not bother showing a bunch of disabled states, because it seems unlikely that they're going to change how they run site settings just to get a global state instead of just making a global "organization" (which is a much easier workaround, likely)?

Success criteria

  • In the case of the read-only global settings file, we should see only organization if we have them and personal level in insight visibility picker component at code insights creation UI.
  • Also you should see only org and personal level of visibility in dashboard creation UI

Techincal details

We have information to understand that case it's allowSiteSettingsEdits property at the global setting subject. At the moment we already use this setting at visibility picket to render proper tooltip with warning and disable that level (the screenshot above). Visibility picker component which is used for Code stats and Searches start insight you can find it here

Dashboard creation/edit UI you can find here

Guide contributeur