sourcegraph/sourcegraph-public-snapshot

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

開放

#22,957 建立於 2021年7月19日

 (9 則留言) (0 個反應) (0 位負責人)Go (1,374 個分叉)auto 404
code-insightsgood first issue

倉庫指標

星標
 (10,290 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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

貢獻者指南