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/feat: Adjust progress_table_cell_type not to increase table row height #1921 #2215

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

kaitlyncliu
Copy link

@kaitlyncliu kaitlyncliu commented Dec 7, 2023

The PR fulfills these requirements: (check all the apply)

  • It's submitted to the main branch.
  • When resolving a specific issue, it's referenced in the PR's title (e.g. feat: Add a button #xxx, where "xxx" is the issue number).
  • When resolving a specific issue, the PR description includes Closes #xxx, where "xxx" is the issue number.
  • If changes were made to ui folder, unit tests (make test) still pass.
  • New/updated tests are included

@kellyycha and I fixed this issue by adding a new keyword argument type in the progress_table_cell_type that allows users to implement a bar style progress cell with the progress value indicated to the left of the bar, reducing the height of the row.

This is how the table.py example looks originally:
Screenshot 2023-12-06 at 12 14 35 PM

Without the Progress column, the row height would look like this, which has a row height that is noticeably shorter than with the Progress:
Screen Shot 2023-12-06 at 1 21 50 AM

Our implementation results in a bar that looks like the following and maintains a similar row height to the row without a progress cell:
Screenshot 2023-12-06 at 12 14 21 PM

We default type to the spinner/arc progress indicator so that previously implemented tables will continue to look the same.

The UI and unit tests still pass:
Screen Shot 2023-12-06 at 7 25 58 PM
Screen Shot 2023-12-06 at 7 26 39 PM

Closes #1921

@kaitlyncliu kaitlyncliu changed the title Fix/issue 1921 fix/feat: Adjust progress_table_cell_type not to increase table row height #1921 Dec 7, 2023
@kaitlyncliu kaitlyncliu marked this pull request as ready for review December 8, 2023 21:03
Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

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

Thanks @kaitlyncliu! The python/R API is autogenerated, not written by hand. Run make generate to generate it properly.

The PR needs:

Comment on lines 70 to 71
/** The type of progress cell to be displayed. One of 'bar', 'spinner'. Defaults to 'spinner'. */
type?: 'bar' | 'spinner'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's go with compact?: B, defaulting to false.

Choose a reason for hiding this comment

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

done

position: 'relative',
display: 'inline-flex',
width: 100,
Copy link
Collaborator

Choose a reason for hiding this comment

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

The width should be fluid - always take the full column width instead of being fixed. Same for both types.

Choose a reason for hiding this comment

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

Not sure what you mean about having the width be fluid.
The existing code before I changed anything had the width and height set to 50, which is the size of the spinner (this is what increased the row height of the table). I used this idea to create the bar, setting the bar width to 50 as well.
I'll remove the barContainer's width and use a margin for making the percentage sign appear next to the bar instead of setting it as 100. Is that ok?

Comment on lines 38 to 46
bar: {
position: 'absolute',
top: '50%', left: 0,
width: 50,
},

spinner: {
position: 'absolute',
top: 0, left: 0, bottom: 0, right: 0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is absolute positioning here for?

Choose a reason for hiding this comment

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

I just reused the previous code. It positions the percentage inside the spinner. I'll organize the code a bit better to make it more clear.

@kellyycha
Copy link

kellyycha commented Dec 12, 2023

Hi @mturoci
I added the python example file called table_progress.py, wrote documentation for https://wave.h2o.ai/docs/widgets/form/table/, changed the attribute from type to compact using make generate, and cleaned up the CSS, but am still unsure about the width of the progress arc and bar being fluid instead of a set number. Please let me know what you think and if there are any more changes necessary!

@mturoci
Copy link
Collaborator

mturoci commented Dec 13, 2023

The changes look better now. Good job @kaitlyncliu!

am still unsure about the width of the progress arc and bar being fluid instead of a set number.

I meant this:

Screen.Recording.2023-12-13.at.10.17.59.AM.mov

Hint: Have a look at flexbox and its flex-grow prop :)

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.

Adjust progress_table_cell_type not to increase table row height
3 participants