Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a placeholder Component Tab #2731

Merged
merged 14 commits into from
Apr 5, 2024
Merged

Add a placeholder Component Tab #2731

merged 14 commits into from
Apr 5, 2024

Conversation

JerrySentry
Copy link
Contributor

@JerrySentry JerrySentry commented Mar 26, 2024

Description

codecov/engineering-team#1370

Adds a placeholder Components tab under repo page, this for now will be showing Flag data. From there we will step by step update this to fully show Component analytics data.

See list of tasks here: codecov/engineering-team#234

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@codecov-notifications
Copy link

codecov-notifications bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 95.45455% with 9 lines in your changes are missing coverage. Please review.

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2731      +/-   ##
==========================================
- Coverage   98.42%   98.37%   -0.06%     
==========================================
  Files         857      872      +15     
  Lines       12261    12462     +201     
  Branches     3240     3242       +2     
==========================================
+ Hits        12068    12259     +191     
- Misses        188      194       +6     
- Partials        5        9       +4     
Files Coverage Δ
.../ComponentsTab/BackfillBanners/BackfillBanners.jsx 100.00% <100.00%> (ø)
...ab/BackfillBanners/SyncingBanner/SyncingBanner.tsx 100.00% <100.00%> (ø)
...illBanners/TriggerSyncBanner/TriggerSyncBanner.tsx 100.00% <100.00%> (ø)
...es/RepoPage/ComponentsTab/BackfillBanners/hooks.ts 100.00% <100.00%> (ø)
src/pages/RepoPage/ComponentsTab/ComponentsTab.jsx 100.00% <100.00%> (ø)
src/pages/RepoPage/ComponentsTab/Header/Header.jsx 100.00% <100.00%> (ø)
...ponentsTab/TimescaleDisabled/TimescaleDisabled.tsx 100.00% <100.00%> (ø)
...ges/RepoPage/ComponentsTab/assets/blurredTable.png 100.00% <ø> (ø)
...Page/ComponentsTab/assets/componentsEmptystate.svg 50.00% <100.00%> (ø)
src/pages/RepoPage/ComponentsTab/constants.ts 100.00% <100.00%> (ø)
... and 9 more

... and 1 file with indirect coverage changes

Components Coverage Δ
Assets 55.55% <ø> (ø)
Layouts 97.13% <ø> (ø)
Pages 99.13% <95.36%> (-0.13%) ⬇️
Services 99.59% <100.00%> (+<0.01%) ⬆️
Shared 99.84% <100.00%> (+<0.01%) ⬆️
UI 94.18% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 70427ce...e740904. Read the comment docs.

Copy link

codecov-public-qa bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 95.45455% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 98.37%. Comparing base (70427ce) to head (e740904).

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2731      +/-   ##
==========================================
- Coverage   98.42%   98.37%   -0.06%     
==========================================
  Files         857      872      +15     
  Lines       12261    12462     +201     
  Branches     3221     3305      +84     
==========================================
+ Hits        12068    12259     +191     
- Misses        188      194       +6     
- Partials        5        9       +4     
Files Coverage Δ
.../ComponentsTab/BackfillBanners/BackfillBanners.jsx 100.00% <100.00%> (ø)
...ab/BackfillBanners/SyncingBanner/SyncingBanner.tsx 100.00% <100.00%> (ø)
...illBanners/TriggerSyncBanner/TriggerSyncBanner.tsx 100.00% <100.00%> (ø)
...es/RepoPage/ComponentsTab/BackfillBanners/hooks.ts 100.00% <100.00%> (ø)
src/pages/RepoPage/ComponentsTab/ComponentsTab.jsx 100.00% <100.00%> (ø)
src/pages/RepoPage/ComponentsTab/Header/Header.jsx 100.00% <100.00%> (ø)
...ponentsTab/TimescaleDisabled/TimescaleDisabled.tsx 100.00% <100.00%> (ø)
...ges/RepoPage/ComponentsTab/assets/blurredTable.png 100.00% <ø> (ø)
...Page/ComponentsTab/assets/componentsEmptystate.svg 50.00% <100.00%> (ø)
src/pages/RepoPage/ComponentsTab/constants.ts 100.00% <100.00%> (ø)
... and 9 more

... and 1 file with indirect coverage changes

Components Coverage Δ
Assets 55.55% <ø> (ø)
Layouts 97.13% <ø> (ø)
Pages 99.13% <95.36%> (-0.13%) ⬇️
Services 99.59% <100.00%> (+<0.01%) ⬆️
Shared 99.84% <100.00%> (+<0.01%) ⬆️
UI 94.18% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 70427ce...e740904. Read the comment docs.

Copy link

codecov bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 95.45455% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 98.37%. Comparing base (70427ce) to head (e740904).

✅ All tests successful. No failed tests found ☺️

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #2731     +/-   ##
=======================================
- Coverage   98.43   98.37   -0.06     
=======================================
  Files        857     872     +15     
  Lines      12261   12462    +201     
  Branches    3221    3282     +61     
