mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 15:31:48 +00:00
Remove core workflow improvements flag (#41986)
This commit is contained in:
parent
0651b67fa4
commit
d66dbbc0e4
@ -204,7 +204,6 @@ $theme-colors: (
|
||||
rgba(215, 240, 253, 0.25) 83.64%
|
||||
);
|
||||
--modal-bg: #{rgba($gray-04, 0.5)};
|
||||
// Colors used in the search sidebar with .core-workflow-improvements-enabled
|
||||
--sidebar-bg: var(--color-bg-1);
|
||||
--sidebar-border-color: var(--border-color-2);
|
||||
}
|
||||
@ -296,7 +295,6 @@ $theme-colors: (
|
||||
--marketing-gradient: linear-gradient(90.64deg, rgba(108, 8, 223, 0.5) 3.11%, rgba(0, 165, 213, 0.5) 83.64%);
|
||||
--marketing-gradient-25: linear-gradient(90.64deg, rgba(108, 8, 223, 0.25) 3.11%, rgba(0, 165, 213, 0.25) 83.64%);
|
||||
--modal-bg: #{rgba($gray-08, 0.5)};
|
||||
// Colors used in the search sidebar with .core-workflow-improvements-enabled
|
||||
--sidebar-bg: var(--black);
|
||||
--sidebar-border-color: var(--color-bg-2);
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ import SourceCommitIcon from 'mdi-react/SourceCommitIcon'
|
||||
import { displayRepoName } from '@sourcegraph/shared/src/components/RepoLink'
|
||||
import { PlatformContextProps } from '@sourcegraph/shared/src/platform/context'
|
||||
import { CommitMatch, getCommitMatchUrl, getRepositoryUrl } from '@sourcegraph/shared/src/search/stream'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { Timestamp } from '@sourcegraph/web/src/components/time/Timestamp'
|
||||
import { Link, Code } from '@sourcegraph/wildcard'
|
||||
@ -36,15 +35,13 @@ export const CommitSearchResult: React.FunctionComponent<Props> = ({
|
||||
as,
|
||||
index,
|
||||
}) => {
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
|
||||
const renderTitle = (): JSX.Element => (
|
||||
<div className={styles.title}>
|
||||
<span
|
||||
className={classNames(
|
||||
'test-search-result-label flex-grow-1',
|
||||
styles.titleInner,
|
||||
coreWorkflowImprovementsEnabled && styles.mutedRepoFileLink
|
||||
styles.mutedRepoFileLink
|
||||
)}
|
||||
>
|
||||
<Link to={getRepositoryUrl(result.repository)}>{displayRepoName(result.repository)}</Link>
|
||||
|
||||
@ -1,15 +1,10 @@
|
||||
.file-match-children {
|
||||
background-color: var(--code-bg);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: var(--border-radius);
|
||||
padding: 0.25rem 0;
|
||||
position: relative;
|
||||
|
||||
:global(.core-workflow-improvements-enabled) & {
|
||||
border: none;
|
||||
}
|
||||
|
||||
:global(.core-workflow-improvements-enabled) [data-collapsible='true'] & {
|
||||
[data-collapsible='true'] & {
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
@ -67,11 +62,7 @@
|
||||
position: relative;
|
||||
|
||||
&:not(:first-child) {
|
||||
border-top: 1px solid var(--border-color-2);
|
||||
|
||||
:global(.core-workflow-improvements-enabled) & {
|
||||
border-top-color: var(--border-color);
|
||||
}
|
||||
border-top: 1px solid var(--border-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,13 +21,10 @@ import { Controller as ExtensionsController } from '@sourcegraph/shared/src/exte
|
||||
import { HoverContext } from '@sourcegraph/shared/src/hover/HoverOverlay.types'
|
||||
import { ContentMatch, SymbolMatch, PathMatch, getFileMatchUrl } from '@sourcegraph/shared/src/search/stream'
|
||||
import { SettingsCascadeProps } from '@sourcegraph/shared/src/settings/settings'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { SymbolIcon } from '@sourcegraph/shared/src/symbols/SymbolIcon'
|
||||
import { SymbolTag } from '@sourcegraph/shared/src/symbols/SymbolTag'
|
||||
import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
|
||||
import { codeCopiedEvent } from '@sourcegraph/shared/src/tracking/event-log-creators'
|
||||
import { useCodeIntelViewerUpdates } from '@sourcegraph/shared/src/util/useCodeIntelViewerUpdates'
|
||||
import { Link, Code } from '@sourcegraph/wildcard'
|
||||
|
||||
import { CodeExcerpt, FetchFileParameters } from './CodeExcerpt'
|
||||
import { LastSyncedIcon } from './LastSyncedIcon'
|
||||
@ -148,8 +145,6 @@ function navigateToFileOnMiddleMouseButtonClick(event: MouseEvent<HTMLElement>):
|
||||
}
|
||||
|
||||
export const FileMatchChildren: React.FunctionComponent<React.PropsWithChildren<FileMatchProps>> = props => {
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
|
||||
/**
|
||||
* If LazyFileResultSyntaxHighlighting is enabled, we fetch plaintext
|
||||
* line ranges _alongside_ the typical highlighted line ranges.
|
||||
@ -347,14 +342,9 @@ export const FileMatchChildren: React.FunctionComponent<React.PropsWithChildren<
|
||||
telemetryService.log(...codeCopiedEvent('file-match'))
|
||||
}, [telemetryService])
|
||||
|
||||
const openInNewTabProps = props.openInNewTab ? { target: '_blank', rel: 'noopener noreferrer' } : undefined
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classNames(
|
||||
styles.fileMatchChildren,
|
||||
coreWorkflowImprovementsEnabled && result.type === 'symbol' && styles.symbols
|
||||
)}
|
||||
className={classNames(styles.fileMatchChildren, result.type === 'symbol' && styles.symbols)}
|
||||
data-testid="file-match-children"
|
||||
>
|
||||
{result.repoLastFetched && <LastSyncedIcon lastSyncedTime={result.repoLastFetched} />}
|
||||
@ -366,23 +356,7 @@ export const FileMatchChildren: React.FunctionComponent<React.PropsWithChildren<
|
||||
)}
|
||||
|
||||
{/* Symbols */}
|
||||
{((!coreWorkflowImprovementsEnabled && result.type === 'symbol' && result.symbols) || []).map(symbol => (
|
||||
<Link
|
||||
to={symbol.url}
|
||||
className={classNames('test-file-match-children-item', styles.item)}
|
||||
key={`symbol:${symbol.name}${String(symbol.containerName)}${symbol.url}`}
|
||||
data-testid="file-match-children-item"
|
||||
{...openInNewTabProps}
|
||||
>
|
||||
<SymbolIcon kind={symbol.kind} className="mr-1 flex-shrink-0" />
|
||||
<Code>
|
||||
{symbol.name}{' '}
|
||||
{symbol.containerName && <span className="text-muted">{symbol.containerName}</span>}
|
||||
</Code>
|
||||
</Link>
|
||||
))}
|
||||
|
||||
{((coreWorkflowImprovementsEnabled && result.type === 'symbol' && result.symbols) || []).map(symbol => (
|
||||
{((result.type === 'symbol' && result.symbols) || []).map(symbol => (
|
||||
<div
|
||||
key={`symbol:${symbol.name}${String(symbol.containerName)}${symbol.url}`}
|
||||
className={classNames('test-file-match-children-item', styles.symbol)}
|
||||
@ -420,7 +394,7 @@ export const FileMatchChildren: React.FunctionComponent<React.PropsWithChildren<
|
||||
{/* Line matches */}
|
||||
{grouped.length > 0 && (
|
||||
<div>
|
||||
{grouped.map((group, index) => (
|
||||
{grouped.map(group => (
|
||||
<div
|
||||
key={`linematch:${getFileMatchUrl(result)}${group.position.line}:${
|
||||
group.position.character
|
||||
|
||||
@ -23,7 +23,6 @@ import {
|
||||
getRevision,
|
||||
} from '@sourcegraph/shared/src/search/stream'
|
||||
import { isSettingsValid, SettingsCascadeProps } from '@sourcegraph/shared/src/settings/settings'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
|
||||
import { Badge } from '@sourcegraph/wildcard'
|
||||
|
||||
@ -107,7 +106,6 @@ type CommonResultContainerProps = Omit<
|
||||
|
||||
// This is a search result for types file (content), path, or symbol.
|
||||
export const FileSearchResult: React.FunctionComponent<React.PropsWithChildren<Props>> = props => {
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
const result = props.result
|
||||
const repoAtRevisionURL = getRepositoryUrl(result.repository, result.branches)
|
||||
const revisionDisplayName = getRevision(result.branches, result.commit)
|
||||
@ -115,10 +113,10 @@ export const FileSearchResult: React.FunctionComponent<React.PropsWithChildren<P
|
||||
|
||||
const ranking = useMemo(() => {
|
||||
if (!isErrorLike(settings) && settings?.experimentalFeatures?.clientSearchResultRanking === BY_LINE_RANKING) {
|
||||
return new LineRanking(coreWorkflowImprovementsEnabled ? 5 : 10)
|
||||
return new LineRanking(5)
|
||||
}
|
||||
return new ZoektRanking(coreWorkflowImprovementsEnabled ? 3 : 5)
|
||||
}, [settings, coreWorkflowImprovementsEnabled])
|
||||
return new ZoektRanking(3)
|
||||
}, [settings])
|
||||
|
||||
// The number of lines of context to show before and after each match.
|
||||
const context = useMemo(() => {
|
||||
@ -200,7 +198,7 @@ export const FileSearchResult: React.FunctionComponent<React.PropsWithChildren<P
|
||||
? `${props.repoDisplayName}${revisionDisplayName ? `@${revisionDisplayName}` : ''}`
|
||||
: undefined
|
||||
}
|
||||
className={classNames(styles.titleInner, coreWorkflowImprovementsEnabled && styles.mutedRepoFileLink)}
|
||||
className={classNames(styles.titleInner, styles.mutedRepoFileLink)}
|
||||
/>
|
||||
),
|
||||
allExpanded: props.allExpanded,
|
||||
@ -277,10 +275,8 @@ export const FileSearchResult: React.FunctionComponent<React.PropsWithChildren<P
|
||||
collapsible: limitedMatchCount < matchCount,
|
||||
collapsedChildren,
|
||||
expandedChildren,
|
||||
collapseLabel: coreWorkflowImprovementsEnabled ? 'Show less' : `Hide ${hideCount}`,
|
||||
expandLabel: coreWorkflowImprovementsEnabled
|
||||
? `Show ${hideCount} more ${pluralize('match', hideCount, 'matches')}`
|
||||
: `${hideCount} more`,
|
||||
collapseLabel: 'Show less',
|
||||
expandLabel: `Show ${hideCount} more ${pluralize('match', hideCount, 'matches')}`,
|
||||
matchCountLabel,
|
||||
}
|
||||
}
|
||||
@ -300,10 +296,8 @@ export const FileSearchResult: React.FunctionComponent<React.PropsWithChildren<P
|
||||
description,
|
||||
collapsedChildren: <FileMatchChildren {...props} result={result} {...collapsedMatchGroups} />,
|
||||
expandedChildren,
|
||||
collapseLabel: coreWorkflowImprovementsEnabled ? 'Show less' : `Hide ${length}`,
|
||||
expandLabel: coreWorkflowImprovementsEnabled
|
||||
? `Show ${length} more ${pluralize('match', length, 'matches')}`
|
||||
: `${length} more`,
|
||||
collapseLabel: 'Show less',
|
||||
expandLabel: `Show ${length} more ${pluralize('match', length, 'matches')}`,
|
||||
matchCountLabel,
|
||||
as: props.as,
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ import SourceRepositoryIcon from 'mdi-react/SourceRepositoryIcon'
|
||||
import { highlightNode } from '@sourcegraph/common'
|
||||
import { codeHostSubstrLength, displayRepoName } from '@sourcegraph/shared/src/components/RepoLink'
|
||||
import { getRepoMatchLabel, getRepoMatchUrl, RepositoryMatch } from '@sourcegraph/shared/src/search/stream'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { Icon, Link } from '@sourcegraph/wildcard'
|
||||
|
||||
import { LastSyncedIcon } from './LastSyncedIcon'
|
||||
@ -32,19 +31,12 @@ export const RepoSearchResult: React.FunctionComponent<RepoSearchResultProps> =
|
||||
as,
|
||||
index,
|
||||
}) => {
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
const repoDescriptionElement = useRef<HTMLDivElement>(null)
|
||||
const repoNameElement = useRef<HTMLAnchorElement>(null)
|
||||
|
||||
const renderTitle = (): JSX.Element => (
|
||||
<div className={styles.title}>
|
||||
<span
|
||||
className={classNames(
|
||||
'test-search-result-label',
|
||||
styles.titleInner,
|
||||
coreWorkflowImprovementsEnabled && styles.mutedRepoFileLink
|
||||
)}
|
||||
>
|
||||
<span className={classNames('test-search-result-label', styles.titleInner, styles.mutedRepoFileLink)}>
|
||||
<Link to={getRepoMatchUrl(result)} ref={repoNameElement}>
|
||||
{displayRepoName(getRepoMatchLabel(result))}
|
||||
</Link>
|
||||
|
||||
@ -4,31 +4,22 @@
|
||||
}
|
||||
|
||||
&:not(:last-of-type) {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
:global(.core-workflow-improvements-enabled) &:not(:last-of-type) {
|
||||
// Prevents the sticky items below from affecting
|
||||
// anything outside of the result container.
|
||||
isolation: isolate;
|
||||
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.header {
|
||||
padding: 0.5rem 0.5rem 0.5rem 0;
|
||||
background-color: transparent;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
|
||||
:global(.core-workflow-improvements-enabled) & {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1; // Show on top of search result contents
|
||||
background-color: var(--body-bg);
|
||||
}
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1; // Show on top of search result contents
|
||||
background-color: var(--body-bg);
|
||||
|
||||
&-title {
|
||||
flex: 1 1 auto;
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
/* eslint jsx-a11y/click-events-have-key-events: warn, jsx-a11y/no-static-element-interactions: warn */
|
||||
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
||||
|
||||
import { mdiArrowCollapseUp, mdiChevronDown, mdiArrowExpandDown, mdiChevronLeft, mdiChevronUp } from '@mdi/js'
|
||||
import { mdiChevronDown, mdiChevronUp } from '@mdi/js'
|
||||
import classNames from 'classnames'
|
||||
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { Button, Icon } from '@sourcegraph/wildcard'
|
||||
import { Icon } from '@sourcegraph/wildcard'
|
||||
|
||||
import { formatRepositoryStarCount } from '../util/stars'
|
||||
|
||||
@ -125,11 +124,9 @@ export const ResultContainer: React.FunctionComponent<React.PropsWithChildren<Re
|
||||
expandLabel,
|
||||
collapsedChildren,
|
||||
expandedChildren,
|
||||
icon,
|
||||
title,
|
||||
titleClassName,
|
||||
description,
|
||||
matchCountLabel,
|
||||
repoName,
|
||||
repoStars,
|
||||
onResultClicked,
|
||||
@ -139,7 +136,6 @@ export const ResultContainer: React.FunctionComponent<React.PropsWithChildren<Re
|
||||
as: Component = 'div',
|
||||
index,
|
||||
}) => {
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
const [expanded, setExpanded] = useState(allExpanded || defaultExpanded)
|
||||
const formattedRepositoryStarCount = formatRepositoryStarCount(repoStars)
|
||||
|
||||
@ -152,13 +148,13 @@ export const ResultContainer: React.FunctionComponent<React.PropsWithChildren<Re
|
||||
}
|
||||
|
||||
// Scroll back to top of result when collapsing
|
||||
if (coreWorkflowImprovementsEnabled && expanded) {
|
||||
if (expanded) {
|
||||
setTimeout(() => {
|
||||
const reducedMotion = !window.matchMedia('(prefers-reduced-motion: no-preference)').matches
|
||||
rootRef.current?.scrollIntoView({ block: 'nearest', behavior: reducedMotion ? 'auto' : 'smooth' })
|
||||
}, 0)
|
||||
}
|
||||
}, [collapsible, coreWorkflowImprovementsEnabled, expanded])
|
||||
}, [collapsible, expanded])
|
||||
|
||||
const trackReferencePanelClick = (): void => {
|
||||
if (onResultClicked) {
|
||||
@ -177,22 +173,6 @@ export const ResultContainer: React.FunctionComponent<React.PropsWithChildren<Re
|
||||
>
|
||||
<article aria-labelledby={`result-container-${index}`}>
|
||||
<div className={styles.header} id={`result-container-${index}`}>
|
||||
{!coreWorkflowImprovementsEnabled && (
|
||||
<>
|
||||
<Icon
|
||||
className="flex-shrink-0"
|
||||
as={icon}
|
||||
{...(resultType
|
||||
? {
|
||||
'aria-label': `${resultType} result`,
|
||||
}
|
||||
: {
|
||||
'aria-hidden': true,
|
||||
})}
|
||||
/>
|
||||
<div className={classNames('mx-1', styles.headerDivider)} />
|
||||
</>
|
||||
)}
|
||||
<CodeHostIcon repoName={repoName} className="text-muted flex-shrink-0 mr-1" />
|
||||
<div
|
||||
className={classNames(styles.headerTitle, titleClassName)}
|
||||
@ -203,42 +183,6 @@ export const ResultContainer: React.FunctionComponent<React.PropsWithChildren<Re
|
||||
<span className={classNames('ml-2', styles.headerDescription)}>{description}</span>
|
||||
)}
|
||||
</div>
|
||||
{!coreWorkflowImprovementsEnabled && matchCountLabel && (
|
||||
<span className="d-flex align-items-center">
|
||||
<small>{matchCountLabel}</small>
|
||||
{collapsible && <div className={classNames('mx-2', styles.headerDivider)} />}
|
||||
</span>
|
||||
)}
|
||||
{!coreWorkflowImprovementsEnabled && collapsible && (
|
||||
<Button
|
||||
data-testid="toggle-matches-container"
|
||||
className={classNames('py-0', styles.toggleMatchesContainer)}
|
||||
onClick={toggle}
|
||||
variant="link"
|
||||
size="sm"
|
||||
>
|
||||
{expanded ? (
|
||||
<>
|
||||
{collapseLabel && (
|
||||
<Icon className="mr-1" aria-hidden={true} svgPath={mdiArrowCollapseUp} />
|
||||
)}
|
||||
{collapseLabel}
|
||||
{!collapseLabel && <Icon aria-hidden={true} svgPath={mdiChevronDown} />}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{expandLabel && (
|
||||
<Icon className="mr-1" aria-hidden={true} svgPath={mdiArrowExpandDown} />
|
||||
)}
|
||||
{expandLabel}
|
||||
{!expandLabel && <Icon aria-hidden={true} svgPath={mdiChevronLeft} />}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
{!coreWorkflowImprovementsEnabled && matchCountLabel && formattedRepositoryStarCount && (
|
||||
<div className={classNames('mx-2', styles.headerDivider)} />
|
||||
)}
|
||||
{formattedRepositoryStarCount && (
|
||||
<span className="d-flex align-items-center">
|
||||
<SearchResultStar aria-label={`${repoStars} stars`} />
|
||||
@ -246,14 +190,9 @@ export const ResultContainer: React.FunctionComponent<React.PropsWithChildren<Re
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
className={classNames(
|
||||
coreWorkflowImprovementsEnabled && styles.collapsibleResults,
|
||||
resultsClassName
|
||||
)}
|
||||
>
|
||||
<div className={classNames(styles.collapsibleResults, resultsClassName)}>
|
||||
<div>{expanded ? expandedChildren : collapsedChildren}</div>
|
||||
{coreWorkflowImprovementsEnabled && collapsible && (
|
||||
{collapsible && (
|
||||
<button
|
||||
type="button"
|
||||
className={classNames(
|
||||
|
||||
@ -5,17 +5,10 @@
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
background-color: var(--code-bg);
|
||||
border: 1px solid var(--border-color-2);
|
||||
border-radius: var(--border-radius);
|
||||
border-top: 1px solid var(--border-color);
|
||||
padding: 0.25rem 0;
|
||||
position: relative;
|
||||
|
||||
:global(.core-workflow-improvements-enabled) & {
|
||||
border: none !important;
|
||||
border-top: none !important;
|
||||
}
|
||||
|
||||
&-clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
@ -25,10 +18,6 @@
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
&:not(:first-child) {
|
||||
border-top: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
pre,
|
||||
code {
|
||||
width: 100%;
|
||||
|
||||
@ -4,7 +4,6 @@ import { mdiClipboardPulseOutline } from '@mdi/js'
|
||||
import classNames from 'classnames'
|
||||
|
||||
import { Progress, StreamingResultsState } from '@sourcegraph/shared/src/search/stream'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { Icon, Link } from '@sourcegraph/wildcard'
|
||||
|
||||
import { StreamingProgressCount } from './StreamingProgressCount'
|
||||
@ -25,17 +24,12 @@ export const StreamingProgress: React.FunctionComponent<React.PropsWithChildren<
|
||||
showTrace,
|
||||
onSearchAgain,
|
||||
}) => {
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
const isLoading = state === 'loading'
|
||||
|
||||
return (
|
||||
<>
|
||||
{(!coreWorkflowImprovementsEnabled || isLoading) && (
|
||||
<StreamingProgressCount progress={progress} state={state} hideIcon={coreWorkflowImprovementsEnabled} />
|
||||
)}
|
||||
{(!coreWorkflowImprovementsEnabled || !isLoading) && (
|
||||
<StreamingProgressSkippedButton progress={progress} onSearchAgain={onSearchAgain} />
|
||||
)}
|
||||
{isLoading && <StreamingProgressCount progress={progress} state={state} hideIcon={true} />}
|
||||
{!isLoading && <StreamingProgressSkippedButton progress={progress} onSearchAgain={onSearchAgain} />}
|
||||
<TraceLink showTrace={showTrace} trace={progress.trace} />
|
||||
</>
|
||||
)
|
||||
|
||||
@ -2,7 +2,6 @@ import React, { useCallback, useMemo, useState } from 'react'
|
||||
|
||||
import { mdiAlertCircle, mdiChevronDown, mdiInformationOutline } from '@mdi/js'
|
||||
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { Button, Popover, PopoverContent, PopoverTrigger, Position, Icon } from '@sourcegraph/wildcard'
|
||||
|
||||
import { StreamingProgressProps } from './StreamingProgress'
|
||||
@ -14,8 +13,6 @@ import styles from './StreamingProgressSkippedButton.module.scss'
|
||||
export const StreamingProgressSkippedButton: React.FunctionComponent<
|
||||
React.PropsWithChildren<Pick<StreamingProgressProps, 'progress' | 'onSearchAgain'>>
|
||||
> = ({ progress, onSearchAgain }) => {
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
|
||||
const [isOpen, setIsOpen] = useState(false)
|
||||
|
||||
const skippedWithWarningOrError = useMemo(
|
||||
@ -34,43 +31,32 @@ export const StreamingProgressSkippedButton: React.FunctionComponent<
|
||||
const progressText = getProgressText(progress)
|
||||
|
||||
return (
|
||||
<>
|
||||
{(coreWorkflowImprovementsEnabled || progress.skipped.length > 0) && (
|
||||
<Popover isOpen={isOpen} onOpenChange={event => setIsOpen(event.isOpen)}>
|
||||
<PopoverTrigger
|
||||
className="mb-0 d-flex align-items-center text-decoration-none"
|
||||
size="sm"
|
||||
variant={skippedWithWarningOrError ? 'danger' : 'secondary'}
|
||||
outline={true}
|
||||
data-testid="streaming-progress-skipped"
|
||||
as={Button}
|
||||
aria-expanded={isOpen}
|
||||
aria-label="Open excluded results"
|
||||
>
|
||||
{skippedWithWarningOrError ? (
|
||||
<Icon aria-hidden={true} className="mr-2" svgPath={mdiAlertCircle} />
|
||||
) : coreWorkflowImprovementsEnabled ? (
|
||||
<Icon aria-hidden={true} className="mr-2" svgPath={mdiInformationOutline} />
|
||||
) : null}
|
||||
{coreWorkflowImprovementsEnabled ? (
|
||||
<CountContent progressText={progressText} />
|
||||
) : (
|
||||
<>Some results excluded </>
|
||||
)}
|
||||
<Icon aria-hidden={true} data-caret={true} className="mr-0" svgPath={mdiChevronDown} />
|
||||
</PopoverTrigger>
|
||||
<PopoverContent
|
||||
position={Position.bottomStart}
|
||||
className={styles.skippedPopover}
|
||||
data-testid="streaming-progress-skipped-popover"
|
||||
>
|
||||
<StreamingProgressSkippedPopover
|
||||
progress={progress}
|
||||
onSearchAgain={onSearchAgainWithPopupClose}
|
||||
/>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
)}
|
||||
</>
|
||||
<Popover isOpen={isOpen} onOpenChange={event => setIsOpen(event.isOpen)}>
|
||||
<PopoverTrigger
|
||||
className="mb-0 d-flex align-items-center text-decoration-none"
|
||||
size="sm"
|
||||
variant={skippedWithWarningOrError ? 'danger' : 'secondary'}
|
||||
outline={true}
|
||||
data-testid="streaming-progress-skipped"
|
||||
as={Button}
|
||||
aria-expanded={isOpen}
|
||||
aria-label="Open excluded results"
|
||||
>
|
||||
{skippedWithWarningOrError ? (
|
||||
<Icon aria-hidden={true} className="mr-2" svgPath={mdiAlertCircle} />
|
||||
) : (
|
||||
<Icon aria-hidden={true} className="mr-2" svgPath={mdiInformationOutline} />
|
||||
)}
|
||||
<CountContent progressText={progressText} />
|
||||
<Icon aria-hidden={true} data-caret={true} className="mr-0" svgPath={mdiChevronDown} />
|
||||
</PopoverTrigger>
|
||||
<PopoverContent
|
||||
position={Position.bottomStart}
|
||||
className={styles.skippedPopover}
|
||||
data-testid="streaming-progress-skipped-popover"
|
||||
>
|
||||
<StreamingProgressSkippedPopover progress={progress} onSearchAgain={onSearchAgainWithPopupClose} />
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
)
|
||||
}
|
||||
|
||||
@ -8,7 +8,6 @@ import { pluralize, renderMarkdown } from '@sourcegraph/common'
|
||||
import { SyntaxHighlightedSearchQuery } from '@sourcegraph/search-ui'
|
||||
import { Markdown } from '@sourcegraph/shared/src/components/Markdown'
|
||||
import { Skipped } from '@sourcegraph/shared/src/search/stream'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { Button, Collapse, CollapseHeader, CollapsePanel, Icon, Checkbox, H4, Text, H3 } from '@sourcegraph/wildcard'
|
||||
|
||||
import { StreamingProgressProps } from './StreamingProgress'
|
||||
@ -104,8 +103,6 @@ const SkippedMessage: React.FunctionComponent<React.PropsWithChildren<{ skipped:
|
||||
export const StreamingProgressSkippedPopover: React.FunctionComponent<
|
||||
React.PropsWithChildren<Pick<StreamingProgressProps, 'progress' | 'onSearchAgain'>>
|
||||
> = ({ progress, onSearchAgain }) => {
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
|
||||
const [selectedSuggestedSearches, setSelectedSuggestedSearches] = useState(new Set<string>())
|
||||
const submitHandler = useCallback(
|
||||
(event: React.FormEvent) => {
|
||||
@ -132,24 +129,20 @@ export const StreamingProgressSkippedPopover: React.FunctionComponent<
|
||||
|
||||
return (
|
||||
<>
|
||||
{coreWorkflowImprovementsEnabled && (
|
||||
<Text className="mx-3 mt-3">
|
||||
Found {limitHit(progress) ? 'more than ' : ''}
|
||||
{progress.matchCount} {pluralize('result', progress.matchCount)}
|
||||
{progress.repositoriesCount !== undefined
|
||||
? ` from ${progress.repositoriesCount} ${pluralize(
|
||||
'repository',
|
||||
progress.repositoriesCount,
|
||||
'repositories'
|
||||
)}`
|
||||
: ''}
|
||||
.
|
||||
</Text>
|
||||
)}
|
||||
<Text className="mx-3 mt-3">
|
||||
Found {limitHit(progress) ? 'more than ' : ''}
|
||||
{progress.matchCount} {pluralize('result', progress.matchCount)}
|
||||
{progress.repositoriesCount !== undefined
|
||||
? ` from ${progress.repositoriesCount} ${pluralize(
|
||||
'repository',
|
||||
progress.repositoriesCount,
|
||||
'repositories'
|
||||
)}`
|
||||
: ''}
|
||||
.
|
||||
</Text>
|
||||
|
||||
{coreWorkflowImprovementsEnabled && sortedSkippedItems.length > 0 && (
|
||||
<H3 className="mx-3">Some results skipped:</H3>
|
||||
)}
|
||||
{sortedSkippedItems.length > 0 && <H3 className="mx-3">Some results skipped:</H3>}
|
||||
{sortedSkippedItems.map((skipped, index) => (
|
||||
<SkippedMessage
|
||||
key={skipped.reason}
|
||||
|
||||
@ -53,7 +53,7 @@ describe('FilterLink', () => {
|
||||
const filters: Filter[] = [repoFilter1, langFilter1, repoFilter2, langFilter2, fileFilter]
|
||||
const onFilterChosen = sinon.stub()
|
||||
|
||||
const links = getRepoFilterLinks(filters, onFilterChosen, false)
|
||||
const links = getRepoFilterLinks(filters, onFilterChosen)
|
||||
expect(links).toHaveLength(2)
|
||||
expect(renderWithBrandedContext(<>{links}</>).asFragment()).toMatchSnapshot()
|
||||
})
|
||||
@ -62,7 +62,7 @@ describe('FilterLink', () => {
|
||||
const filters: Filter[] = [repoFilter1, langFilter1, repoFilter2, langFilter2, fileFilter]
|
||||
const onFilterChosen = sinon.stub()
|
||||
|
||||
const links = getRepoFilterLinks(filters, onFilterChosen, false)
|
||||
const links = getRepoFilterLinks(filters, onFilterChosen)
|
||||
expect(links).toHaveLength(2)
|
||||
|
||||
const { asFragment } = renderWithBrandedContext(<>{links}</>)
|
||||
@ -75,7 +75,7 @@ describe('FilterLink', () => {
|
||||
const filters: Filter[] = [langFilter1, langFilter2, fileFilter]
|
||||
const onFilterChosen = sinon.stub()
|
||||
|
||||
const links = getRepoFilterLinks(filters, onFilterChosen, false)
|
||||
const links = getRepoFilterLinks(filters, onFilterChosen)
|
||||
expect(links).toHaveLength(0)
|
||||
})
|
||||
|
||||
@ -122,7 +122,7 @@ describe('FilterLink', () => {
|
||||
const filters: Filter[] = [repoFilter1]
|
||||
const onFilterChosen = sinon.spy()
|
||||
|
||||
const links = getRepoFilterLinks(filters, onFilterChosen, false)
|
||||
const links = getRepoFilterLinks(filters, onFilterChosen)
|
||||
renderWithBrandedContext(<>{links}</>)
|
||||
userEvent.click(screen.getByTestId('filter-link'))
|
||||
|
||||
|
||||
@ -66,23 +66,16 @@ export const FilterLink: React.FunctionComponent<React.PropsWithChildren<FilterL
|
||||
|
||||
export const getRepoFilterLinks = (
|
||||
filters: Filter[] | undefined,
|
||||
onFilterChosen: (value: string, kind?: string) => void,
|
||||
coreWorkflowImprovementsEnabled: boolean | undefined
|
||||
onFilterChosen: (value: string, kind?: string) => void
|
||||
): React.ReactElement[] => {
|
||||
function repoLabelConverter(label: string): JSX.Element {
|
||||
const Icon = CodeHostIcon({
|
||||
repoName: label,
|
||||
className: classNames(!coreWorkflowImprovementsEnabled && 'text-muted', styles.sidebarSectionIcon),
|
||||
className: styles.sidebarSectionIcon,
|
||||
})
|
||||
|
||||
return (
|
||||
<span
|
||||
className={classNames(
|
||||
!coreWorkflowImprovementsEnabled && 'text-monospace search-query-link',
|
||||
styles.sidebarSectionListItemBreakWords
|
||||
)}
|
||||
>
|
||||
{!coreWorkflowImprovementsEnabled && <span className="search-filter-keyword">r:</span>}
|
||||
<span className={styles.sidebarSectionListItemBreakWords}>
|
||||
{Icon ? (
|
||||
<>
|
||||
{Icon}
|
||||
|
||||
@ -73,17 +73,11 @@
|
||||
}
|
||||
|
||||
&__list-item-label {
|
||||
:global(.core-workflow-improvements-enabled) & {
|
||||
color: var(--body-color);
|
||||
}
|
||||
color: var(--body-color);
|
||||
}
|
||||
|
||||
&__icon {
|
||||
margin: 0 0.125rem;
|
||||
|
||||
:global(.core-workflow-improvements-enabled) & {
|
||||
margin-left: 0;
|
||||
}
|
||||
margin-right: 0.125rem;
|
||||
}
|
||||
|
||||
&__no-results {
|
||||
|
||||
@ -4,7 +4,6 @@ import classNames from 'classnames'
|
||||
import ChevronDownIcon from 'mdi-react/ChevronDownIcon'
|
||||
import ChevronLeftIcon from 'mdi-react/ChevronLeftIcon'
|
||||
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { Button, Collapse, CollapseHeader, CollapsePanel, Icon, H2, H5, Input } from '@sourcegraph/wildcard'
|
||||
|
||||
import { FilterLink, FilterLinkProps } from './FilterLink'
|
||||
@ -68,7 +67,6 @@ export const SearchFilterSection: FC<SearchFilterSectionProps> = memo(props => {
|
||||
clearSearchOnChange = children,
|
||||
} = props
|
||||
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
const [filter, setFilter] = useState('')
|
||||
|
||||
// Clears the filter whenever clearSearchOnChange changes (defaults to the
|
||||
@ -159,20 +157,11 @@ export const SearchFilterSection: FC<SearchFilterSectionProps> = memo(props => {
|
||||
>
|
||||
{header}
|
||||
</H5>
|
||||
<Icon
|
||||
aria-hidden={true}
|
||||
className={classNames(!coreWorkflowImprovementsEnabled && 'mr-1')}
|
||||
as={isOpened ? ChevronDownIcon : ChevronLeftIcon}
|
||||
/>
|
||||
<Icon aria-hidden={true} as={isOpened ? ChevronDownIcon : ChevronLeftIcon} />
|
||||
</CollapseHeader>
|
||||
|
||||
<CollapsePanel forcedRender={forcedRender}>
|
||||
<div
|
||||
className={classNames(
|
||||
'pb-4',
|
||||
!searchVisible && !coreWorkflowImprovementsEnabled && 'border-top'
|
||||
)}
|
||||
>
|
||||
<div className="pb-4">
|
||||
{searchVisible && (
|
||||
<Input
|
||||
type="search"
|
||||
|
||||
@ -19,12 +19,10 @@
|
||||
}
|
||||
|
||||
.sticky-box {
|
||||
:global(.core-workflow-improvements-enabled) & {
|
||||
background-color: var(--sidebar-bg);
|
||||
border: 1px solid var(--sidebar-border-color);
|
||||
padding: 0.75rem;
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
background-color: var(--sidebar-bg);
|
||||
border: 1px solid var(--sidebar-border-color);
|
||||
padding: 0.75rem;
|
||||
border-radius: var(--border-radius);
|
||||
|
||||
@media (--md-breakpoint-down) {
|
||||
// Sidebar shouldn't be sticky in smaller screens
|
||||
@ -42,18 +40,14 @@
|
||||
}
|
||||
|
||||
.header {
|
||||
display: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin: -0.25rem -0.75rem 0.75rem -0.75rem;
|
||||
padding: 0 0.75rem 0.5rem 0.75rem;
|
||||
border-bottom: 1px solid var(--sidebar-border-color);
|
||||
|
||||
:global(.core-workflow-improvements-enabled) & {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin: -0.25rem -0.75rem 0.75rem -0.75rem;
|
||||
padding: 0 0.75rem 0.5rem 0.75rem;
|
||||
border-bottom: 1px solid var(--sidebar-border-color);
|
||||
|
||||
@media (--md-breakpoint-down) {
|
||||
display: none;
|
||||
}
|
||||
@media (--md-breakpoint-down) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,16 +144,11 @@ exports[`FilterLink should have correct links for repos 1`] = `
|
||||
class="flex-grow-1 sidebarSectionListItemLabel"
|
||||
>
|
||||
<span
|
||||
class="text-monospace search-query-link sidebarSectionListItemBreakWords"
|
||||
class="sidebarSectionListItemBreakWords"
|
||||
>
|
||||
<span
|
||||
class="search-filter-keyword"
|
||||
>
|
||||
r:
|
||||
</span>
|
||||
<svg
|
||||
aria-label="gitlab.com"
|
||||
class="mdi-icon iconInline text-muted sidebarSectionIcon"
|
||||
class="mdi-icon iconInline sidebarSectionIcon"
|
||||
data-state="closed"
|
||||
fill="currentColor"
|
||||
height="24"
|
||||
@ -186,16 +181,11 @@ exports[`FilterLink should have correct links for repos 1`] = `
|
||||
class="flex-grow-1 sidebarSectionListItemLabel"
|
||||
>
|
||||
<span
|
||||
class="text-monospace search-query-link sidebarSectionListItemBreakWords"
|
||||
class="sidebarSectionListItemBreakWords"
|
||||
>
|
||||
<span
|
||||
class="search-filter-keyword"
|
||||
>
|
||||
r:
|
||||
</span>
|
||||
<svg
|
||||
aria-label="github.com"
|
||||
class="mdi-icon iconInline text-muted sidebarSectionIcon"
|
||||
class="mdi-icon iconInline sidebarSectionIcon"
|
||||
data-state="closed"
|
||||
fill="currentColor"
|
||||
height="24"
|
||||
@ -264,16 +254,11 @@ exports[`FilterLink should have show icons for repos on cloud 1`] = `
|
||||
class="flex-grow-1 sidebarSectionListItemLabel"
|
||||
>
|
||||
<span
|
||||
class="text-monospace search-query-link sidebarSectionListItemBreakWords"
|
||||
class="sidebarSectionListItemBreakWords"
|
||||
>
|
||||
<span
|
||||
class="search-filter-keyword"
|
||||
>
|
||||
r:
|
||||
</span>
|
||||
<svg
|
||||
aria-label="gitlab.com"
|
||||
class="mdi-icon iconInline text-muted sidebarSectionIcon"
|
||||
class="mdi-icon iconInline sidebarSectionIcon"
|
||||
data-state="closed"
|
||||
fill="currentColor"
|
||||
height="24"
|
||||
@ -306,16 +291,11 @@ exports[`FilterLink should have show icons for repos on cloud 1`] = `
|
||||
class="flex-grow-1 sidebarSectionListItemLabel"
|
||||
>
|
||||
<span
|
||||
class="text-monospace search-query-link sidebarSectionListItemBreakWords"
|
||||
class="sidebarSectionListItemBreakWords"
|
||||
>
|
||||
<span
|
||||
class="search-filter-keyword"
|
||||
>
|
||||
r:
|
||||
</span>
|
||||
<svg
|
||||
aria-label="github.com"
|
||||
class="mdi-icon iconInline text-muted sidebarSectionIcon"
|
||||
class="mdi-icon iconInline sidebarSectionIcon"
|
||||
data-state="closed"
|
||||
fill="currentColor"
|
||||
height="24"
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
import React, { createContext } from 'react'
|
||||
|
||||
import { noop } from 'lodash'
|
||||
|
||||
import { useTemporarySetting, UseTemporarySettingsReturnType } from './temporary/useTemporarySetting'
|
||||
|
||||
// The `coreWorkflowImprovements.enabled` temporary setting guards a lot of UI changes. To prevent flashes of the old UI
|
||||
// we have to share the evaluated temporary setting value between components through the context.
|
||||
// Otherwise, each component would evaluate `useTemporarySetting` on their own leading to UI jitter while the
|
||||
// temporary setting was "loading".
|
||||
export const CoreWorkflowImprovementsEnabledContext = createContext<
|
||||
UseTemporarySettingsReturnType<'coreWorkflowImprovements.enabled_deprecated'>
|
||||
>([true, noop, 'initial'])
|
||||
CoreWorkflowImprovementsEnabledContext.displayName = 'CoreWorkflowImprovementsContext'
|
||||
|
||||
export const CoreWorkflowImprovementsEnabledProvider: React.FunctionComponent<React.PropsWithChildren<{}>> = ({
|
||||
children,
|
||||
}) => {
|
||||
const coreWorkflowImprovementsEnabled = useTemporarySetting('coreWorkflowImprovements.enabled_deprecated', true)
|
||||
|
||||
return (
|
||||
<CoreWorkflowImprovementsEnabledContext.Provider value={coreWorkflowImprovementsEnabled}>
|
||||
{children}
|
||||
</CoreWorkflowImprovementsEnabledContext.Provider>
|
||||
)
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
import { useContext } from 'react'
|
||||
|
||||
import { CoreWorkflowImprovementsEnabledContext } from './CoreWorkflowImprovementsEnabledProvider'
|
||||
import { UseTemporarySettingsReturnType } from './temporary/useTemporarySetting'
|
||||
|
||||
export function useCoreWorkflowImprovementsEnabled(): UseTemporarySettingsReturnType<'coreWorkflowImprovements.enabled_deprecated'> {
|
||||
return useContext(CoreWorkflowImprovementsEnabledContext)
|
||||
}
|
||||
@ -59,11 +59,6 @@ if (!document.body.classList.contains('theme-dark')) {
|
||||
document.body.classList.add('theme-light')
|
||||
}
|
||||
|
||||
// Always add class for coreWorkflowImprovements.enabled in Chromatic
|
||||
if (!document.body.classList.contains('core-workflow-improvements-enabled')) {
|
||||
document.body.classList.add('core-workflow-improvements-enabled')
|
||||
}
|
||||
|
||||
if (isChromatic()) {
|
||||
const style = document.createElement('style')
|
||||
style.innerHTML = `
|
||||
|
||||
@ -175,7 +175,7 @@ export const SearchSidebarView: React.FunctionComponent<React.PropsWithChildren<
|
||||
minItems={1}
|
||||
noResultText={getRepoFilterNoResultText}
|
||||
>
|
||||
{getRepoFilterLinks(repoFilters, onDynamicFilterClicked, false)}
|
||||
{getRepoFilterLinks(repoFilters, onDynamicFilterClicked)}
|
||||
</SearchSidebarSection>
|
||||
|
||||
<SearchSidebarSection
|
||||
|
||||
@ -16,7 +16,6 @@ import { Shortcut } from '@sourcegraph/shared/src/react-shortcuts'
|
||||
import * as GQL from '@sourcegraph/shared/src/schema'
|
||||
import { Settings } from '@sourcegraph/shared/src/schema/settings.schema'
|
||||
import { SettingsCascadeProps } from '@sourcegraph/shared/src/settings/settings'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
|
||||
import { parseQueryAndHash } from '@sourcegraph/shared/src/util/url'
|
||||
import { LoadingSpinner, Panel, useObservable } from '@sourcegraph/wildcard'
|
||||
@ -159,7 +158,6 @@ export const Layout: React.FunctionComponent<React.PropsWithChildren<LayoutProps
|
||||
|
||||
const themeProps = useThemeProps()
|
||||
const [enableContrastCompliantSyntaxHighlighting] = useFeatureFlag('contrast-compliant-syntax-highlighting')
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
|
||||
const breadcrumbProps = useBreadcrumbs()
|
||||
|
||||
@ -203,8 +201,7 @@ export const Layout: React.FunctionComponent<React.PropsWithChildren<LayoutProps
|
||||
<div
|
||||
className={classNames(
|
||||
styles.layout,
|
||||
enableContrastCompliantSyntaxHighlighting && CONTRAST_COMPLIANT_CLASSNAME,
|
||||
coreWorkflowImprovementsEnabled && 'core-workflow-improvements-enabled'
|
||||
enableContrastCompliantSyntaxHighlighting && CONTRAST_COMPLIANT_CLASSNAME
|
||||
)}
|
||||
>
|
||||
{showHelpShortcut?.keybindings.map((keybinding, index) => (
|
||||
|
||||
@ -43,7 +43,6 @@ import { ShortcutProvider } from '@sourcegraph/shared/src/react-shortcuts'
|
||||
import { FilterType } from '@sourcegraph/shared/src/search/query/filters'
|
||||
import { filterExists } from '@sourcegraph/shared/src/search/query/validate'
|
||||
import { aggregateStreamingSearch } from '@sourcegraph/shared/src/search/stream'
|
||||
import { CoreWorkflowImprovementsEnabledProvider } from '@sourcegraph/shared/src/settings/CoreWorkflowImprovementsEnabledProvider'
|
||||
import { EMPTY_SETTINGS_CASCADE, SettingsCascadeProps } from '@sourcegraph/shared/src/settings/settings'
|
||||
import { TemporarySettingsProvider } from '@sourcegraph/shared/src/settings/temporary/TemporarySettingsProvider'
|
||||
import { TemporarySettingsStorage } from '@sourcegraph/shared/src/settings/temporary/TemporarySettingsStorage'
|
||||
@ -378,94 +377,85 @@ export class SourcegraphWebApp extends React.Component<
|
||||
<FeatureFlagsProvider>
|
||||
<ShortcutProvider>
|
||||
<TemporarySettingsProvider temporarySettingsStorage={temporarySettingsStorage}>
|
||||
<CoreWorkflowImprovementsEnabledProvider>
|
||||
<SearchResultsCacheProvider>
|
||||
<SearchQueryStateStoreProvider useSearchQueryState={useNavbarQueryState}>
|
||||
<Router history={history} key={0}>
|
||||
<CompatRouter>
|
||||
<Route
|
||||
path="/"
|
||||
render={routeComponentProps => (
|
||||
<CodeHostScopeProvider
|
||||
<SearchResultsCacheProvider>
|
||||
<SearchQueryStateStoreProvider useSearchQueryState={useNavbarQueryState}>
|
||||
<Router history={history} key={0}>
|
||||
<CompatRouter>
|
||||
<Route
|
||||
path="/"
|
||||
render={routeComponentProps => (
|
||||
<CodeHostScopeProvider
|
||||
authenticatedUser={authenticatedUser}
|
||||
>
|
||||
<LayoutWithActivation
|
||||
{...props}
|
||||
{...routeComponentProps}
|
||||
authenticatedUser={authenticatedUser}
|
||||
>
|
||||
<LayoutWithActivation
|
||||
{...props}
|
||||
{...routeComponentProps}
|
||||
authenticatedUser={authenticatedUser}
|
||||
viewerSubject={this.state.viewerSubject}
|
||||
settingsCascade={this.state.settingsCascade}
|
||||
batchChangesEnabled={
|
||||
this.props.batchChangesEnabled
|
||||
}
|
||||
batchChangesExecutionEnabled={isBatchChangesExecutionEnabled(
|
||||
this.state.settingsCascade
|
||||
)}
|
||||
batchChangesWebhookLogsEnabled={
|
||||
window.context
|
||||
.batchChangesWebhookLogsEnabled
|
||||
}
|
||||
// Search query
|
||||
fetchHighlightedFileLineRanges={
|
||||
this.fetchHighlightedFileLineRanges
|
||||
}
|
||||
// Extensions
|
||||
platformContext={this.platformContext}
|
||||
extensionsController={this.extensionsController}
|
||||
telemetryService={eventLogger}
|
||||
isSourcegraphDotCom={
|
||||
window.context.sourcegraphDotComMode
|
||||
}
|
||||
searchContextsEnabled={
|
||||
this.props.searchContextsEnabled
|
||||
}
|
||||
selectedSearchContextSpec={this.getSelectedSearchContextSpec()}
|
||||
setSelectedSearchContextSpec={
|
||||
this.setSelectedSearchContextSpec
|
||||
}
|
||||
getUserSearchContextNamespaces={
|
||||
getUserSearchContextNamespaces
|
||||
}
|
||||
fetchAutoDefinedSearchContexts={
|
||||
fetchAutoDefinedSearchContexts
|
||||
}
|
||||
fetchSearchContexts={fetchSearchContexts}
|
||||
fetchSearchContextBySpec={
|
||||
fetchSearchContextBySpec
|
||||
}
|
||||
fetchSearchContext={fetchSearchContext}
|
||||
createSearchContext={createSearchContext}
|
||||
updateSearchContext={updateSearchContext}
|
||||
deleteSearchContext={deleteSearchContext}
|
||||
isSearchContextSpecAvailable={
|
||||
isSearchContextSpecAvailable
|
||||
}
|
||||
defaultSearchContextSpec={
|
||||
this.state.defaultSearchContextSpec
|
||||
}
|
||||
globbing={this.state.globbing}
|
||||
streamSearch={aggregateStreamingSearch}
|
||||
onCreateNotebookFromNotepad={
|
||||
this.onCreateNotebook
|
||||
}
|
||||
/>
|
||||
</CodeHostScopeProvider>
|
||||
)}
|
||||
/>
|
||||
</CompatRouter>
|
||||
</Router>
|
||||
{this.extensionsController !== null &&
|
||||
window.context.enableLegacyExtensions ? (
|
||||
<Notifications
|
||||
key={2}
|
||||
extensionsController={this.extensionsController}
|
||||
notificationItemStyleProps={notificationStyles}
|
||||
viewerSubject={this.state.viewerSubject}
|
||||
settingsCascade={this.state.settingsCascade}
|
||||
batchChangesEnabled={this.props.batchChangesEnabled}
|
||||
batchChangesExecutionEnabled={isBatchChangesExecutionEnabled(
|
||||
this.state.settingsCascade
|
||||
)}
|
||||
batchChangesWebhookLogsEnabled={
|
||||
window.context.batchChangesWebhookLogsEnabled
|
||||
}
|
||||
// Search query
|
||||
fetchHighlightedFileLineRanges={
|
||||
this.fetchHighlightedFileLineRanges
|
||||
}
|
||||
// Extensions
|
||||
platformContext={this.platformContext}
|
||||
extensionsController={this.extensionsController}
|
||||
telemetryService={eventLogger}
|
||||
isSourcegraphDotCom={
|
||||
window.context.sourcegraphDotComMode
|
||||
}
|
||||
searchContextsEnabled={
|
||||
this.props.searchContextsEnabled
|
||||
}
|
||||
selectedSearchContextSpec={this.getSelectedSearchContextSpec()}
|
||||
setSelectedSearchContextSpec={
|
||||
this.setSelectedSearchContextSpec
|
||||
}
|
||||
getUserSearchContextNamespaces={
|
||||
getUserSearchContextNamespaces
|
||||
}
|
||||
fetchAutoDefinedSearchContexts={
|
||||
fetchAutoDefinedSearchContexts
|
||||
}
|
||||
fetchSearchContexts={fetchSearchContexts}
|
||||
fetchSearchContextBySpec={fetchSearchContextBySpec}
|
||||
fetchSearchContext={fetchSearchContext}
|
||||
createSearchContext={createSearchContext}
|
||||
updateSearchContext={updateSearchContext}
|
||||
deleteSearchContext={deleteSearchContext}
|
||||
isSearchContextSpecAvailable={
|
||||
isSearchContextSpecAvailable
|
||||
}
|
||||
defaultSearchContextSpec={
|
||||
this.state.defaultSearchContextSpec
|
||||
}
|
||||
globbing={this.state.globbing}
|
||||
streamSearch={aggregateStreamingSearch}
|
||||
onCreateNotebookFromNotepad={this.onCreateNotebook}
|
||||
/>
|
||||
</CodeHostScopeProvider>
|
||||
)}
|
||||
/>
|
||||
) : null}
|
||||
<UserSessionStores />
|
||||
</SearchQueryStateStoreProvider>
|
||||
</SearchResultsCacheProvider>
|
||||
</CoreWorkflowImprovementsEnabledProvider>
|
||||
</CompatRouter>
|
||||
</Router>
|
||||
{this.extensionsController !== null &&
|
||||
window.context.enableLegacyExtensions ? (
|
||||
<Notifications
|
||||
key={2}
|
||||
extensionsController={this.extensionsController}
|
||||
notificationItemStyleProps={notificationStyles}
|
||||
/>
|
||||
) : null}
|
||||
<UserSessionStores />
|
||||
</SearchQueryStateStoreProvider>
|
||||
</SearchResultsCacheProvider>
|
||||
</TemporarySettingsProvider>
|
||||
</ShortcutProvider>
|
||||
</FeatureFlagsProvider>
|
||||
|
||||
@ -8,7 +8,6 @@ import { QueryState } from '@sourcegraph/search'
|
||||
import { LazyMonacoQueryInput } from '@sourcegraph/search-ui'
|
||||
import { FilterType, resolveFilter, validateFilter } from '@sourcegraph/shared/src/search/query/filters'
|
||||
import { scanSearchQuery } from '@sourcegraph/shared/src/search/query/scanner'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { ThemeProps } from '@sourcegraph/shared/src/theme'
|
||||
import { buildSearchURLQuery } from '@sourcegraph/shared/src/util/url'
|
||||
import { Button, Link, Card, Icon, Checkbox, Code, H3, Tooltip } from '@sourcegraph/wildcard'
|
||||
@ -129,10 +128,8 @@ export const FormTriggerArea: React.FunctionComponent<React.PropsWithChildren<Tr
|
||||
const [queryState, setQueryState] = useState<QueryState>({ query: query || '' })
|
||||
|
||||
const editorComponent = useExperimentalFeatures(features => features.editor ?? 'codemirror6')
|
||||
const [enableCoreWorkflowImprovements] = useCoreWorkflowImprovementsEnabled()
|
||||
const applySuggestionsOnEnter =
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ??
|
||||
enableCoreWorkflowImprovements
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ?? true
|
||||
|
||||
useEffect(() => {
|
||||
const value = queryState.query
|
||||
|
||||
@ -7,7 +7,6 @@ import * as Monaco from 'monaco-editor'
|
||||
import { QueryChangeSource } from '@sourcegraph/search'
|
||||
import { LazyMonacoQueryInput, DEFAULT_MONACO_OPTIONS } from '@sourcegraph/search-ui'
|
||||
import { SearchPatternType } from '@sourcegraph/shared/src/graphql-operations'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { ForwardReferenceComponent } from '@sourcegraph/wildcard'
|
||||
|
||||
import { useExperimentalFeatures } from '../../../../../stores'
|
||||
@ -85,10 +84,8 @@ export const MonacoField = forwardRef<HTMLInputElement, MonacoFieldProps>((props
|
||||
|
||||
const { enhancedThemePreference } = useTheme()
|
||||
const editorComponent = useExperimentalFeatures(features => features.editor ?? 'codemirror6')
|
||||
const [enableCoreWorkflowImprovements] = useCoreWorkflowImprovementsEnabled()
|
||||
const applySuggestionsOnEnter =
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ??
|
||||
enableCoreWorkflowImprovements
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ?? true
|
||||
const monacoOptions = useMemo(() => ({ ...MONACO_OPTIONS, readOnly: disabled }), [disabled])
|
||||
|
||||
return (
|
||||
|
||||
@ -17,7 +17,6 @@ import {
|
||||
} from '@sourcegraph/shared/src/graphql-operations'
|
||||
import { PlatformContextProps } from '@sourcegraph/shared/src/platform/context'
|
||||
import { ISearchContext, ISearchContextRepositoryRevisionsInput } from '@sourcegraph/shared/src/schema'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
|
||||
import { ThemeProps } from '@sourcegraph/shared/src/theme'
|
||||
import {
|
||||
@ -153,10 +152,8 @@ export const SearchContextForm: React.FunctionComponent<React.PropsWithChildren<
|
||||
} = props
|
||||
const history = useHistory()
|
||||
const editorComponent = useExperimentalFeatures(features => features.editor ?? 'codemirror6')
|
||||
const [enableCoreWorkflowImprovements] = useCoreWorkflowImprovementsEnabled()
|
||||
const applySuggestionsOnEnter =
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ??
|
||||
enableCoreWorkflowImprovements
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ?? true
|
||||
|
||||
const [name, setName] = useState(searchContext ? searchContext.name : '')
|
||||
const [description, setDescription] = useState(searchContext ? searchContext.description : '')
|
||||
|
||||
@ -9,7 +9,6 @@ import { createDefaultSuggestions } from '@sourcegraph/search-ui'
|
||||
import { IHighlightLineRange } from '@sourcegraph/shared/src/schema'
|
||||
import { PathMatch } from '@sourcegraph/shared/src/search/stream'
|
||||
import { fetchStreamSuggestions } from '@sourcegraph/shared/src/search/suggestions'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { ThemeProps } from '@sourcegraph/shared/src/theme'
|
||||
import { Icon, Button, Input, InputStatus } from '@sourcegraph/wildcard'
|
||||
|
||||
@ -49,10 +48,8 @@ const editorAttributes = [
|
||||
export const NotebookFileBlockInputs: React.FunctionComponent<
|
||||
React.PropsWithChildren<NotebookFileBlockInputsProps>
|
||||
> = ({ id, lineRange, onFileSelected, onLineRangeChange, globbing, isSourcegraphDotCom, ...inputProps }) => {
|
||||
const [enableCoreWorkflowImprovements] = useCoreWorkflowImprovementsEnabled()
|
||||
const applySuggestionsOnEnter =
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ??
|
||||
enableCoreWorkflowImprovements
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ?? true
|
||||
|
||||
const [lineRangeInput, setLineRangeInput] = useState(serializeLineRange(lineRange))
|
||||
const debouncedOnLineRangeChange = useMemo(() => debounce(onLineRangeChange, 300), [onLineRangeChange])
|
||||
|
||||
@ -23,7 +23,6 @@ import { PlatformContextProps } from '@sourcegraph/shared/src/platform/context'
|
||||
import { SearchPatternType } from '@sourcegraph/shared/src/schema'
|
||||
import { fetchStreamSuggestions } from '@sourcegraph/shared/src/search/suggestions'
|
||||
import { SettingsCascadeProps } from '@sourcegraph/shared/src/settings/settings'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
|
||||
import { ThemeProps } from '@sourcegraph/shared/src/theme'
|
||||
import { buildSearchURLQuery } from '@sourcegraph/shared/src/util/url'
|
||||
@ -88,10 +87,8 @@ export const NotebookQueryBlock: React.FunctionComponent<React.PropsWithChildren
|
||||
const [editor, setEditor] = useState<EditorView>()
|
||||
const searchResults = useObservable(output ?? of(undefined))
|
||||
const [executedQuery, setExecutedQuery] = useState<string>(input.query)
|
||||
const [enableCoreWorkflowImprovements] = useCoreWorkflowImprovementsEnabled()
|
||||
const applySuggestionsOnEnter =
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ??
|
||||
enableCoreWorkflowImprovements
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ?? true
|
||||
|
||||
const onInputChange = useCallback(
|
||||
(query: string) => onBlockInputChange(id, { type: 'query', input: { query } }),
|
||||
|
||||
@ -5,7 +5,6 @@ import { EditorView } from '@codemirror/view'
|
||||
import { createDefaultSuggestions, RepoFileLink } from '@sourcegraph/search-ui'
|
||||
import { getFileMatchUrl, getRepositoryUrl, SymbolMatch } from '@sourcegraph/shared/src/search/stream'
|
||||
import { fetchStreamSuggestions } from '@sourcegraph/shared/src/search/suggestions'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { SymbolIcon } from '@sourcegraph/shared/src/symbols/SymbolIcon'
|
||||
import { ThemeProps } from '@sourcegraph/shared/src/theme'
|
||||
import { Button, Code } from '@sourcegraph/wildcard'
|
||||
@ -43,10 +42,8 @@ const editorAttributes = [
|
||||
export const NotebookSymbolBlockInput: React.FunctionComponent<
|
||||
React.PropsWithChildren<NotebookSymbolBlockInputProps>
|
||||
> = ({ onSymbolSelected, isSourcegraphDotCom, globbing, ...inputProps }) => {
|
||||
const [enableCoreWorkflowImprovements] = useCoreWorkflowImprovementsEnabled()
|
||||
const applySuggestionsOnEnter =
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ??
|
||||
enableCoreWorkflowImprovements
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ?? true
|
||||
|
||||
const fetchSymbolSuggestions = useCallback(
|
||||
(query: string) =>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useMemo, useState } from 'react'
|
||||
|
||||
import { mdiSourceRepository, mdiChevronDown } from '@mdi/js'
|
||||
import { mdiSourceRepository } from '@mdi/js'
|
||||
import classNames from 'classnames'
|
||||
import * as H from 'history'
|
||||
import { escapeRegExp } from 'lodash'
|
||||
@ -20,21 +20,10 @@ import { PlatformContextProps } from '@sourcegraph/shared/src/platform/context'
|
||||
import { Settings } from '@sourcegraph/shared/src/schema/settings.schema'
|
||||
import { escapeSpaces } from '@sourcegraph/shared/src/search/query/filters'
|
||||
import { SettingsCascadeProps } from '@sourcegraph/shared/src/settings/settings'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
|
||||
import { ThemeProps } from '@sourcegraph/shared/src/theme'
|
||||
import { makeRepoURI } from '@sourcegraph/shared/src/util/url'
|
||||
import {
|
||||
Icon,
|
||||
Button,
|
||||
ButtonGroup,
|
||||
useObservable,
|
||||
Link,
|
||||
Popover,
|
||||
PopoverContent,
|
||||
Position,
|
||||
PopoverTrigger,
|
||||
} from '@sourcegraph/wildcard'
|
||||
import { Icon, Button, useObservable, Link } from '@sourcegraph/wildcard'
|
||||
|
||||
import { AuthenticatedUser } from '../auth'
|
||||
import { BatchChangesProps } from '../batches'
|
||||
@ -60,7 +49,6 @@ import {
|
||||
RepoRevisionContainerContext,
|
||||
RepoRevisionContainerRoute,
|
||||
} from './RepoRevisionContainer'
|
||||
import { RepositoriesPopover } from './RepositoriesPopover'
|
||||
import { commitsPath, compareSpecPath } from './routes'
|
||||
import { RepoSettingsAreaRoute } from './settings/RepoSettingsArea'
|
||||
import { RepoSettingsSideBarGroup } from './settings/RepoSettingsSidebar'
|
||||
@ -154,14 +142,12 @@ export interface HoverThresholdProps {
|
||||
* Renders a horizontal bar and content for a repository page.
|
||||
*/
|
||||
export const RepoContainer: React.FunctionComponent<React.PropsWithChildren<RepoContainerProps>> = props => {
|
||||
const { extensionsController, telemetryService, globbing } = props
|
||||
const { extensionsController, globbing } = props
|
||||
|
||||
const { repoName, revision, rawRevision, filePath, commitRange, position, range } = parseBrowserRepoURL(
|
||||
location.pathname + location.search + location.hash
|
||||
)
|
||||
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
|
||||
const resolvedRevisionOrError = useObservable(
|
||||
useMemo(
|
||||
() =>
|
||||
@ -237,34 +223,9 @@ export const RepoContainer: React.FunctionComponent<React.PropsWithChildren<Repo
|
||||
|
||||
return {
|
||||
key: 'repository',
|
||||
element: coreWorkflowImprovementsEnabled ? (
|
||||
button // Don't show the repo dropdown if core workflow improvements are enabled
|
||||
) : (
|
||||
<Popover>
|
||||
<ButtonGroup className="d-inline-flex">
|
||||
{button}
|
||||
<PopoverTrigger
|
||||
as={Button}
|
||||
className={styles.repoChange}
|
||||
aria-label="Change repository"
|
||||
outline={true}
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
>
|
||||
<Icon aria-hidden={true} svgPath={mdiChevronDown} />
|
||||
</PopoverTrigger>
|
||||
</ButtonGroup>
|
||||
<PopoverContent
|
||||
position={Position.bottomStart}
|
||||
className="pt-0 pb-0"
|
||||
aria-label="Change repository"
|
||||
>
|
||||
<RepositoriesPopover currentRepo={repoOrError?.id} telemetryService={telemetryService} />
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
),
|
||||
element: button,
|
||||
}
|
||||
}, [resolvedRevisionOrError, repoOrError, coreWorkflowImprovementsEnabled, telemetryService, repoName])
|
||||
}, [resolvedRevisionOrError, repoOrError, repoName])
|
||||
)
|
||||
|
||||
// Update the workspace roots service to reflect the current repo / resolved revision
|
||||
|
||||
@ -18,7 +18,6 @@ import { transformSearchQuery } from '@sourcegraph/shared/src/api/client/search'
|
||||
import { ExtensionsControllerProps } from '@sourcegraph/shared/src/extensions/controller'
|
||||
import { LATEST_VERSION } from '@sourcegraph/shared/src/search/stream'
|
||||
import { fetchStreamSuggestions } from '@sourcegraph/shared/src/search/suggestions'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { LoadingSpinner, Button, useObservable } from '@sourcegraph/wildcard'
|
||||
|
||||
import { PageTitle } from '../components/PageTitle'
|
||||
@ -50,10 +49,8 @@ export const SearchConsolePage: React.FunctionComponent<React.PropsWithChildren<
|
||||
const enableGoImportsSearchQueryTransform = useExperimentalFeatures(
|
||||
features => features.enableGoImportsSearchQueryTransform
|
||||
)
|
||||
const [enableCoreWorkflowImprovements] = useCoreWorkflowImprovementsEnabled()
|
||||
const applySuggestionsOnEnter =
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ??
|
||||
enableCoreWorkflowImprovements
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ?? true
|
||||
|
||||
const searchQuery = useMemo(() => new BehaviorSubject<string>(parseSearchURLQuery(props.location.search) ?? ''), [
|
||||
props.location.search,
|
||||
|
||||
@ -19,24 +19,16 @@
|
||||
}
|
||||
|
||||
.search-container {
|
||||
position: relative;
|
||||
flex: 1 1 auto;
|
||||
margin-top: 2.5rem;
|
||||
width: 100%;
|
||||
flex-grow: 0;
|
||||
margin-top: 2.5rem;
|
||||
margin-bottom: 2.25rem;
|
||||
|
||||
@media (--xl-breakpoint-up) {
|
||||
max-width: var(--max-homepage-container-width);
|
||||
}
|
||||
|
||||
position: relative;
|
||||
|
||||
&--with-content-below {
|
||||
flex-grow: 0;
|
||||
margin-bottom: 5rem;
|
||||
|
||||
:global(.core-workflow-improvements-enabled) & {
|
||||
margin-bottom: 2.25rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.panels-container {
|
||||
|
||||
@ -9,7 +9,6 @@ import { ExtensionsControllerProps } from '@sourcegraph/shared/src/extensions/co
|
||||
import { PlatformContextProps } from '@sourcegraph/shared/src/platform/context'
|
||||
import { Settings } from '@sourcegraph/shared/src/schema/settings.schema'
|
||||
import { SettingsCascadeProps } from '@sourcegraph/shared/src/settings/settings'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
|
||||
import { ThemeProps } from '@sourcegraph/shared/src/theme'
|
||||
|
||||
@ -56,7 +55,6 @@ export const SearchPage: React.FunctionComponent<React.PropsWithChildren<SearchP
|
||||
const showEnterpriseHomePanels = useExperimentalFeatures(features => features.showEnterpriseHomePanels ?? false)
|
||||
const homepageUserInvitation = useExperimentalFeatures(features => features.homepageUserInvitation) ?? false
|
||||
const showCollaborators = window.context.allowSignup && homepageUserInvitation && props.isSourcegraphDotCom
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
|
||||
/** The value entered by the user in the query input */
|
||||
const [queryState, setQueryState] = useState<QueryState>({
|
||||
@ -71,12 +69,7 @@ export const SearchPage: React.FunctionComponent<React.PropsWithChildren<SearchP
|
||||
{props.isSourcegraphDotCom && (
|
||||
<div className="text-muted text-center mt-3">Search millions of open source repositories</div>
|
||||
)}
|
||||
<div
|
||||
className={classNames(styles.searchContainer, {
|
||||
[styles.searchContainerWithContentBelow]:
|
||||
props.isSourcegraphDotCom || showEnterpriseHomePanels || coreWorkflowImprovementsEnabled,
|
||||
})}
|
||||
>
|
||||
<div className={styles.searchContainer}>
|
||||
<SearchPageInput {...props} queryState={queryState} setQueryState={setQueryState} source="home" />
|
||||
</div>
|
||||
<div
|
||||
@ -90,7 +83,7 @@ export const SearchPage: React.FunctionComponent<React.PropsWithChildren<SearchP
|
||||
<HomePanels showCollaborators={showCollaborators} {...props} />
|
||||
)}
|
||||
|
||||
{coreWorkflowImprovementsEnabled && !showEnterpriseHomePanels && !props.isSourcegraphDotCom && (
|
||||
{!showEnterpriseHomePanels && !props.isSourcegraphDotCom && (
|
||||
<QueryExamplesHomepage
|
||||
telemetryService={props.telemetryService}
|
||||
queryState={queryState}
|
||||
|
||||
@ -17,8 +17,7 @@ import { SearchBox } from '@sourcegraph/search-ui'
|
||||
import { ActivationProps } from '@sourcegraph/shared/src/components/activation/Activation'
|
||||
import { PlatformContextProps } from '@sourcegraph/shared/src/platform/context'
|
||||
import { Settings } from '@sourcegraph/shared/src/schema/settings.schema'
|
||||
import { SettingsCascadeProps, isSettingsValid } from '@sourcegraph/shared/src/settings/settings'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { SettingsCascadeProps } from '@sourcegraph/shared/src/settings/settings'
|
||||
import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
|
||||
import { ThemeProps } from '@sourcegraph/shared/src/theme'
|
||||
|
||||
@ -34,7 +33,6 @@ import {
|
||||
import { ThemePreferenceProps } from '../../theme'
|
||||
import { submitSearch } from '../helpers'
|
||||
import { searchQueryHistorySource } from '../input/completion'
|
||||
import { QuickLinks } from '../QuickLinks'
|
||||
|
||||
import styles from './SearchPageInput.module.scss'
|
||||
|
||||
@ -72,15 +70,13 @@ export const SearchPageInput: React.FunctionComponent<React.PropsWithChildren<Pr
|
||||
features => features.showSearchContextManagement ?? false
|
||||
)
|
||||
const editorComponent = useExperimentalFeatures(features => features.editor ?? 'codemirror6')
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
const applySuggestionsOnEnter =
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ??
|
||||
coreWorkflowImprovementsEnabled
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ?? true
|
||||
const [showSearchHistory] = useFeatureFlag('search-input-show-history')
|
||||
|
||||
const suggestionSources = useMemo(
|
||||
() =>
|
||||
coreWorkflowImprovementsEnabled && props.authenticatedUser && showSearchHistory
|
||||
props.authenticatedUser && showSearchHistory
|
||||
? [
|
||||
searchQueryHistorySource({
|
||||
userId: props.authenticatedUser.id,
|
||||
@ -94,18 +90,9 @@ export const SearchPageInput: React.FunctionComponent<React.PropsWithChildren<Pr
|
||||
}),
|
||||
]
|
||||
: [],
|
||||
[
|
||||
coreWorkflowImprovementsEnabled,
|
||||
props.authenticatedUser,
|
||||
props.selectedSearchContextSpec,
|
||||
props.telemetryService,
|
||||
showSearchHistory,
|
||||
]
|
||||
[props.authenticatedUser, props.selectedSearchContextSpec, props.telemetryService, showSearchHistory]
|
||||
)
|
||||
|
||||
const quickLinks =
|
||||
(isSettingsValid<Settings>(props.settingsCascade) && props.settingsCascade.final.quicklinks) || []
|
||||
|
||||
const submitSearchOnChange = useCallback(
|
||||
(parameters: Partial<SubmitSearchParameters> = {}) => {
|
||||
const query = props.queryState.query
|
||||
@ -170,13 +157,10 @@ export const SearchPageInput: React.FunctionComponent<React.PropsWithChildren<Pr
|
||||
structuralSearchDisabled={window.context?.experimentalFeatures?.structuralSearch === 'disabled'}
|
||||
applySuggestionsOnEnter={applySuggestionsOnEnter}
|
||||
suggestionSources={suggestionSources}
|
||||
defaultSuggestionsShowWhenEmpty={!coreWorkflowImprovementsEnabled}
|
||||
showSuggestionsOnFocus={coreWorkflowImprovementsEnabled}
|
||||
defaultSuggestionsShowWhenEmpty={false}
|
||||
showSuggestionsOnFocus={true}
|
||||
/>
|
||||
</div>
|
||||
{!coreWorkflowImprovementsEnabled && (
|
||||
<QuickLinks quickLinks={quickLinks} className={styles.inputSubContainer} />
|
||||
)}
|
||||
<Notices className="my-3" location="home" settingsCascade={props.settingsCascade} />
|
||||
</Form>
|
||||
</div>
|
||||
|
||||
@ -9,7 +9,6 @@ import { SearchBox } from '@sourcegraph/search-ui'
|
||||
import { ActivationProps } from '@sourcegraph/shared/src/components/activation/Activation'
|
||||
import { PlatformContextProps } from '@sourcegraph/shared/src/platform/context'
|
||||
import { SettingsCascadeProps } from '@sourcegraph/shared/src/settings/settings'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
|
||||
import { ThemeProps } from '@sourcegraph/shared/src/theme'
|
||||
|
||||
@ -62,10 +61,8 @@ export const SearchNavbarItem: React.FunctionComponent<React.PropsWithChildren<P
|
||||
features => features.showSearchContextManagement ?? false
|
||||
)
|
||||
const editorComponent = useExperimentalFeatures(features => features.editor ?? 'codemirror6')
|
||||
const [enableCoreWorkflowImprovements] = useCoreWorkflowImprovementsEnabled()
|
||||
const applySuggestionsOnEnter =
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ??
|
||||
enableCoreWorkflowImprovements
|
||||
useExperimentalFeatures(features => features.applySearchQuerySuggestionOnEnter) ?? true
|
||||
|
||||
const submitSearchOnChange = useCallback(
|
||||
(parameters: Partial<SubmitSearchParameters> = {}) => {
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
.container {
|
||||
width: 31rem;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin-bottom: 0.25rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.copy-text {
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.icon {
|
||||
// stylelint-disable-next-line declaration-property-unit-allowed-list
|
||||
padding: 15px;
|
||||
border-radius: var(--border-radius);
|
||||
border: 1px solid var(--border-color);
|
||||
color: var(--merged-3);
|
||||
|
||||
svg {
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
}
|
||||
@ -1,85 +0,0 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
|
||||
import classNames from 'classnames'
|
||||
|
||||
import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
|
||||
import { buildGetStartedURL } from '@sourcegraph/shared/src/util/url'
|
||||
import { Button, Position, Popover, PopoverTrigger, PopoverContent, ButtonLink } from '@sourcegraph/wildcard'
|
||||
|
||||
import { CloudSignUpSource } from '../../auth/CloudSignUpPage'
|
||||
|
||||
import styles from './ButtonDropdownCta.module.scss'
|
||||
|
||||
export interface ButtonDropdownCtaProps extends TelemetryProps {
|
||||
button: JSX.Element
|
||||
icon: JSX.Element
|
||||
title: string
|
||||
copyText: string
|
||||
source: CloudSignUpSource
|
||||
viewEventName: string
|
||||
returnTo: string
|
||||
onToggle?: () => void
|
||||
className?: string
|
||||
}
|
||||
|
||||
export const ButtonDropdownCta: React.FunctionComponent<React.PropsWithChildren<ButtonDropdownCtaProps>> = ({
|
||||
button,
|
||||
icon,
|
||||
title,
|
||||
copyText,
|
||||
telemetryService,
|
||||
source,
|
||||
viewEventName,
|
||||
returnTo,
|
||||
onToggle,
|
||||
className,
|
||||
}) => {
|
||||
const [isDropdownOpen, setIsDropdownOpen] = useState(false)
|
||||
|
||||
const toggleDropdownOpen = (isOpen: boolean): void => {
|
||||
if (isOpen !== isDropdownOpen) {
|
||||
setIsDropdownOpen(isOpen)
|
||||
onToggle?.()
|
||||
}
|
||||
}
|
||||
|
||||
const onClick = (): void => {
|
||||
telemetryService.log(`SignUpPLG${source}_1_Search`)
|
||||
}
|
||||
|
||||
// Whenever dropdown opens, log view event
|
||||
useEffect(() => {
|
||||
if (isDropdownOpen) {
|
||||
telemetryService.log(viewEventName)
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [isDropdownOpen])
|
||||
|
||||
return (
|
||||
<Popover isOpen={isDropdownOpen} onOpenChange={event => toggleDropdownOpen(event.isOpen)}>
|
||||
<PopoverTrigger as={Button} outline={true} variant="secondary" size="sm" className={className}>
|
||||
{button}
|
||||
</PopoverTrigger>
|
||||
<PopoverContent position={Position.bottomEnd} className={classNames(styles.container)}>
|
||||
<div className={classNames('d-flex mb-3')}>
|
||||
<div className="d-flex align-items-center mr-3">
|
||||
<div className={styles.icon}>{icon}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className={styles.title}>
|
||||
<strong>{title}</strong>
|
||||
</div>
|
||||
<div className={classNames('text-muted', styles.copyText)}>{copyText}</div>
|
||||
</div>
|
||||
</div>
|
||||
<ButtonLink
|
||||
to={buildGetStartedURL('search-dropdown-cta', returnTo)}
|
||||
onClick={onClick}
|
||||
variant="primary"
|
||||
>
|
||||
Get started
|
||||
</ButtonLink>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
)
|
||||
}
|
||||
@ -1,12 +1,6 @@
|
||||
import React, { useMemo, useState } from 'react'
|
||||
|
||||
import {
|
||||
mdiBookmarkOutline,
|
||||
mdiArrowExpandDown,
|
||||
mdiArrowCollapseUp,
|
||||
mdiChevronDoubleUp,
|
||||
mdiChevronDoubleDown,
|
||||
} from '@mdi/js'
|
||||
import { mdiChevronDoubleUp, mdiChevronDoubleDown } from '@mdi/js'
|
||||
import classNames from 'classnames'
|
||||
import * as H from 'history'
|
||||
|
||||
@ -17,15 +11,11 @@ import { ActionsContainer } from '@sourcegraph/shared/src/actions/ActionsContain
|
||||
import { ExtensionsControllerProps } from '@sourcegraph/shared/src/extensions/controller'
|
||||
import { PlatformContextProps } from '@sourcegraph/shared/src/platform/context'
|
||||
import { FilterKind, findFilter } from '@sourcegraph/shared/src/search/query/query'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
|
||||
import { Button, ButtonLink, Icon, Tooltip } from '@sourcegraph/wildcard'
|
||||
import { Button, Icon } from '@sourcegraph/wildcard'
|
||||
|
||||
import { AuthenticatedUser } from '../../auth'
|
||||
import { BookmarkRadialGradientIcon, CodeMonitorRadialGradientIcon } from '../../components/CtaIcons'
|
||||
import { eventLogger } from '../../tracking/eventLogger'
|
||||
|
||||
import { ButtonDropdownCta, ButtonDropdownCtaProps } from './ButtonDropdownCta'
|
||||
import {
|
||||
getCodeMonitoringCreateAction,
|
||||
getInsightsCreateAction,
|
||||
@ -33,10 +23,8 @@ import {
|
||||
getBatchChangeCreateAction,
|
||||
CreateAction,
|
||||
} from './createActions'
|
||||
import { CreateActionsMenu } from './CreateActionsMenu'
|
||||
import { SearchActionsMenu } from './SearchActionsMenu'
|
||||
|
||||
import createActionsStyles from './CreateActions.module.scss'
|
||||
import styles from './SearchResultsInfoBar.module.scss'
|
||||
|
||||
export interface SearchResultsInfoBarProps
|
||||
@ -82,40 +70,6 @@ export interface SearchResultsInfoBarProps
|
||||
setSidebarCollapsed: (collapsed: boolean) => void
|
||||
}
|
||||
|
||||
interface ExperimentalActionButtonProps extends ButtonDropdownCtaProps {
|
||||
showExperimentalVersion: boolean
|
||||
nonExperimentalLinkTo?: string
|
||||
isNonExperimentalLinkDisabled?: boolean
|
||||
onNonExperimentalLinkClick?: () => void
|
||||
className?: string
|
||||
ariaLabel?: string
|
||||
}
|
||||
|
||||
const ExperimentalActionButton: React.FunctionComponent<
|
||||
React.PropsWithChildren<ExperimentalActionButtonProps>
|
||||
> = props => {
|
||||
if (props.showExperimentalVersion) {
|
||||
return <ButtonDropdownCta {...props} />
|
||||
}
|
||||
return (
|
||||
<ButtonLink
|
||||
className={classNames('text-decoration-none', props.className)}
|
||||
to={props.nonExperimentalLinkTo}
|
||||
onSelect={props.onNonExperimentalLinkClick}
|
||||
disabled={props.isNonExperimentalLinkDisabled}
|
||||
variant="secondary"
|
||||
outline={true}
|
||||
size="sm"
|
||||
aria-disabled={props.isNonExperimentalLinkDisabled ? 'true' : undefined}
|
||||
aria-label={props.ariaLabel}
|
||||
// to make disabled ButtonLink focusable
|
||||
tabIndex={0}
|
||||
>
|
||||
{props.button}
|
||||
</ButtonLink>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* The info bar shown over the search results list that displays metadata
|
||||
* and a few actions like expand all and save query
|
||||
@ -123,8 +77,6 @@ const ExperimentalActionButton: React.FunctionComponent<
|
||||
export const SearchResultsInfoBar: React.FunctionComponent<
|
||||
React.PropsWithChildren<SearchResultsInfoBarProps>
|
||||
> = props => {
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
|
||||
const canCreateMonitorFromQuery = useMemo(() => {
|
||||
if (!props.query) {
|
||||
return false
|
||||
@ -134,8 +86,6 @@ export const SearchResultsInfoBar: React.FunctionComponent<
|
||||
return globalTypeFilterValue === 'diff' || globalTypeFilterValue === 'commit'
|
||||
}, [props.query])
|
||||
|
||||
const showActionButtonExperimentalVersion = !props.authenticatedUser
|
||||
|
||||
// When adding a new create action check and update the $collapse-breakpoint in CreateActions.module.scss.
|
||||
// The collapse breakpoint indicates at which window size we hide the buttons and show the collapsed menu instead.
|
||||
const createActions = useMemo(
|
||||
@ -172,93 +122,6 @@ export const SearchResultsInfoBar: React.FunctionComponent<
|
||||
[props.enableCodeMonitoring, props.patternType, props.query]
|
||||
)
|
||||
|
||||
const createCodeMonitorButton = useMemo(() => {
|
||||
if (!createCodeMonitorAction) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
content={
|
||||
props.authenticatedUser && !canCreateMonitorFromQuery
|
||||
? 'Code monitors only support type:diff or type:commit searches.'
|
||||
: undefined
|
||||
}
|
||||
placement="bottom"
|
||||
>
|
||||
<li className={classNames('mr-2', createActionsStyles.button, styles.navItem)}>
|
||||
{/*
|
||||
a11y-ignore
|
||||
Rule: "color-contrast" (Elements must have sufficient color contrast)
|
||||
GitHub issue: https://github.com/sourcegraph/sourcegraph/issues/33343
|
||||
*/}
|
||||
<ExperimentalActionButton
|
||||
showExperimentalVersion={showActionButtonExperimentalVersion}
|
||||
nonExperimentalLinkTo={createCodeMonitorAction.url}
|
||||
isNonExperimentalLinkDisabled={!canCreateMonitorFromQuery}
|
||||
className="a11y-ignore create-code-monitor-button"
|
||||
button={
|
||||
<>
|
||||
<Icon
|
||||
aria-hidden={true}
|
||||
className="mr-1"
|
||||
{...(typeof createCodeMonitorAction.icon === 'string'
|
||||
? { svgPath: createCodeMonitorAction.icon }
|
||||
: { as: createCodeMonitorAction.icon })}
|
||||
/>
|
||||
{createCodeMonitorAction.label}
|
||||
</>
|
||||
}
|
||||
icon={<CodeMonitorRadialGradientIcon />}
|
||||
title="Monitor code for changes"
|
||||
copyText="Create a monitor and get notified when your code changes. Free for registered users."
|
||||
telemetryService={props.telemetryService}
|
||||
source="Monitor"
|
||||
viewEventName="SearchResultMonitorCTAShown"
|
||||
returnTo={createCodeMonitorAction.url}
|
||||
ariaLabel={
|
||||
props.authenticatedUser && !canCreateMonitorFromQuery
|
||||
? 'Code monitors only support type:diff or type:commit searches.'
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
</li>
|
||||
</Tooltip>
|
||||
)
|
||||
}, [
|
||||
createCodeMonitorAction,
|
||||
props.telemetryService,
|
||||
props.authenticatedUser,
|
||||
canCreateMonitorFromQuery,
|
||||
showActionButtonExperimentalVersion,
|
||||
])
|
||||
|
||||
const saveSearchButton = useMemo(
|
||||
() => (
|
||||
<li className={classNames('mr-2', styles.navItem)}>
|
||||
<ExperimentalActionButton
|
||||
showExperimentalVersion={showActionButtonExperimentalVersion}
|
||||
onNonExperimentalLinkClick={props.onSaveQueryClick}
|
||||
className="test-save-search-link"
|
||||
button={
|
||||
<>
|
||||
<Icon aria-hidden={true} className="mr-1" svgPath={mdiBookmarkOutline} />
|
||||
Save search
|
||||
</>
|
||||
}
|
||||
icon={<BookmarkRadialGradientIcon />}
|
||||
title="Saved searches"
|
||||
copyText="Save your searches and quickly run them again. Free for registered users."
|
||||
source="Saved"
|
||||
viewEventName="SearchResultSavedSeachCTAShown"
|
||||
returnTo={props.location.pathname + props.location.search}
|
||||
telemetryService={props.telemetryService}
|
||||
/>
|
||||
</li>
|
||||
),
|
||||
[props.location, showActionButtonExperimentalVersion, props.onSaveQueryClick, props.telemetryService]
|
||||
)
|
||||
|
||||
const extraContext = useMemo(
|
||||
() => ({
|
||||
searchQuery: props.query || null,
|
||||
@ -320,111 +183,21 @@ export const SearchResultsInfoBar: React.FunctionComponent<
|
||||
</ActionsContainer>
|
||||
) : null}
|
||||
|
||||
{(createActions.length > 0 ||
|
||||
createCodeMonitorButton ||
|
||||
saveSearchButton ||
|
||||
coreWorkflowImprovementsEnabled) && <li className={styles.divider} aria-hidden="true" />}
|
||||
<li className={styles.divider} aria-hidden="true" />
|
||||
|
||||
{coreWorkflowImprovementsEnabled ? (
|
||||
<SearchActionsMenu
|
||||
query={props.query}
|
||||
patternType={props.patternType}
|
||||
sourcegraphURL={props.platformContext.sourcegraphURL}
|
||||
authenticatedUser={props.authenticatedUser}
|
||||
createActions={createActions}
|
||||
createCodeMonitorAction={createCodeMonitorAction}
|
||||
canCreateMonitor={canCreateMonitorFromQuery}
|
||||
resultsFound={props.resultsFound}
|
||||
allExpanded={props.allExpanded}
|
||||
onExpandAllResultsToggle={props.onExpandAllResultsToggle}
|
||||
onSaveQueryClick={props.onSaveQueryClick}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
{createActions.map(createActionButton => (
|
||||
<Tooltip
|
||||
key={createActionButton.label}
|
||||
content={createActionButton.tooltip}
|
||||
placement="bottom"
|
||||
>
|
||||
<li className={classNames('nav-item mr-2', createActionsStyles.button)}>
|
||||
<ButtonLink
|
||||
to={createActionButton.url}
|
||||
className="text-decoration-none"
|
||||
variant="secondary"
|
||||
outline={true}
|
||||
size="sm"
|
||||
onClick={
|
||||
createActionButton.eventToLog
|
||||
? () => {
|
||||
eventLogger.log(createActionButton.eventToLog!)
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<Icon
|
||||
aria-hidden={true}
|
||||
className="mr-1"
|
||||
{...(typeof createActionButton.icon === 'string'
|
||||
? { svgPath: createActionButton.icon }
|
||||
: { as: createActionButton.icon })}
|
||||
/>
|
||||
{createActionButton.label}
|
||||
</ButtonLink>
|
||||
</li>
|
||||
</Tooltip>
|
||||
))}
|
||||
|
||||
{createCodeMonitorButton}
|
||||
|
||||
{(createActions.length > 0 || createCodeMonitorAction) && (
|
||||
<CreateActionsMenu
|
||||
createActions={createActions}
|
||||
createCodeMonitorAction={createCodeMonitorAction}
|
||||
canCreateMonitor={canCreateMonitorFromQuery}
|
||||
authenticatedUser={props.authenticatedUser}
|
||||
/>
|
||||
)}
|
||||
|
||||
{saveSearchButton}
|
||||
|
||||
{props.resultsFound && (
|
||||
<>
|
||||
<li className={styles.divider} aria-hidden="true" />
|
||||
<li className={classNames(styles.navItem)}>
|
||||
<Tooltip
|
||||
content={`${
|
||||
props.allExpanded ? 'Hide' : 'Show'
|
||||
} more matches on all results`}
|
||||
placement="bottom"
|
||||
>
|
||||
<Button
|
||||
aria-label={props.allExpanded ? 'Collapse' : 'Expand'}
|
||||
onClick={props.onExpandAllResultsToggle}
|
||||
className="text-decoration-none"
|
||||
aria-live="polite"
|
||||
data-testid="search-result-expand-btn"
|
||||
data-test-tooltip-content={`${
|
||||
props.allExpanded ? 'Hide' : 'Show'
|
||||
} more matches on all results`}
|
||||
outline={true}
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
>
|
||||
<Icon
|
||||
aria-hidden={true}
|
||||
className="mr-0"
|
||||
svgPath={
|
||||
props.allExpanded ? mdiArrowCollapseUp : mdiArrowExpandDown
|
||||
}
|
||||
/>
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<SearchActionsMenu
|
||||
query={props.query}
|
||||
patternType={props.patternType}
|
||||
sourcegraphURL={props.platformContext.sourcegraphURL}
|
||||
authenticatedUser={props.authenticatedUser}
|
||||
createActions={createActions}
|
||||
createCodeMonitorAction={createCodeMonitorAction}
|
||||
canCreateMonitor={canCreateMonitorFromQuery}
|
||||
resultsFound={props.resultsFound}
|
||||
allExpanded={props.allExpanded}
|
||||
onExpandAllResultsToggle={props.onExpandAllResultsToggle}
|
||||
onSaveQueryClick={props.onSaveQueryClick}
|
||||
/>
|
||||
</ul>
|
||||
|
||||
<Button
|
||||
|
||||
@ -3,49 +3,36 @@
|
||||
.container {
|
||||
width: 100%;
|
||||
display: grid;
|
||||
// minmax(0, 1fr) for the contents column so it shrinks down. This causes
|
||||
// horizontal scrollbars to appear on the search results code chunks instead
|
||||
// of on the whole page.
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
grid-template-rows: auto 1fr;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
grid-template-areas:
|
||||
'sidebar infobar'
|
||||
'sidebar contents';
|
||||
'infobar sidebar'
|
||||
'contents sidebar';
|
||||
column-gap: 1rem;
|
||||
height: min-content;
|
||||
padding: 0.5rem 1rem 0 1rem;
|
||||
column-gap: 1rem;
|
||||
|
||||
:global(.core-workflow-improvements-enabled) & {
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
&--with-sidebar-hidden {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
grid-template-areas:
|
||||
'infobar sidebar'
|
||||
'contents sidebar';
|
||||
|
||||
&--with-sidebar-hidden {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
grid-template-areas:
|
||||
'infobar'
|
||||
'contents';
|
||||
}
|
||||
'infobar'
|
||||
'contents';
|
||||
}
|
||||
|
||||
@media (--md-breakpoint-down) {
|
||||
&,
|
||||
:global(.core-workflow-improvements-enabled) & {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
grid-template-rows: auto auto 1fr;
|
||||
grid-template-areas:
|
||||
'infobar'
|
||||
'sidebar'
|
||||
'contents';
|
||||
}
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
grid-template-rows: auto auto 1fr;
|
||||
grid-template-areas:
|
||||
'infobar'
|
||||
'sidebar'
|
||||
'contents';
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
grid-area: sidebar;
|
||||
|
||||
:global(.core-workflow-improvements-enabled) .container--with-sidebar-hidden & {
|
||||
.container--with-sidebar-hidden & {
|
||||
display: none;
|
||||
|
||||
@media (--md-breakpoint-down) {
|
||||
@ -64,10 +51,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-button-strip {
|
||||
grid-area: button-strip;
|
||||
}
|
||||
|
||||
.infobar {
|
||||
grid-area: infobar;
|
||||
margin-bottom: 0.25rem;
|
||||
|
||||
@ -22,18 +22,15 @@
|
||||
max-height: 26rem;
|
||||
width: 100%;
|
||||
|
||||
// Simple UI mode theme
|
||||
// The full UI aggregation mode has different from sidebar background colors
|
||||
// in different themes and UI search modes (standard, simple) we have to
|
||||
// override default sidebar chart styles in order to fit it in the full UI colors.
|
||||
:global(.core-workflow-improvements-enabled) & {
|
||||
:global(.theme-dark) & [data-error-layout] rect {
|
||||
fill: var(--gray-09);
|
||||
}
|
||||
:global(.theme-dark) & [data-error-layout] rect {
|
||||
fill: var(--gray-09);
|
||||
}
|
||||
|
||||
:global(.theme-light) & [data-error-layout] rect {
|
||||
fill: var(--gray-03);
|
||||
}
|
||||
:global(.theme-light) & [data-error-layout] rect {
|
||||
fill: var(--gray-03);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,22 +1,11 @@
|
||||
.text-layout {
|
||||
:global(.theme-dark) & rect {
|
||||
fill: var(--gray-09);
|
||||
fill: var(--gray-10);
|
||||
}
|
||||
|
||||
:global(.theme-light) & rect {
|
||||
fill: var(--gray-03);
|
||||
}
|
||||
|
||||
// Simple UI mode theme
|
||||
:global(.core-workflow-improvements-enabled) & {
|
||||
:global(.theme-dark) & rect {
|
||||
fill: var(--gray-10);
|
||||
}
|
||||
|
||||
:global(.theme-light) & rect {
|
||||
fill: var(--gray-02);
|
||||
opacity: 0.6;
|
||||
}
|
||||
fill: var(--gray-02);
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
&-container {
|
||||
|
||||
@ -3,13 +3,12 @@ import React from 'react'
|
||||
import classNames from 'classnames'
|
||||
|
||||
import { dataOrThrowErrors, gql } from '@sourcegraph/http-client'
|
||||
import { FilterLink, RevisionsProps, SyntaxHighlightedSearchQuery, TabIndex } from '@sourcegraph/search-ui'
|
||||
import { FilterLink, RevisionsProps, TabIndex } from '@sourcegraph/search-ui'
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import styles from '@sourcegraph/search-ui/src/results/sidebar/SearchFilterSection.module.scss'
|
||||
import { GitRefType } from '@sourcegraph/shared/src/schema'
|
||||
import { FilterType } from '@sourcegraph/shared/src/search/query/filters'
|
||||
import { useTemporarySetting } from '@sourcegraph/shared/src/settings/temporary/useTemporarySetting'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { Button, LoadingSpinner, Tab, TabList, TabPanel, TabPanels, Tabs, Text } from '@sourcegraph/wildcard'
|
||||
|
||||
import { useConnection } from '../../../components/FilteredConnection/hooks/useConnection'
|
||||
@ -50,8 +49,6 @@ export const GIT_REVS_QUERY = gql`
|
||||
}
|
||||
`
|
||||
|
||||
const revisionLabel = (value: string): React.ReactElement => <SyntaxHighlightedSearchQuery query={`rev:${value}`} />
|
||||
|
||||
interface RevisionListProps {
|
||||
repoName: string
|
||||
type: GitRefType
|
||||
@ -67,8 +64,6 @@ const RevisionList: React.FunctionComponent<React.PropsWithChildren<RevisionList
|
||||
pluralNoun,
|
||||
query,
|
||||
}) => {
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
|
||||
const { connection, fetchMore, hasNextPage, loading, error } = useConnection<
|
||||
SearchSidebarGitRefsResult,
|
||||
SearchSidebarGitRefsVariables,
|
||||
@ -124,7 +119,6 @@ const RevisionList: React.FunctionComponent<React.PropsWithChildren<RevisionList
|
||||
key={node.name}
|
||||
label={node.displayName}
|
||||
value={node.name}
|
||||
labelConverter={coreWorkflowImprovementsEnabled ? undefined : revisionLabel}
|
||||
onFilterChosen={onFilterClick}
|
||||
/>
|
||||
))}
|
||||
|
||||
@ -9,7 +9,6 @@ import {
|
||||
getDynamicFilterLinks,
|
||||
getRepoFilterLinks,
|
||||
getSearchSnippetLinks,
|
||||
getQuickLinks,
|
||||
getSearchReferenceFactory,
|
||||
getSearchTypeLinks,
|
||||
getFiltersOfKind,
|
||||
@ -20,7 +19,6 @@ import { FilterType } from '@sourcegraph/shared/src/search/query/filters'
|
||||
import { Filter } from '@sourcegraph/shared/src/search/stream'
|
||||
import { SettingsCascadeProps } from '@sourcegraph/shared/src/settings/settings'
|
||||
import { SectionID } from '@sourcegraph/shared/src/settings/temporary/searchSidebar'
|
||||
import { useCoreWorkflowImprovementsEnabled } from '@sourcegraph/shared/src/settings/useCoreWorkflowImprovementsEnabled'
|
||||
import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
|
||||
import { Code, Tooltip, Icon } from '@sourcegraph/wildcard'
|
||||
|
||||
@ -64,7 +62,6 @@ export const SearchFiltersSidebar: FC<PropsWithChildren<SearchFiltersSidebarProp
|
||||
} = props
|
||||
|
||||
// Settings
|
||||
const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled()
|
||||
const enableSearchAggregations = useExperimentalFeatures(features => features.searchResultsAggregations ?? true)
|
||||
const proactiveSearchAggregations = useExperimentalFeatures(
|
||||
features => features.proactiveSearchResultsAggregations ?? true
|
||||
@ -139,23 +136,9 @@ export const SearchFiltersSidebar: FC<PropsWithChildren<SearchFiltersSidebarProp
|
||||
})}
|
||||
</SearchSidebarSection>
|
||||
|
||||
{!coreWorkflowImprovementsEnabled && (
|
||||
<SearchSidebarSection sectionId={SectionID.DYNAMIC_FILTERS} header="Dynamic Filters">
|
||||
{getDynamicFilterLinks(
|
||||
filters,
|
||||
['lang', 'file', 'utility'],
|
||||
onDynamicFilterClicked,
|
||||
(label, value) => `Filter by ${value}`,
|
||||
(label, value) => value
|
||||
)}
|
||||
</SearchSidebarSection>
|
||||
)}
|
||||
|
||||
{coreWorkflowImprovementsEnabled && (
|
||||
<SearchSidebarSection sectionId={SectionID.LANGUAGES} header="Languages">
|
||||
{getDynamicFilterLinks(filters, ['lang'], onDynamicFilterClicked, label => `Search ${label} files`)}
|
||||
</SearchSidebarSection>
|
||||
)}
|
||||
<SearchSidebarSection sectionId={SectionID.LANGUAGES} header="Languages">
|
||||
{getDynamicFilterLinks(filters, ['lang'], onDynamicFilterClicked, label => `Search ${label} files`)}
|
||||
</SearchSidebarSection>
|
||||
|
||||
<SearchSidebarSection
|
||||
sectionId={SectionID.REPOSITORIES}
|
||||
@ -164,19 +147,15 @@ export const SearchFiltersSidebar: FC<PropsWithChildren<SearchFiltersSidebarProp
|
||||
minItems={1}
|
||||
noResultText={getRepoFilterNoResultText}
|
||||
>
|
||||
{getRepoFilterLinks(repoFilters, onDynamicFilterClicked, coreWorkflowImprovementsEnabled)}
|
||||
{getRepoFilterLinks(repoFilters, onDynamicFilterClicked)}
|
||||
</SearchSidebarSection>
|
||||
|
||||
{coreWorkflowImprovementsEnabled && (
|
||||
<>
|
||||
<SearchSidebarSection sectionId={SectionID.FILE_TYPES} header="File types">
|
||||
{getDynamicFilterLinks(filters, ['file'], onDynamicFilterClicked)}
|
||||
</SearchSidebarSection>
|
||||
<SearchSidebarSection sectionId={SectionID.OTHER} header="Other">
|
||||
{getDynamicFilterLinks(filters, ['utility'], onDynamicFilterClicked)}
|
||||
</SearchSidebarSection>
|
||||
</>
|
||||
)}
|
||||
<SearchSidebarSection sectionId={SectionID.FILE_TYPES} header="File types">
|
||||
{getDynamicFilterLinks(filters, ['file'], onDynamicFilterClicked)}
|
||||
</SearchSidebarSection>
|
||||
<SearchSidebarSection sectionId={SectionID.OTHER} header="Other">
|
||||
{getDynamicFilterLinks(filters, ['utility'], onDynamicFilterClicked)}
|
||||
</SearchSidebarSection>
|
||||
|
||||
{repoName && (
|
||||
<SearchSidebarSection
|
||||
@ -203,12 +182,6 @@ export const SearchFiltersSidebar: FC<PropsWithChildren<SearchFiltersSidebarProp
|
||||
<SearchSidebarSection sectionId={SectionID.SEARCH_SNIPPETS} header="Search snippets">
|
||||
{getSearchSnippetLinks(settingsCascade, onSnippetClicked)}
|
||||
</SearchSidebarSection>
|
||||
|
||||
{!coreWorkflowImprovementsEnabled && (
|
||||
<SearchSidebarSection sectionId={SectionID.QUICK_LINKS} header="Quicklinks">
|
||||
{getQuickLinks(settingsCascade)}
|
||||
</SearchSidebarSection>
|
||||
)}
|
||||
</SearchSidebar>
|
||||
)
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user