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

fix: Update viewFile toggle in commit detail page #3623

Merged
merged 9 commits into from
Jan 6, 2025
Merged

Conversation

suejung-sentry
Copy link
Contributor

@suejung-sentry suejung-sentry commented Jan 3, 2025

Update the behavior of a file row so clicking anywhere in the row opens the toggle instead of before where clicking the filename takes you to the Files Explorer View but clicking the carat opens that file's contents.

BEFORE

Screenshot 2025-01-03 at 1 46 51 PM

Fixes the below tabs that all had the "confusing" behavior:

  • Commit > Files Changed, Indirect Files Changed
  • Pull > Files Changed, Indirect Files Changed

Notes:

Closes codecov/engineering-team#2399

AFTER

Screenshot 2025-01-03 at 1 45 31 PM Screenshot 2025-01-03 at 1 45 24 PM

example links:
commit page, direct files - https://preview-pr-3623.codecov.dev/gh/codecov/gazebo/pull/3623
commit page, indirect files - https://preview-pr-3623.codecov.dev/gh/codecov/gazebo/pull/3623/indirect-changes
pull page, direct files - https://preview-pr-3623.codecov.dev/gh/codecov/gazebo/commit/324ff6c7c411ddace00d0b8b91201d13a4707962
pull page, indirect files - https://preview-pr-3623.codecov.dev/gh/codecov/gazebo/commit/56cde4f21090d50d450c4d77091f8d83e2a03221/indirect-changes

deleted file example
commit - http://preview-pr-3623.codecov.dev/gh/codecov/gazebo/commit/aa4c740b48099f636bf3ea61e359b52ef56d4d7a
pull - http://preview-pr-3623.codecov.dev/gh/codecov/gazebo/pull/3601

@codecov-staging
Copy link

codecov-staging bot commented Jan 3, 2025

Bundle Report

Changes will decrease total bundle size by 435 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-staging-system-esm 6.06MB 46 bytes (-0.0%) ⬇️
gazebo-staging-system 6.0MB 389 bytes (-0.01%) ⬇️

@codecov-staging
Copy link

codecov-staging bot commented Jan 3, 2025

Codecov Report

Attention: Patch coverage is 91.07143% with 5 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...sTab/IndirectChangesTable/IndirectChangesTable.tsx 86.66% 2 Missing ⚠️
...ChangedTab/FilesChangedTable/FilesChangedTable.tsx 92.85% 1 Missing ⚠️
...lesChanged/FilesChangedTable/FilesChangedTable.tsx 93.33% 1 Missing ⚠️
...sTab/IndirectChangedFiles/IndirectChangedFiles.tsx 91.66% 1 Missing ⚠️
@@            Coverage Diff             @@
##             main    #3623      +/-   ##
==========================================
- Coverage   98.98%   98.94%   -0.04%     
==========================================
  Files         811      811              
  Lines       14543    14556      +13     
  Branches     4127     4134       +7     
==========================================
+ Hits        14395    14403       +8     
- Misses        141      146       +5     
  Partials        7        7              
Files with missing lines Coverage Δ
...ChangedTab/FilesChangedTable/FilesChangedTable.tsx 99.07% <92.85%> (-0.93%) ⬇️
...lesChanged/FilesChangedTable/FilesChangedTable.tsx 99.06% <93.33%> (-0.94%) ⬇️
...sTab/IndirectChangedFiles/IndirectChangedFiles.tsx 97.82% <91.66%> (+0.15%) ⬆️
...sTab/IndirectChangesTable/IndirectChangesTable.tsx 97.36% <86.66%> (-2.64%) ⬇️

... and 1 file with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.66% <91.07%> (-0.06%) ⬇️
Services 99.33% <ø> (ø)
Shared 99.37% <ø> (ø)
UI 99.14% <ø> (ø)

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 d88bff4...10578f5. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented Jan 3, 2025

Codecov Report

Attention: Patch coverage is 91.07143% with 5 lines in your changes missing coverage. Please review.