=======================================
+ Hits       12068   12259    +191     
- Misses       188     194      +6     
- Partials       5       9      +4     
Files Coverage Δ
.../ComponentsTab/BackfillBanners/BackfillBanners.jsx 100.00% <100.00%> (ø)
...ab/BackfillBanners/SyncingBanner/SyncingBanner.tsx 100.00% <100.00%> (ø)
...illBanners/TriggerSyncBanner/TriggerSyncBanner.tsx 100.00% <100.00%> (ø)
...es/RepoPage/ComponentsTab/BackfillBanners/hooks.ts 100.00% <100.00%> (ø)
src/pages/RepoPage/ComponentsTab/ComponentsTab.jsx 100.00% <100.00%> (ø)
src/pages/RepoPage/ComponentsTab/Header/Header.jsx 100.00% <100.00%> (ø)
...ponentsTab/TimescaleDisabled/TimescaleDisabled.tsx 100.00% <100.00%> (ø)
...ges/RepoPage/ComponentsTab/assets/blurredTable.png 100.00% <ø> (ø)
...Page/ComponentsTab/assets/componentsEmptystate.svg 50.00% <100.00%> (ø)
src/pages/RepoPage/ComponentsTab/constants.ts 100.00% <100.00%> (ø)
... and 9 more

... and 1 file with indirect coverage changes

Components Coverage Δ
Assets 55.55% <ø> (ø)
Layouts 97.13% <ø> (ø)
Pages 99.13% <95.36%> (-0.13%) ⬇️
Services 99.59% <100.00%> (+<0.01%) ⬆️
Shared 99.84% <100.00%> (+<0.01%) ⬆️
UI 94.18% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 70427ce...e740904. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 95.45455% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 98.37%. Comparing base (70427ce) to head (e740904).

✅ All tests successful. No failed tests found ☺️

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2731      +/-   ##
==========================================
- Coverage   98.42%   98.37%   -0.06%     
==========================================
  Files         857      872      +15     
  Lines       12261    12462     +201     
  Branches     3183     3282      +99     
==========================================
+ Hits        12068    12259     +191     
- Misses        188      194       +6     
- Partials        5        9       +4     
Files Coverage Δ
.../ComponentsTab/BackfillBanners/BackfillBanners.jsx 100.00% <100.00%> (ø)
...ab/BackfillBanners/SyncingBanner/SyncingBanner.tsx 100.00% <100.00%> (ø)
...illBanners/TriggerSyncBanner/TriggerSyncBanner.tsx 100.00% <100.00%> (ø)
...es/RepoPage/ComponentsTab/BackfillBanners/hooks.ts 100.00% <100.00%> (ø)
src/pages/RepoPage/ComponentsTab/ComponentsTab.jsx 100.00% <100.00%> (ø)
src/pages/RepoPage/ComponentsTab/Header/Header.jsx 100.00% <100.00%> (ø)
...ponentsTab/TimescaleDisabled/TimescaleDisabled.tsx 100.00% <100.00%> (ø)
...ges/RepoPage/ComponentsTab/assets/blurredTable.png 100.00% <ø> (ø)
...Page/ComponentsTab/assets/componentsEmptystate.svg 50.00% <100.00%> (ø)
src/pages/RepoPage/ComponentsTab/constants.ts 100.00% <100.00%> (ø)
... and 9 more

... and 1 file with indirect coverage changes

Components Coverage Δ
Assets 55.55% <ø> (ø)
Layouts 97.13% <ø> (ø)
Pages 99.13% <95.36%> (-0.13%) ⬇️
Services 99.59% <100.00%> (+<0.01%) ⬆️
Shared 99.84% <100.00%> (+<0.01%) ⬆️
UI 94.18% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 70427ce...e740904. Read the comment docs.

@codecov-staging
Copy link

codecov-staging bot commented Mar 26, 2024

Bundle Report

Changes will increase total bundle size by 28.27kB ⬆️

Bundle name Size Change
gazebo-staging-array-push 6.45MB 28.27kB ⬆️

Copy link

codecov bot commented Mar 26, 2024

Bundle Report

Changes will increase total bundle size by 28.27kB ⬆️

Bundle name Size Change
gazebo-production-array-push 6.45MB 28.27kB ⬆️

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Mar 26, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Commit Created Cloud Enterprise
beba57e Tue, 26 Mar 2024 15:18:11 GMT Expired Expired
beba57e Tue, 26 Mar 2024 15:18:12 GMT Expired Expired
beba57e Tue, 26 Mar 2024 15:33:57 GMT Expired Expired
1b54a0c Wed, 27 Mar 2024 20:50:12 GMT Expired Expired
daae586 Thu, 28 Mar 2024 13:21:39 GMT Expired Expired
daae586 Thu, 28 Mar 2024 13:21:44 GMT Expired Expired
daae586 Thu, 28 Mar 2024 13:25:18 GMT Expired Expired
daae586 Thu, 28 Mar 2024 13:39:37 GMT Expired Expired
34f06f2 Tue, 02 Apr 2024 14:12:21 GMT Expired Expired
822e6d0 Wed, 03 Apr 2024 21:10:56 GMT Expired Expired
f76b695 Thu, 04 Apr 2024 11:47:13 GMT Expired Expired
e5ae8f4 Thu, 04 Apr 2024 12:42:40 GMT Expired Expired
e2ca6f2 Thu, 04 Apr 2024 18:31:29 GMT Expired Expired
d207604 Fri, 05 Apr 2024 13:01:51 GMT Cloud Enterprise

