mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 13:11:49 +00:00
remove all dot-com checks from NewGlobalNavigationBar
- adds DISABLE_BATCH_CHANGES, DISABLE_SEARCH_CONTEXTS - removes license checks from code monitors and own
This commit is contained in:
parent
b49e5382c3
commit
d806791e50
@ -77,12 +77,12 @@ export const NewGlobalNavigationBar: FC<
|
||||
|
||||
// Features enablement flags and conditions
|
||||
const isLicensed = !!window.context?.licenseInfo
|
||||
const showSearchContext = searchContextsEnabled && !isSourcegraphDotCom
|
||||
const showSearchJobs = searchJobsEnabled && !isSourcegraphDotCom
|
||||
const showSearchNotebook = notebooksEnabled && !isSourcegraphDotCom
|
||||
const showCodeMonitoring = codeMonitoringEnabled && !isSourcegraphDotCom
|
||||
const showBatchChanges = batchChangesEnabled && isLicensed && !isSourcegraphDotCom
|
||||
const showCodeInsights = codeInsightsEnabled && !isSourcegraphDotCom
|
||||
const showSearchContext = searchContextsEnabled
|
||||
const showSearchJobs = searchJobsEnabled
|
||||
const showSearchNotebook = notebooksEnabled
|
||||
const showCodeMonitoring = codeMonitoringEnabled
|
||||
const showBatchChanges = batchChangesEnabled && isLicensed
|
||||
const showCodeInsights = codeInsightsEnabled
|
||||
// We only show the hamburger icon on a repo page and search results page
|
||||
const showHamburger =
|
||||
routeMatch === PageRoutes.RepoContainer || (routeMatch === PageRoutes.Search && params.get('q'))
|
||||
|
||||
@ -20,6 +20,7 @@ go_library(
|
||||
"//internal/auth/providers",
|
||||
"//internal/auth/userpasswd",
|
||||
"//internal/authz",
|
||||
"//internal/batches",
|
||||
"//internal/codemonitors",
|
||||
"//internal/conf",
|
||||
"//internal/conf/deploy",
|
||||
@ -32,6 +33,7 @@ go_library(
|
||||
"//internal/notebooks",
|
||||
"//internal/own",
|
||||
"//internal/search/exhaustive",
|
||||
"//internal/search/searchcontexts",
|
||||
"//internal/siteid",
|
||||
"//internal/types",
|
||||
"//internal/version",
|
||||
|
||||
@ -24,6 +24,7 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth/providers"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth/userpasswd"
|
||||
"github.com/sourcegraph/sourcegraph/internal/authz"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches"
|
||||
"github.com/sourcegraph/sourcegraph/internal/codemonitors"
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf"
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf/deploy"
|
||||
@ -36,6 +37,7 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/internal/notebooks"
|
||||
"github.com/sourcegraph/sourcegraph/internal/own"
|
||||
"github.com/sourcegraph/sourcegraph/internal/search/exhaustive"
|
||||
"github.com/sourcegraph/sourcegraph/internal/search/searchcontexts"
|
||||
"github.com/sourcegraph/sourcegraph/internal/siteid"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
"github.com/sourcegraph/sourcegraph/internal/version"
|
||||
@ -431,7 +433,7 @@ func NewJSContextFromRequest(req *http.Request, db database.DB) JSContext {
|
||||
|
||||
Branding: conf.Branding(),
|
||||
|
||||
BatchChangesEnabled: enterprise.BatchChangesEnabledForUser(ctx, db) == nil,
|
||||
BatchChangesEnabled: batches.IsEnabled() && enterprise.BatchChangesEnabledForUser(ctx, db) == nil,
|
||||
BatchChangesDisableWebhooksWarning: conf.Get().BatchChangesDisableWebhooksWarning,
|
||||
BatchChangesWebhookLogsEnabled: webhooks.LoggingEnabled(conf.Get()),
|
||||
|
||||
@ -451,7 +453,7 @@ func NewJSContextFromRequest(req *http.Request, db database.DB) JSContext {
|
||||
// This used to be hardcoded configuration on the frontend.
|
||||
// https://sourcegraph.sourcegraph.com/github.com/sourcegraph/sourcegraph@ec5cc97a11c3f78743388b85b9ae0f1bc5d43932/-/blob/client/web/src/enterprise/EnterpriseWebApp.tsx?L63-71
|
||||
CodeIntelligenceEnabled: true,
|
||||
SearchContextsEnabled: true,
|
||||
SearchContextsEnabled: searchcontexts.IsEnabled(),
|
||||
NotebooksEnabled: notebooks.IsEnabled(),
|
||||
CodeMonitoringEnabled: codemonitors.IsEnabled(),
|
||||
SearchAggregationEnabled: true,
|
||||
|
||||
@ -10,6 +10,7 @@ go_library(
|
||||
"//cmd/frontend/internal/batches/httpapi",
|
||||
"//cmd/frontend/internal/batches/resolvers",
|
||||
"//cmd/frontend/internal/batches/webhooks",
|
||||
"//internal/batches",
|
||||
"//internal/batches/store",
|
||||
"//internal/codeintel",
|
||||
"//internal/conf/conftypes",
|
||||
|
||||
@ -9,6 +9,7 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/batches/httpapi"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/batches/resolvers"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/batches/webhooks"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/store"
|
||||
"github.com/sourcegraph/sourcegraph/internal/codeintel"
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf/conftypes"
|
||||
@ -29,6 +30,10 @@ func Init(
|
||||
_ conftypes.UnifiedWatchable,
|
||||
enterpriseServices *enterprise.Services,
|
||||
) error {
|
||||
if !batches.IsEnabled() {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Initialize store.
|
||||
bstore := store.New(db, observationCtx, keyring.Default().BatchChangesCredentialKey)
|
||||
|
||||
|
||||
@ -13,5 +13,6 @@ go_library(
|
||||
"//internal/conf/conftypes",
|
||||
"//internal/database",
|
||||
"//internal/observation",
|
||||
"//internal/search/searchcontexts",
|
||||
],
|
||||
)
|
||||
|
||||
@ -9,6 +9,7 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf/conftypes"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/observation"
|
||||
"github.com/sourcegraph/sourcegraph/internal/search/searchcontexts"
|
||||
)
|
||||
|
||||
func Init(
|
||||
@ -19,6 +20,9 @@ func Init(
|
||||
_ conftypes.UnifiedWatchable,
|
||||
enterpriseServices *enterprise.Services,
|
||||
) error {
|
||||
if !searchcontexts.IsEnabled() {
|
||||
return nil
|
||||
}
|
||||
enterpriseServices.SearchContextsResolver = resolvers.NewResolver(db)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ go_library(
|
||||
name = "batches",
|
||||
srcs = [
|
||||
"background.go",
|
||||
"conf.go",
|
||||
"doc.go",
|
||||
],
|
||||
importpath = "github.com/sourcegraph/sourcegraph/internal/batches",
|
||||
|
||||
13
internal/batches/conf.go
Normal file
13
internal/batches/conf.go
Normal file
@ -0,0 +1,13 @@
|
||||
package batches
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func IsEnabled() bool {
|
||||
if v, _ := strconv.ParseBool(os.Getenv("DISABLE_BATCH_CHANGES")); v {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
@ -13,12 +13,10 @@ go_library(
|
||||
deps = [
|
||||
"//internal/api",
|
||||
"//internal/database",
|
||||
"//internal/dotcom",
|
||||
"//internal/errcode",
|
||||
"//internal/gitserver",
|
||||
"//internal/gitserver/gitdomain",
|
||||
"//internal/gitserver/protocol",
|
||||
"//internal/licensing",
|
||||
"//internal/search",
|
||||
"//internal/search/client",
|
||||
"//internal/search/commit",
|
||||
|
||||
@ -3,17 +3,11 @@ package codemonitors
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/dotcom"
|
||||
"github.com/sourcegraph/sourcegraph/internal/licensing"
|
||||
)
|
||||
|
||||
func IsEnabled() bool {
|
||||
if dotcom.SourcegraphDotComMode() {
|
||||
return false
|
||||
}
|
||||
if v, _ := strconv.ParseBool(os.Getenv("DISABLE_CODE_MONITORS")); v {
|
||||
return false
|
||||
}
|
||||
return licensing.Check(licensing.FeatureCodeSearch) == nil
|
||||
return true
|
||||
}
|
||||
|
||||
@ -6,8 +6,5 @@ go_library(
|
||||
importpath = "github.com/sourcegraph/sourcegraph/internal/insights",
|
||||
tags = [TAG_SEARCHSUITE],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//internal/conf/deploy",
|
||||
"//internal/dotcom",
|
||||
],
|
||||
deps = ["//internal/conf/deploy"],
|
||||
)
|
||||
|
||||
@ -5,13 +5,9 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf/deploy"
|
||||
"github.com/sourcegraph/sourcegraph/internal/dotcom"
|
||||
)
|
||||
|
||||
func IsEnabled() bool {
|
||||
if dotcom.SourcegraphDotComMode() {
|
||||
return false
|
||||
}
|
||||
if v, _ := strconv.ParseBool(os.Getenv("DISABLE_CODE_INSIGHTS")); v {
|
||||
// Code insights can always be disabled. This can be a helpful escape hatch if e.g. there
|
||||
// are issues with (or connecting to) the codeinsights-db deployment and it is preventing
|
||||
|
||||
@ -18,7 +18,6 @@ go_library(
|
||||
"//internal/database/basestore",
|
||||
"//internal/database/dbutil",
|
||||
"//internal/lazyregexp",
|
||||
"//internal/licensing",
|
||||
"//lib/errors",
|
||||
"@com_github_keegancsmith_sqlf//:sqlf",
|
||||
],
|
||||
|
||||
@ -3,13 +3,11 @@ package notebooks
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/licensing"
|
||||
)
|
||||
|
||||
func IsEnabled() bool {
|
||||
if v, _ := strconv.ParseBool(os.Getenv("DISABLE_NOTEBOOKS")); v {
|
||||
return false
|
||||
}
|
||||
return licensing.Check(licensing.FeatureCodeSearch) == nil
|
||||
return true
|
||||
}
|
||||
|
||||
@ -16,11 +16,9 @@ go_library(
|
||||
"//internal/auth/providers",
|
||||
"//internal/collections",
|
||||
"//internal/database",
|
||||
"//internal/dotcom",
|
||||
"//internal/errcode",
|
||||
"//internal/extsvc",
|
||||
"//internal/gitserver",
|
||||
"//internal/licensing",
|
||||
"//internal/own/codeowners",
|
||||
"//internal/types",
|
||||
"//lib/errors",
|
||||
|
||||
@ -3,17 +3,11 @@ package own
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/dotcom"
|
||||
"github.com/sourcegraph/sourcegraph/internal/licensing"
|
||||
)
|
||||
|
||||
func IsEnabled() bool {
|
||||
if dotcom.SourcegraphDotComMode() {
|
||||
return false
|
||||
}
|
||||
if v, _ := strconv.ParseBool(os.Getenv("DISABLE_OWN")); v {
|
||||
return false
|
||||
}
|
||||
return licensing.Check(licensing.FeatureCodeSearch) == nil
|
||||
return true
|
||||
}
|
||||
|
||||
@ -6,10 +6,7 @@ go_library(
|
||||
srcs = ["conf.go"],
|
||||
importpath = "github.com/sourcegraph/sourcegraph/internal/search/exhaustive",
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//internal/conf/conftypes",
|
||||
"//internal/dotcom",
|
||||
],
|
||||
deps = ["//internal/conf/conftypes"],
|
||||
)
|
||||
|
||||
go_test(
|
||||
|
||||
@ -5,14 +5,9 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf/conftypes"
|
||||
"github.com/sourcegraph/sourcegraph/internal/dotcom"
|
||||
)
|
||||
|
||||
func IsEnabled(cfg conftypes.SiteConfigQuerier) bool {
|
||||
if dotcom.SourcegraphDotComMode() {
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO(stefan): Remove this once Search Jobs is no longer experimental.
|
||||
experimentalFeatures := cfg.SiteConfig().ExperimentalFeatures
|
||||
if experimentalFeatures != nil && experimentalFeatures.SearchJobs != nil {
|
||||
|
||||
@ -3,7 +3,10 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "searchcontexts",
|
||||
srcs = ["search_contexts.go"],
|
||||
srcs = [
|
||||
"conf.go",
|
||||
"search_contexts.go",
|
||||
],
|
||||
importpath = "github.com/sourcegraph/sourcegraph/internal/search/searchcontexts",
|
||||
tags = [TAG_PLATFORM_SEARCH],
|
||||
visibility = ["//:__subpackages__"],
|
||||
|
||||
13
internal/search/searchcontexts/conf.go
Normal file
13
internal/search/searchcontexts/conf.go
Normal file
@ -0,0 +1,13 @@
|
||||
package searchcontexts
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func IsEnabled() bool {
|
||||
if v, _ := strconv.ParseBool(os.Getenv("DISABLE_SEARCH_CONTEXTS")); v {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user