Project coverage is 98.94%. Comparing base (d88bff4) to head (10578f5).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...sTab/IndirectChangesTable/IndirectChangesTable.tsx 86.66% 2 Missing ⚠️
...ChangedTab/FilesChangedTable/FilesChangedTable.tsx 92.85% 1 Missing ⚠️
...lesChanged/FilesChangedTable/FilesChangedTable.tsx 93.33% 1 Missing ⚠️
...sTab/IndirectChangedFiles/IndirectChangedFiles.tsx 91.66% 1 Missing ⚠️
@@            Coverage Diff             @@
##             main    #3623      +/-   ##
==========================================
- Coverage   98.98%   98.94%   -0.04%     
==========================================
  Files         811      811              
  Lines       14543    14556      +13     
  Branches     4127     4127              
==========================================
+ Hits        14395    14403       +8     
- Misses        141      146       +5     
  Partials        7        7              
Files with missing lines Coverage Δ
...ChangedTab/FilesChangedTable/FilesChangedTable.tsx 99.07% <92.85%> (-0.93%) ⬇️
...lesChanged/FilesChangedTable/FilesChangedTable.tsx 99.06% <93.33%> (-0.94%) ⬇️
...sTab/IndirectChangedFiles/IndirectChangedFiles.tsx 97.82% <91.66%> (+0.15%) ⬆️
...sTab/IndirectChangesTable/IndirectChangesTable.tsx 97.36% <86.66%> (-2.64%) ⬇️

... and 1 file with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.66% <91.07%> (-0.06%) ⬇️
Services 99.33% <ø> (ø)
Shared 99.37% <ø> (ø)
UI 99.14% <ø> (ø)

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 d88bff4...10578f5. Read the comment docs.

Copy link

codecov bot commented Jan 3, 2025

Bundle Report

Changes will decrease total bundle size by 435 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 6.0MB 389 bytes (-0.01%) ⬇️
gazebo-production-system-esm 6.06MB 46 bytes (-0.0%) ⬇️

Copy link

codecov-public-qa bot commented Jan 3, 2025

Codecov Report

Attention: Patch coverage is 91.07143% with 5 lines in your changes missing coverage. Please review.

Project coverage is 98.94%. Comparing base (d88bff4) to head (10578f5).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...sTab/IndirectChangesTable/IndirectChangesTable.tsx 86.66% 2 Missing ⚠️
...ChangedTab/FilesChangedTable/FilesChangedTable.tsx 92.85% 1 Missing ⚠️
...lesChanged/FilesChangedTable/FilesChangedTable.tsx 93.33% 1 Missing ⚠️
...sTab/IndirectChangedFiles/IndirectChangedFiles.tsx 91.66% 1 Missing ⚠️
@@            Coverage Diff             @@
##             main    #3623      +/-   ##
==========================================
- Coverage   98.98%   98.94%   -0.04%     
==========================================
  Files         811      811              
  Lines       14543    14556      +13     
  Branches     4120     4127       +7     
==========================================
+ Hits        14395    14403       +8     
- Misses        141      146       +5     
  Partials        7        7              
Files with missing lines Coverage Δ
...ChangedTab/FilesChangedTable/FilesChangedTable.tsx 99.07% <92.85%> (-0.93%) ⬇️
...lesChanged/FilesChangedTable/FilesChangedTable.tsx 99.06% <93.33%> (-0.94%) ⬇️
...sTab/IndirectChangedFiles/IndirectChangedFiles.tsx 97.82% <91.66%> (+0.15%) ⬆️
...sTab/IndirectChangesTable/IndirectChangesTable.tsx 97.36% <86.66%> (-2.64%) ⬇️

... and 1 file with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.66% <91.07%> (-0.06%) ⬇️
Services 99.33% <ø> (ø)
Shared 99.37% <ø> (ø)
UI 99.14% <ø> (ø)

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 d88bff4...10578f5. Read the comment docs.

Copy link

codecov bot commented Jan 3, 2025

Codecov Report

Attention: Patch coverage is 91.07143% with 5 lines in your changes missing coverage. Please review.