@JerrySentry JerrySentry marked this pull request as ready for review March 28, 2024 13:13
@JerrySentry JerrySentry changed the title [WIP] Add a placeholder Component Tab Add a placeholder Component Tab Mar 28, 2024
Copy link
Contributor

@nicholas-codecov nicholas-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a ... few ... comments to take a peak at

function setup(data) {
useRepoBackfillingStatus.mockReturnValue(data)

render(<BackfillBanners />)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the render function from the setup function, and call it directly after the setup function in each of the it blocks

componentsMeasurementsActive: false,
isRepoBackfilling: false,
})
expect(screen.getByText(/TriggerSyncBanner/)).toBeInTheDocument()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pull out the screen.getByText and assign to a const and than use that const in the expect call.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicholas-codecov any reason for this in particular?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather, why is that necessary/good coding practice?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More or less just consistency throughout the app ... also looks a bit cleaner imo, and since we're introducing new tests I'd prefer to "build for tomorrow" rather than today and try to keep things tidy than when I found them if able

componentsMeasurementsActive: true,
isRepoBackfilling: true,
})
expect(screen.getByText(/SyncingBanner/)).toBeInTheDocument()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here

Comment on lines 19 to 25
<MemoryRouter initialEntries={['/gh/codecov/gazebo/components']}>
<Route path="/:provider/:owner/:repo/components" exact={true}>
<QueryClientProvider client={queryClient}>
<SyncingBanner />
</QueryClientProvider>
</Route>
</MemoryRouter>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pull the MemoryRouter, Route, and QueryClientProvider into a wrapper component, and than move the render into the it block

Comment on lines 30 to 32
beforeEach(() => {
setup()
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the beforeEach and just call setup in the it block before rendering

name={name}
/>
),
delete: true ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't delete only appear for admins?


describe('TableSparkline', () => {
function setup(props: TableSparklineProps) {
render(<TableSparkline {...props} />)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move the render call into the it blocks to bring this test up to date.

Comment on lines 12 to 22
jest.mock('services/repo/useRepoFlags')
jest.mock('services/repo')

jest.mock('services/navigation', () => ({
...jest.requireActual('services/navigation'),
useLocationParams: jest.fn(),
}))
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useParams: jest.fn(),
}))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove these mocks, and replace with a proper router wrapper, and msw mocks

@@ -86,6 +86,12 @@ export function useStaticNavLinks() {
isExternalLink: true,
openNewTab: true,
},
deployingComponentsSupport: {
text: 'Enabling Flags on Self Hosted',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this line here have Components instead of Flags

@@ -278,6 +284,12 @@ export function useStaticNavLinks() {
isExternalLink: true,
openNewTab: true,
},
componentsFeedback: {
text: 'New repo set up feedback',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this text be updated for components?

Copy link
Contributor

@nicholas-codecov nicholas-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more things to take a peak at


describe('BackfillBanner', () => {
function setup(data) {
useRepoBackfillingStatus.mockReturnValue(data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: Is this hook going to be replaced by one specific for components? If so it's fine, just note down that this needs to be updated to an MSW mock when the switch is made, if not than we should update now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this will be replaced by useComponentsBackfilled which calls the BackfillComponentMemberships query, will add a TODO here to replace with MSW when that switch is made in the coming step.

Comment on lines 13 to 15
jest.mock('services/user')

jest.mock('services/repo/useActivateFlagMeasurements')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: These should probably be updated to MSW mocks as well

Comment on lines 16 to 19
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'), // import and retain the original functionalities
useParams: jest.fn(() => {}),
}))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: If we're using a MemoryRouter and Route we shouldn't need this mock.

const backfill = screen.getByTestId('backfill-task')
await user.click(backfill)

await waitFor(() => expect(mutate).toHaveBeenCalled())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: Can you add in another check here with .toHaveBeenCalledWith({ ... }) so we can make sure the correct args are being passed.

'/gh/codecov/gazebo?flags%5B0%5D=flagA'
)

user.click(flagA)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

Copy link
Contributor

@nicholas-codecov nicholas-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks all good to me 👍

@JerrySentry JerrySentry merged commit 17177eb into main Apr 5, 2024
45 of 58 checks passed
@JerrySentry JerrySentry deleted the mar_23_cot branch April 5, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants