diff --git a/src/pages/RepoPage/ComponentsTab/ComponentsTab.jsx b/src/pages/RepoPage/ComponentsTab/ComponentsTab.jsx index f8c4ef9f16..f7122e279f 100644 --- a/src/pages/RepoPage/ComponentsTab/ComponentsTab.jsx +++ b/src/pages/RepoPage/ComponentsTab/ComponentsTab.jsx @@ -3,9 +3,7 @@ import { Redirect, useParams } from 'react-router-dom' import { SentryRoute } from 'sentry' import { useRepoSettingsTeam } from 'services/repo' -import { useRepoFlagsSelect } from 'services/repo/useRepoFlagsSelect' import { TierNames, useTier } from 'services/tier' -import ComponentsNotConfigured from 'shared/ComponentsNotConfigured' import blurredTable from './assets/blurredTable.png' import BackfillBanners from './BackfillBanners/BackfillBanners' @@ -24,12 +22,7 @@ const showComponentsTable = ({ return componentsMeasurementsActive && componentsMeasurementsBackfilled } -const showComponentsData = ({ componentsData }) => { - return componentsData && componentsData?.length > 0 -} - function ComponentsTab() { - const { data: componentsData } = useRepoFlagsSelect() const { provider, owner, repo } = useParams() const { data: tierData } = useTier({ owner, provider }) const { data: repoSettings } = useRepoSettingsTeam() @@ -49,10 +42,6 @@ function ComponentsTab() { return } - if (!showComponentsData({ componentsData })) { - return - } - return (
{ }) }) - describe('when rendered with no components', () => { - beforeEach(() => { - setup({ - data: backfillDataNotStarted, - flags: [[], []], - }) - }) - - it('renders empty state message', async () => { - render(, { wrapper }) - const componentsText = await screen.findByText( - /The Components feature is not yet configured/ - ) - expect(componentsText).toBeInTheDocument() - }) - }) - describe('when rendered without timescale enabled', () => { beforeEach(() => { setup({ diff --git a/src/pages/RepoPage/ComponentsTab/Header/Header.jsx b/src/pages/RepoPage/ComponentsTab/Header/Header.jsx index 4d43a4a633..d00a2317b4 100644 --- a/src/pages/RepoPage/ComponentsTab/Header/Header.jsx +++ b/src/pages/RepoPage/ComponentsTab/Header/Header.jsx @@ -12,7 +12,6 @@ import Icon from 'ui/Icon' import MultiSelect from 'ui/MultiSelect' import Select from 'ui/Select' - const Header = ({ controlsDisabled, children }) => { const [selectedComponents, setSelectedComponents] = useState([]) const [search, setSearch] = useState() diff --git a/src/pages/RepoPage/ComponentsTab/subroute/ComponentsTable/ComponentsTable.spec.tsx b/src/pages/RepoPage/ComponentsTab/subroute/ComponentsTable/ComponentsTable.spec.tsx index d9a1f84f3e..83da16e29b 100644 --- a/src/pages/RepoPage/ComponentsTab/subroute/ComponentsTable/ComponentsTable.spec.tsx +++ b/src/pages/RepoPage/ComponentsTab/subroute/ComponentsTable/ComponentsTable.spec.tsx @@ -341,13 +341,11 @@ describe('ComponentsTable', () => { setup({ noData: true }) }) - it('renders expected empty state message', async () => { + it('renders expected no data message', async () => { render(, { wrapper: wrapper() }) - const errorMessage = await screen.findByText( - /There was a problem getting components data/ - ) - expect(errorMessage).toBeInTheDocument() + const noData = await screen.findByText(/No data to display/) + expect(noData).toBeInTheDocument() }) }) diff --git a/src/pages/RepoPage/ComponentsTab/subroute/ComponentsTable/ComponentsTable.tsx b/src/pages/RepoPage/ComponentsTab/subroute/ComponentsTable/ComponentsTable.tsx index bd2e6bacfb..d523b2a121 100644 --- a/src/pages/RepoPage/ComponentsTab/subroute/ComponentsTable/ComponentsTable.tsx +++ b/src/pages/RepoPage/ComponentsTab/subroute/ComponentsTable/ComponentsTable.tsx @@ -14,6 +14,7 @@ import { useInView } from 'react-intersection-observer' import { useParams } from 'react-router-dom' import { useRepoConfig } from 'services/repo/useRepoConfig' +import ComponentsNotConfigured from 'shared/ComponentsNotConfigured' import { determineProgressColor } from 'shared/utils/determineProgressColor' import A from 'ui/A' import CoverageProgress from 'ui/CoverageProgress' @@ -309,9 +310,7 @@ function ComponentsTable() { /> {!tableData?.length && !isLoading && (

- {isSearching - ? 'No results found' - : 'There was a problem getting components data'} + {isSearching ? 'No results found' : }

)} {isFetchingNextPage ? : null} diff --git a/src/shared/ComponentsNotConfigured/ComponentsNotConfigured.spec.tsx b/src/shared/ComponentsNotConfigured/ComponentsNotConfigured.spec.tsx index 0db2198022..57bc322afc 100644 --- a/src/shared/ComponentsNotConfigured/ComponentsNotConfigured.spec.tsx +++ b/src/shared/ComponentsNotConfigured/ComponentsNotConfigured.spec.tsx @@ -12,30 +12,20 @@ describe('ComponentsNotConfigured', () => { ) describe('when rendered', () => { - it('shows message', () => { + it('renders the no data message', () => { render(, { wrapper }) - expect( - screen.getByText(/The Components feature is not yet configured/) - ).toBeInTheDocument() - }) - it('renders link', () => { - render(, { wrapper }) - const componentssAnchor = screen.getByRole('link', { - name: /help your team today/i, - }) - expect(componentssAnchor).toHaveAttribute( - 'href', - 'https://docs.codecov.com/docs/components' - ) + const noDataMessage = screen.getByText('No data to display') + expect(noDataMessage).toBeInTheDocument() }) - it('renders empty state image', () => { + it('renders the configure components button', () => { render(, { wrapper }) - const componentsMarketingImg = screen.getByRole('img', { - name: /Components feature not configured/, + + const configureComponentsButton = screen.getByRole('link', { + name: 'Get started with components external-link.svg', }) - expect(componentsMarketingImg).toBeInTheDocument() + expect(configureComponentsButton).toBeInTheDocument() }) }) }) diff --git a/src/shared/ComponentsNotConfigured/ComponentsNotConfigured.tsx b/src/shared/ComponentsNotConfigured/ComponentsNotConfigured.tsx index 0dbb5e1e24..83411e7c18 100644 --- a/src/shared/ComponentsNotConfigured/ComponentsNotConfigured.tsx +++ b/src/shared/ComponentsNotConfigured/ComponentsNotConfigured.tsx @@ -1,25 +1,24 @@ -import componentManagement from 'assets/flagManagement.svg' -import A from 'ui/A' +import Button from 'ui/Button' function ComponentsNotConfigured() { return ( -
-
- Components feature not configured - - The Components feature is not yet configured{' '} - - - Learn how components can{' '} - - help your team today - - . - +
+
+

No data to display

+

+ You will need to configure components in your yaml file to view the + list of your components here. +

+
+
+
)