Project coverage is 98.94%. Comparing base (d88bff4) to head (10578f5).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...sTab/IndirectChangesTable/IndirectChangesTable.tsx 86.66% 2 Missing ⚠️
...ChangedTab/FilesChangedTable/FilesChangedTable.tsx 92.85% 1 Missing ⚠️
...lesChanged/FilesChangedTable/FilesChangedTable.tsx 93.33% 1 Missing ⚠️
...sTab/IndirectChangedFiles/IndirectChangedFiles.tsx 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3623      +/-   ##
==========================================
- Coverage   98.98%   98.94%   -0.04%     
==========================================
  Files         811      811              
  Lines       14543    14556      +13     
  Branches     4127     4127              
==========================================
+ Hits        14395    14403       +8     
- Misses        141      146       +5     
  Partials        7        7              
Files with missing lines Coverage Δ
...ChangedTab/FilesChangedTable/FilesChangedTable.tsx 99.07% <92.85%> (-0.93%) ⬇️
...lesChanged/FilesChangedTable/FilesChangedTable.tsx 99.06% <93.33%> (-0.94%) ⬇️
...sTab/IndirectChangedFiles/IndirectChangedFiles.tsx 97.82% <91.66%> (+0.15%) ⬆️
...sTab/IndirectChangesTable/IndirectChangesTable.tsx 97.36% <86.66%> (-2.64%) ⬇️

... and 1 file with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.66% <91.07%> (-0.06%) ⬇️
Services 99.33% <ø> (ø)
Shared 99.37% <ø> (ø)
UI 99.14% <ø> (ø)

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 d88bff4...10578f5. Read the comment docs.

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Jan 3, 2025

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
be2a3b9 Fri, 03 Jan 2025 02:40:09 GMT Expired Expired
f3cf51d Fri, 03 Jan 2025 17:59:00 GMT Expired Expired
1558e21 Fri, 03 Jan 2025 21:49:48 GMT Expired Expired
bbdda7e Sat, 04 Jan 2025 01:34:46 GMT Expired Expired
12d7511 Sat, 04 Jan 2025 01:48:29 GMT Expired Expired
ec2ce64 Sat, 04 Jan 2025 02:04:29 GMT Expired Expired
0f8b501 Sat, 04 Jan 2025 02:21:29 GMT Expired Expired
497eacd Sat, 04 Jan 2025 03:14:47 GMT Expired Expired
10578f5 Mon, 06 Jan 2025 18:51:37 GMT Cloud Enterprise

) : null}
{isDeletedFile ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

very nice that we can delete this conditional logic now

})}
data-testid="file-diff-expand"
onClick={() => !isDeletedFile && row.toggleExpanded()}
{...(!isDeletedFile && { 'data-highlight-row': 'onHover' })}
Copy link
Contributor

Choose a reason for hiding this comment

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

jw, does 'data-highlight-row': !isDeletedFile ? 'onHover' : undefined (or w/e the default is) work?

It's a little easier for me to parse that way but idk maybe that's worse

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice yeah I like that better, too! Updated!

@@ -297,7 +268,7 @@ export default function FilesChangedTable() {
getCoreRowModel: getCoreRowModel(),
getSortedRowModel: getSortedRowModel(),
getExpandedRowModel: getExpandedRowModel(),
getRowCanExpand: () => true,
getRowCanExpand: (row) => row.original?.headCoverage !== null, // deleted files are not expandable
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this check used elsewhere (outside of these tables I mean)? Jw how we know this is the item to key off of when making a determination of if the file is deleted or not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh good question. I pulled that from an existing usage from this table, but I get what you mean, maybe we should have this be a more inherent property of the file in api than having the UI make that designation here adhoc. And something more obvious than headCoverage being null (which can in theory happen for more reasons, not just due to a deleted file). I'll have to think about that one but in the meantime may ship this work independently

Copy link
Contributor

Choose a reason for hiding this comment

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

yep totally fair! I'll keep this in the back of my head too in case I stumble upon a more straight-forward abstraction of this info at some point

Copy link
Contributor

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

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

code looks good, just a couple thoughts / q's

@suejung-sentry suejung-sentry added this pull request to the merge queue Jan 6, 2025
Merged via the queue into main with commit c489df8 Jan 6, 2025
50 of 62 checks passed
@suejung-sentry suejung-sentry deleted the sshin/2399 branch January 6, 2025 19:07
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.

files change filename anchors to file explore
3 participants