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: implement EZA_GRID_ROWS grid details view minimum rows threshold #1043

Conversation

LeoniePhiline
Copy link
Contributor

@LeoniePhiline LeoniePhiline commented Jul 1, 2024

Grid details view had been prevented only by console width being unavailable.

This changeset implements EZA_GRID_ROWS as secondary grid details inhibitor, preventing grid details view if the minimum rows threshold is not reached by the grid which would be rendered.

Fixes complaint at #66 (comment)

Side note: EZA_GRID_ROWS only applies to --long --grid, but not to non-details --grid view. Looking at the code and documentation, this appears to be intentional.

@LeoniePhiline LeoniePhiline requested a review from PThorpe92 as a code owner July 1, 2024 16:05
@LeoniePhiline LeoniePhiline mentioned this pull request Jul 1, 2024
@LeoniePhiline
Copy link
Contributor Author

LeoniePhiline commented Jul 1, 2024

The failure of Flake Checker appears unrelated.

Edit: That's DeterminateSystems/flake-checker-action#32.

@PThorpe92
Copy link
Member

This looks good 👍 thanks for the PR!

I do have a question as far as the expected output, (just fyi I could be way off here as it's late and I just skimmed over the issue.)

I would assume that rows would be talking about the individual rows created with N columns after the grid is rendered. This checks if files.len() < minimum rows. But because the grid could calculate N columns, when I set EZA_GRID_ROWS to 5, it could still render a grid with 1 or 2 'rows'. Is this expected?
e.g.
image
My understanding is it would render N columns where the rows >= EZA_GRID_ROWS. Like I said I could be off. I'll take another look tomorrow after work 👍

@LeoniePhiline
Copy link
Contributor Author

You could indeed be very right in that the configured rows refers to the rows in the grid view rather than the rows in the list view.

This means I would need to divide the number of files by the number of grid columns and round up.

The config setting should then be interpreted as "Render a details grid, but only if the grid is going to be long enough".

Maybe we could also improve the documentation of the environment variable to make this ambiguity clearer.

@PThorpe92
Copy link
Member

You could indeed be very right in that the configured rows refers to the rows in the grid view rather than the rows in the list view.

Ok good I thought I was missing something 😅. but you are right it's definitely because of the ambiguity. The only reason I think may be correct, is the var seems to be discussed in the context of grid, in which case a row would be a grid row.

Some clearer docs would be helpful for sure 👍 (assuming that is the case anyway, someone else let me know if this is off base)

@LeoniePhiline LeoniePhiline force-pushed the fix/66-grid-details-minimum-rows-threshold branch 2 times, most recently from 3a2d9aa to de489fb Compare July 4, 2024 19:14
@LeoniePhiline
Copy link
Contributor Author

I've adjusted the implementation. It now entirely lives within src/output/grid_details.rs, since the grid dimensions are determined only late in the pre-rendering process.

I re-read the documentation of EZA_GRID_ROWS and found it sufficiently clear. I just hadn't read it properly previously.

The algorithm works correctly now:

image

The second invocation renders a details list view, since the grid would not at least span 11 rows.

@LeoniePhiline
Copy link
Contributor Author

@PThorpe92 PTAL 😄

Copy link
Member

@PThorpe92 PThorpe92 left a comment

Choose a reason for hiding this comment

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

heyy sorry man, super busy week.

Awesome! this looks good to me 👍

Thanks for the PR!

p.s. so you think the existing docs are sufficient, and we had just skimmed it over?

all set w/ me, can merge when @cafkafk is ready

@LeoniePhiline
Copy link
Contributor Author

heyy sorry man, super busy week.

No worries, I just wasn't sure if you had been notified about the PR update. Hope it's okay that I pinged you!

Awesome! this looks good to me 👍

Thanks for the PR!

Thanks and very welcome!

p.s. so you think the existing docs are sufficient, and we had just skimmed it over?

It appeared to me like I merely skimmed it over and thus misunderstood. The docs seem sufficient to me as they are.

If you disagree, though, then please let me know. I can also contribute an update to the docs while we're at it.

@sabrehagen
Copy link

LGTM ✅

Copy link

@sabrehagen sabrehagen left a comment

Choose a reason for hiding this comment

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

LGTM

@LeoniePhiline
Copy link
Contributor Author

Do you require a rebase or is this ready to merge as is?

@PThorpe92
Copy link
Member

Yeah could you rebase from main? I just pinged cafk on matrix about it, she will take a look + merge but rebasing would be helpful.

@cafkafk cafkafk force-pushed the fix/66-grid-details-minimum-rows-threshold branch 2 times, most recently from 42e1e07 to 6e4c817 Compare August 7, 2024 07:12
Grid details view had been prevented only by console width being
unavailable.

This changeset implements `EZA_GRID_ROWS` as secondary grid details
inhibitor, preventing grid details view if the minimum rows threshold is
not reached by grid which would be rendered.

Fix:
eza-community#66 (comment)
Fix: eza-community#1044

BREAKING CHANGE: Before this change, the `EZA_GRID_ROWS` variable was
ignored, despite documentation existing. Users relying on `EZA_GRID_ROW`
not doing anything will find their output changed. For more info, see
@cafkafk cafkafk force-pushed the fix/66-grid-details-minimum-rows-threshold branch from 6e4c817 to a204e4a Compare August 7, 2024 07:15
Copy link
Member

@cafkafk cafkafk left a comment

Choose a reason for hiding this comment

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

Okay, this does look like it's working as expected. It's a breaking change, so I've changed to commit summary to reflect that.

Thanks for fixing this!

@cafkafk cafkafk merged commit 97a8abe into eza-community:main Aug 7, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants