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

Enable/disable tabs and flag select based on team plan and private repo status #2377

Merged

Conversation

terry-codecov
Copy link
Contributor

@terry-codecov terry-codecov commented Nov 3, 2023

Description

Updates the tabs and flag selector based on plan type and repo status

Addresses:
codecov/engineering-team#624
codecov/engineering-team#686

Code Example

Notable Changes

  • Added private repo resolve to the pull tabs query
  • The tests are long/complicated due to there being two related feature flags 👎

Screenshots

Team Plan Private repo
Screenshot 2023-11-03 at 10 28 34 AM
Non Team plan / public
Screenshot 2023-11-03 at 10 29 26 AM

Link to Sample Entry

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.

Copy link

netlify bot commented Nov 3, 2023

Deploy Preview for gazebo-staging ready!

Name Link
🔨 Latest commit b2c5b83
🔍 Latest deploy log https://app.netlify.com/sites/gazebo-staging/deploys/6544f626ef6ff70007f05a43
😎 Deploy Preview https://deploy-preview-2377--gazebo-staging.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@codecov-staging
Copy link

codecov-staging bot commented Nov 3, 2023

Codecov Report

Merging #2377 (461aed5) into main (094c204) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2377   +/-   ##
=======================================
  Coverage   96.27%   96.27%           
=======================================
  Files         736      736           
  Lines        8956     8967   +11     
  Branches     2180     2231   +51     
=======================================
+ Hits         8622     8633   +11     
+ Misses        318      317    -1     
- Partials       16       17    +1     
Files Coverage Δ
...stPage/PullRequestPageTabs/PullRequestPageTabs.jsx 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes


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 094c204...461aed5. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented Nov 3, 2023

Codecov Report

Merging #2377 (461aed5) into main (094c204) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2377   +/-   ##
=======================================
  Coverage   96.27%   96.27%           
=======================================
  Files         736      736           
  Lines        8956     8967   +11     
  Branches     2180     2218   +38     
=======================================
+ Hits         8622     8633   +11     
+ Misses        318      317    -1     
- Partials       16       17    +1     
Files Coverage Δ
...stPage/PullRequestPageTabs/PullRequestPageTabs.jsx 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes


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 094c204...461aed5. Read the comment docs.

Copy link

codecov bot commented Nov 3, 2023

Codecov Report

Merging #2377 (461aed5) into main (094c204) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #2377     +/-   ##
=======================================
+ Coverage   96.27   96.28   +0.01     
=======================================
  Files        736     736             
  Lines       8956    8967     +11     
  Branches    2224    2236     +12     
=======================================
+ Hits        8622    8633     +11     
+ Misses       318     317      -1     
- Partials      16      17      +1     
Files Coverage Δ
...stPage/PullRequestPageTabs/PullRequestPageTabs.jsx 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes


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 094c204...461aed5. Read the comment docs.

Copy link

netlify bot commented Nov 3, 2023

Deploy Preview for gazebo-staging ready!

Name Link
🔨 Latest commit 461aed5
🔍 Latest deploy log https://app.netlify.com/sites/gazebo-staging/deploys/65453d81181ecc0008772ec0
😎 Deploy Preview https://deploy-preview-2377--gazebo-staging.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -18,13 +19,16 @@ function PullRequestPageTabs() {
indirectChangesCount,
directChangedFilesCount,
commitsCount,
isPrivateRepo,
Copy link
Contributor

Choose a reason for hiding this comment

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

How do you feel about using useRepoSettingsTeam and getting the private variable from there, instead of adding it to this hook? It feels a little weird that we're getting that from a hook called useTabsCounts and that the only reason we're fetching it from there is cause we already had access to the repository resolver so adding the key is inconvenient. On the flip side we had to change 6 files total to make this happen, while only the change affects this file on the component side. I mainly feel the hook starts to drift from being what it's meant to do, returning counts 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's definitely drifting, I was mostly trying to avoid adding another network request and this was all ready being used in the code, that being said it's definitely a short cut. To be honest I wasnt aware of the useRepoSettingsTeam hook, I think it makes sense to refactor to use that one instead.

graphql.query('OwnerTier', (req, res, ctx) =>
res(
ctx.status(200),
ctx.data({ owner: { plan: { tierName: plan.toLowerCase() } } })
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: could we rename plan to tier ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could at the query level, but it is called plan in the actual resolver so maybe we should also update it there and deprecate the plan resolver?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I should have been bit more specific, meant plan: { tierName: tier.toLowerCase()}}, cause tierName is a tier, not a plan itself

Copy link
Contributor Author

@terry-codecov terry-codecov Nov 3, 2023

Choose a reason for hiding this comment

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

Oh I see! Just to make sure I understand I need to replace the tiers with plans, so it needs to be

plan: { planName: plan.toLowerCase()}} ?

The existing useTier.ts is using tier, so is that no longer correct or are you asking for a new service for plans?

Copy link
Contributor

@adrian-codecov adrian-codecov left a comment

Choose a reason for hiding this comment

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

Mainly the isPrivate comment, otherwise lgtm!

@@ -36,7 +36,6 @@ const mockPullData = {
isCurrentUserPartOfOrg: true,
repository: {
__typename: 'Repository',
private: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Huh, not sure why this registered as a change but 🤷

@terry-codecov terry-codecov merged commit 906eee1 into main Nov 3, 2023
30 checks passed
@terry-codecov terry-codecov deleted the 624-client-pr-page-remove-multiple-tabs-for-team-tier branch November 3, 2023 18:41
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.

[Client] - PR Page: Remove Multiple Tabs for Team Tier
2 participants