diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a60275d2cc..26aaddb0a9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ All notable changes to Sourcegraph are documented in this file. ### Added -- +- A new look for Sourcegraph, previously in beta as "Simple UI", is now permanently enabled. [#41021](https://github.com/sourcegraph/sourcegraph/pull/41021) ### Changed @@ -34,6 +34,7 @@ All notable changes to Sourcegraph are documented in this file. ### Removed - `CACHE_DIR` has been removed from the `sourcegraph-frontend` deployment. This required ephemeral storage which will no longer be needed. This variable (and corresponding filesystem mount) has been unused for many releases. [#38934](https://github.com/sourcegraph/sourcegraph/issues/38934) +- Quick links will no longer be shown on the homepage or search sidebar. The `quicklink` setting is now marked as deprecated. [#40750](https://github.com/sourcegraph/sourcegraph/pull/40750) - Quick links will no longer be shown on the homepage or search sidebar if the "Simple UI" toggle is enabled and will be removed entirely in a future release. The `quicklink` setting is now marked as deprecated. [#40750](https://github.com/sourcegraph/sourcegraph/pull/40750) - `file:contains()` has been removed from the list of valid predicates. `file:has.content()` and `file:contains.content()` remain, both of which work the same as `file:contains()` and are valid aliases of each other. - The single-container `sourcegraph/server` deployment no longer bundles a Jaeger instance. [#41244](https://github.com/sourcegraph/sourcegraph/pull/41244) diff --git a/client/branded/src/components/panel/views/__snapshots__/HierarchicalLocationsView.test.tsx.snap b/client/branded/src/components/panel/views/__snapshots__/HierarchicalLocationsView.test.tsx.snap index 58340e84129..ea429f011c8 100644 --- a/client/branded/src/components/panel/views/__snapshots__/HierarchicalLocationsView.test.tsx.snap +++ b/client/branded/src/components/panel/views/__snapshots__/HierarchicalLocationsView.test.tsx.snap @@ -24,22 +24,6 @@ exports[` displays a single location when complete class="header" id="result-container-0" > - - - -
displays a single location when complete data-testid="result-container-header" > - - - 1 match - -
displays multiple locations grouped by fi class="header" id="result-container-0" > - - - -
displays partial locations before complet class="header" id="result-container-0" > - - - -
diff --git a/client/search-ui/src/results/progress/StreamingProgress.story.tsx b/client/search-ui/src/results/progress/StreamingProgress.story.tsx index 3ff41f98138..2ed5561a79b 100644 --- a/client/search-ui/src/results/progress/StreamingProgress.story.tsx +++ b/client/search-ui/src/results/progress/StreamingProgress.story.tsx @@ -2,8 +2,7 @@ import { Meta, Story } from '@storybook/react' import { spy } from 'sinon' import { BrandedStory } from '@sourcegraph/branded/src/components/BrandedStory' -import { MockTemporarySettings } from '@sourcegraph/shared/src/settings/temporary/testUtils' -import { H1, H2 } from '@sourcegraph/wildcard' +import { H2 } from '@sourcegraph/wildcard' import { StreamingProgress } from './StreamingProgress' @@ -305,20 +304,6 @@ const render = () => ( ) -export const StreamingProgressStory: Story = () => ( - - {() => ( - <> - {render()} - - <> -

With simple UI enabled

- {render()} - -
- - )} -
-) +export const StreamingProgressStory: Story = () => {() => <>{render()}} StreamingProgressStory.storyName = 'StreamingProgress' diff --git a/client/search-ui/src/results/progress/StreamingProgressSkippedButton.test.tsx b/client/search-ui/src/results/progress/StreamingProgressSkippedButton.test.tsx index 74848bffb23..f81ed181066 100644 --- a/client/search-ui/src/results/progress/StreamingProgressSkippedButton.test.tsx +++ b/client/search-ui/src/results/progress/StreamingProgressSkippedButton.test.tsx @@ -19,18 +19,6 @@ describe('StreamingProgressSkippedButton', () => { }) }) - it('should not show if no skipped items', () => { - const progress: Progress = { - durationMs: 0, - matchCount: 0, - skipped: [], - } - - renderWithBrandedContext() - expect(screen.queryByTestId('streaming-progress-skipped')).not.toBeInTheDocument() - expect(screen.queryByTestId('streaming-progress-skipped-popover')).not.toBeInTheDocument() - }) - it('should be in info state with only info items', () => { const progress: Progress = { durationMs: 1500, diff --git a/client/search-ui/src/results/progress/__snapshots__/StreamingProgressSkippedPopover.test.tsx.snap b/client/search-ui/src/results/progress/__snapshots__/StreamingProgressSkippedPopover.test.tsx.snap index 1c94270a85e..0df5b67fef5 100644 --- a/client/search-ui/src/results/progress/__snapshots__/StreamingProgressSkippedPopover.test.tsx.snap +++ b/client/search-ui/src/results/progress/__snapshots__/StreamingProgressSkippedPopover.test.tsx.snap @@ -2,6 +2,16 @@ exports[`StreamingProgressSkippedPopover should render correctly 1`] = ` +

+ Found 2 results from 2 repositories. +

+

+ Some results skipped: +

diff --git a/client/search-ui/src/results/sidebar/SidebarButtonStrip.tsx b/client/search-ui/src/results/sidebar/SidebarButtonStrip.tsx index fd1f68062fd..0990e403648 100644 --- a/client/search-ui/src/results/sidebar/SidebarButtonStrip.tsx +++ b/client/search-ui/src/results/sidebar/SidebarButtonStrip.tsx @@ -28,7 +28,7 @@ export const SidebarButtonStrip: React.FunctionComponent<{ className?: string }> ) return ( -
+
{tabs.map(({ tab, icon, name }) => (
-
-
-
- Simple UI -
- -
-
{!isOpenBetaEnabled && props.authenticatedUser.organizations.nodes.length > 0 && ( <> diff --git a/client/web/src/search/home/SearchPage.story.tsx b/client/web/src/search/home/SearchPage.story.tsx index ed0063565a4..6f4e92b6569 100644 --- a/client/web/src/search/home/SearchPage.story.tsx +++ b/client/web/src/search/home/SearchPage.story.tsx @@ -117,46 +117,22 @@ function getMocks({ ] } -export const CloudWithPanels: Story = () => ( +export const CloudAuthedHome: Story = () => ( - {webProps => { - useExperimentalFeatures.setState({ showEnterpriseHomePanels: true }) - return ( - - - - ) - }} + {webProps => ( + + + + )} ) -CloudWithPanels.storyName = 'Cloud with panels' - -export const CloudWithPanelsAndCollaborators: Story = () => ( - - {webProps => { - useExperimentalFeatures.setState({ showEnterpriseHomePanels: true }) - useExperimentalFeatures.setState({ homepageUserInvitation: true }) - return ( - - - - ) - }} - -) - -CloudWithPanelsAndCollaborators.storyName = 'Cloud with panels and collaborators' +CloudAuthedHome.storyName = 'Cloud authenticated home' export const CloudMarketingHome: Story = () => ( @@ -170,22 +146,19 @@ export const CloudMarketingHome: Story = () => ( CloudMarketingHome.storyName = 'Cloud marketing home' -export const ServerWithPanels: Story = () => ( +export const ServerHome: Story = () => ( - {webProps => { - useExperimentalFeatures.setState({ showEnterpriseHomePanels: true }) - return ( - - - - ) - }} + {webProps => ( + + + + )} ) -ServerWithPanels.storyName = 'Server with panels' +ServerHome.storyName = 'Server home' diff --git a/client/web/src/search/home/SearchPageInput.tsx b/client/web/src/search/home/SearchPageInput.tsx index 0fbcc5cb856..188ad4eae5d 100644 --- a/client/web/src/search/home/SearchPageInput.tsx +++ b/client/web/src/search/home/SearchPageInput.tsx @@ -76,11 +76,11 @@ export const SearchPageInput: React.FunctionComponent features.applySearchQuerySuggestionOnEnter ?? false ) const [coreWorkflowImprovementsEnabled] = useCoreWorkflowImprovementsEnabled() - const [hideSearchHistory] = useFeatureFlag('search-input-hide-history') + const [showSearchHistory] = useFeatureFlag('search-input-show-history') const suggestionSources = useMemo( () => - coreWorkflowImprovementsEnabled && props.authenticatedUser && !hideSearchHistory + coreWorkflowImprovementsEnabled && props.authenticatedUser && showSearchHistory ? [ searchQueryHistorySource({ userId: props.authenticatedUser.id, @@ -99,7 +99,7 @@ export const SearchPageInput: React.FunctionComponent { NoResults.storyName = 'no results' -export const SearchWithQuotes: Story = () => { - useNavbarQueryState.setState({ searchQueryFromURL: 'r:golang/oauth2 test f:travis "test"' }) - - return ( - - {() => ( - - - - )} - - ) -} - -SearchWithQuotes.storyName = 'search with quotes' - export const DidYouMean: Story = () => { useNavbarQueryState.setState({ searchQueryFromURL: 'javascript test' }) diff --git a/client/web/src/search/results/StreamingSearchResults.test.tsx b/client/web/src/search/results/StreamingSearchResults.test.tsx index 10e443ed18d..9f0d13a1be2 100644 --- a/client/web/src/search/results/StreamingSearchResults.test.tsx +++ b/client/web/src/search/results/StreamingSearchResults.test.tsx @@ -80,6 +80,14 @@ describe('StreamingSearchResults', () => { siteAdmin: true, } as AuthenticatedUser + // Modified from https://sourcegraph.com/github.com/reach/reach-ui@26c826684729e51e45eef29aa4316df19c0e2c03/-/blob/test/utils.tsx?L105 + // userEvent.click does not work for Reach menu items. Use this function from Reach's official test code instead. + function simualateMenuItemClick(element: HTMLElement) { + fireEvent.mouseEnter(element) + fireEvent.keyDown(element, { key: ' ' }) + fireEvent.keyUp(element, { key: ' ' }) + } + beforeEach(() => { useNavbarQueryState.setState({ searchCaseSensitivity: false, @@ -123,28 +131,26 @@ describe('StreamingSearchResults', () => { expect(screen.getAllByTestId('streaming-progress-count')[0]).toHaveTextContent(expectedString) }) - it('should expand and collapse results when event from infobar is triggered', () => { + it('should expand and collapse results when event from infobar is triggered', async () => { renderWrapper( of(COLLAPSABLE_SEARCH_RESULT)} />) - expect(screen.getByTestId('search-result-expand-btn')).toHaveAttribute( - 'data-test-tooltip-content', - 'Show more matches on all results' - ) + screen + .getAllByTestId('result-container') + .map(element => expect(element).toHaveAttribute('data-expanded', 'false')) - screen.getAllByTestId('result-container').map(element => { - expect(element).toHaveAttribute('data-expanded', 'false') - }) - - userEvent.click(screen.getByTestId('search-result-expand-btn')) - - expect(screen.getByTestId('search-result-expand-btn')).toHaveAttribute( - 'data-test-tooltip-content', - 'Hide more matches on all results' - ) + userEvent.click(await screen.findByLabelText(/Open search actions menu/)) + simualateMenuItemClick(await screen.findByText(/Expand all/, { selector: '[role=menuitem]' })) screen .getAllByTestId('result-container') .map(element => expect(element).toHaveAttribute('data-expanded', 'true')) + + userEvent.click(await screen.findByLabelText(/Open search actions menu/)) + simualateMenuItemClick(await screen.findByText(/Collapse all/, { selector: '[role=menuitem]' })) + + screen + .getAllByTestId('result-container') + .map(element => expect(element).toHaveAttribute('data-expanded', 'false')) }) it('should render correct components for file match and repository match', () => { @@ -194,27 +200,19 @@ describe('StreamingSearchResults', () => { expect(screen.queryByTestId('saved-search-modal')).not.toBeInTheDocument() }) - it('should open saved search modal when triggering event from infobar', () => { + it('should open and close saved search modal if events trigger', async () => { renderWrapper() - const savedSearchButton = screen.getByRole('button', { name: 'Save search' }) + userEvent.click(await screen.findByLabelText(/Open search actions menu/)) + simualateMenuItemClick(await screen.findByText(/Save search/, { selector: '[role=menuitem]' })) - expect(savedSearchButton).toHaveAttribute('href', '') - userEvent.click(savedSearchButton) - expect(screen.getByTestId('saved-search-modal')).toBeInTheDocument() - }) - - it('should close saved search modal if close event triggers', async () => { - renderWrapper() - userEvent.click(await screen.findByText(/save search/i, { selector: 'a' })) - - fireEvent.keyDown(screen.getByText(/save search query to:/i), { + fireEvent.keyDown(await screen.findByText(/Save search query to:/), { key: 'Escape', code: 'Escape', keyCode: 27, charCode: 27, }) - expect(screen.queryByText(/save search query to:/i)).not.toBeInTheDocument() + expect(screen.queryByText(/Save search query to:/)).not.toBeInTheDocument() }) it('should start a new search with added params when onSearchAgain event is triggered', async () => { @@ -273,7 +271,7 @@ describe('StreamingSearchResults', () => { renderWrapper( of(results)} />) - userEvent.click(await screen.findByText(/some results excluded/i)) + userEvent.click((await screen.findAllByText(/results in/i))[0]) const allChecks = await screen.findAllByTestId(/^streaming-progress-skipped-suggest-check/) for (const check of allChecks) { diff --git a/client/web/src/search/results/__snapshots__/SearchResultsInfoBar.test.tsx.snap b/client/web/src/search/results/__snapshots__/SearchResultsInfoBar.test.tsx.snap index ffc92207bfe..a930d9047a3 100644 --- a/client/web/src/search/results/__snapshots__/SearchResultsInfoBar.test.tsx.snap +++ b/client/web/src/search/results/__snapshots__/SearchResultsInfoBar.test.tsx.snap @@ -58,48 +58,19 @@ exports[`SearchResultsInfoBar code monitoring feature flag disabled 1`] = ` />
- - - - - - - - - - - - -