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

Fixed the issue where long values overflowed the modal in the pages u… #8640

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Annaseli
Copy link
Contributor

…nder the "Administration" tab in the UI.

Closes #8489

Issue

Long values overflowed modal windows across multiple pages in the "Administration" tab. Initially reported for one modal, but found in Users, Groups, and other sections (for other sections I opened another issue).

Fix

  • Applied truncation for long values in modals.
  • Users can hover to see full value and copy the truncated value.
  • Fix applied globally to relevant components where was possibly.

Changes Made

1. "Add to Group" Pop-up (Groups -> click on some group name -> Add Members)

Updated the DataTable component to prevent overflow.

Changed in files:

webui/src/lib/components/controls.jsx (DataTable)
webui/src/lib/components/auth/forms.jsx (AttachModal)

The issue screenshot:

Add_to_Group_issue

Fix:

Add_to_Group_fix

Note

This pop-up is implemented using a "DataTable" and AttachModal, which is also used in other functions.

For example it fixed in addition this issue:
Issue:
long_group_name_issue_1
long_group_name_issue_2

Fix:
long_group_name_fix

2. "Groups" Page (Groups -> Group Name) "Users" Page (Users -> User Name)

Fixed GroupHeader, PolicyHeader, UserHeader overflow.

Changed in files:

webui/src/lib/components/auth/nav.jsx (GroupHeader, PolicyHeader, UserHeader)

  • Chaned in PolicyHeader since it has the same structure as GroupHeader and UserHeader

The issue screenshot:

long_name_title_issue_1

Fix:

long_name_title_fix

3. Fixed user name overflow in confirmation pop-up (Users -> selecting a user with a long name -> Access Credentials -> Create Access Key)

Changed in files:

webui/src/pages/auth/users/user/credentials.jsx (getMsg function)

The issue screenshot:

long_user_name_in_confirm_issue

Fix:

long_user_name_in_confirm_fix

Testing

Verified on lakeFS OSS using local DB & object store.

@Annaseli Annaseli requested review from guy-har and itaigilo February 11, 2025 17:37
@Annaseli Annaseli added the include-changelog PR description should be included in next release changelog label Feb 11, 2025
Copy link

E2E Test Results - DynamoDB Local - Local Block Adapter

14 passed

Copy link

E2E Test Results - Quickstart

11 passed

Copy link
Contributor

@guy-har guy-har left a comment

Choose a reason for hiding this comment

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

Looks Amazing!
Great work!
requesting changes because the checkbox has too much place now

image

Copy link
Contributor

@itaigilo itaigilo left a comment

Choose a reason for hiding this comment

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

Great first big PR -
Really nice effort mapping the issues, looking around, and getting to a complete solution.

Some notes:

  1. Agree with @guy-har 's comment about limiting the width of the checkbox.
  2. You should consider splitting this PR into one with the specific changes, and one with the general ones, that will apply multiple components. Since changing global components (potentially) affects the whole app, I think it's better to have a separate PR and discussion for it.
  3. Nit: better to have a shorter title for the PR, for better readability. 😊

Anyway, nice work 💪

@Annaseli
Copy link
Contributor Author

I addressed all the comments:

  1. removed the "import styles"
  2. removed the custom styles from globals.css and used bootstrap classes instead
  3. split this PR to several PRs in order to address each fix in another PR
  4. Narrowed the leftmose "checkbox" column using bootstrap classes
  5. used shorter commit messages for better readability

So now this PR addresses only this fix:

Issue

Long values overflowed modal windows across tables in "Groups", "Users" and "Policies" pages in the "Administration" tab.

Fix

  1. Applied truncation for long values in modals using react bootstrap classes.
  2. Users can hover to see full value and copy the truncated value.

Changes Made

  1. In the table: "Groups" main page (Administration -> Groups )
  2. In the table: "Add to Group" Pop-up (Administration -> Groups -> click on some group name -> Add Members)
  3. In the table: "Users" main page (Administration -> Users )
  4. In the table: "Add to Groups" Pop-up (Administration -> Users -> click on some group name -> Add User to Group)
  5. In similar pages in the "Policies" page

Updated the Table under the DataTable component to prevent overflow.

Changed in file:
webui/src/lib/components/controls.jsx (DataTable)

The issue screenshots:
Add_to_Group_issue
long_group_name_issue_1
long_group_name_issue_2

Fixes:
Add_to_Group_fix
long_group_name_fix

Testing

Verified on lakeFS OSS using local DB & object store & ACL.

@itaigilo
Copy link
Contributor

@Annaseli I'm not sure where it stands at the moment,
But according to your screenshots it seems that the column of the checkbox is too wide again.
Is this on purpose?

@Annaseli
Copy link
Contributor Author

Annaseli commented Feb 18, 2025

@itaigilo
You're right, compared to the original table with the overflow issue, the checkbox column is still quite wide in the screenshots above (though narrower than in my initial solution). To shrink it further, I added "col-12" in the following line of code:
${(firstFixedCol && i === 0) ? "col-1" : "col-12"}
in the controls.jsx file.
When all columns except the first one are set to "col-12", they cause the first column to become narrower.

Now, the column appears narrower:
image
image
image
image

@Annaseli Annaseli requested a review from itaigilo February 18, 2025 22:38
key={header}
title={header}
className={`
${(firstFixedCol && i === 0) ? "col-1" : "col-12"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Well, this is a usage of bootstrap classes which sort-of work for you, but it's pretty accidental. The bootstrap framework uses 12-cols grid elements, so setting an element as col-1 makes it take 1/12 of the width of a element, and col-12 makes it take the whole width of it. So these classes maybe work for you in this context, but there's no guarantee it'll work on other browsers, for example.

How about doing something like:
style={${(firstFixedCol && i === 0) ? "width: 60px" : ""`
(Not sure about the details, but the general idea is to give an actual fixed size for the first column.)

Does this give the same result?

Copy link
Contributor

Choose a reason for hiding this comment

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

(Having said that, I still think that a better overall solution is required here. Either by using a different Table package that might allow this truncate ability, or using a non-table solution for the Auth components (when thinking about it, these are not actually data tables, but UI components, and should be treated as such).
But since this requires an effort which is out-of-scope for this bug fix, it can be deferred.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@itaigilo

I agree that using col-* isn't the best solution, and after I checked it a few days ago further, I found that overriding the width with a style like {{"width: X"}}, is indeed a more appropriate and common approach in React.

I understood that bootstrap’s col-* classes come from its grid system, which isn't designed to be used directly inside elements in tables. They attempt to control column width and they have an effect when combined with "table-layout: fixed" as I used it. Since Bootstrap’s grid system (col-*) is meant for div-based layouts rather than tables, it's not suitable perfectly inside .

I found out that a better approach for fixing column widths in tables:
To use style={{ width: "X%" }} inside .
or
To use with { width: "X%" } .

However, when I previously suggested it, I understood that it’s not a good practice and that we should use Bootstrap classes instead. The "w-" approach didn't work for me, but "col-" did.

In my earlier solution (before the col-* solution) , I used a fixed width, and it worked.

So, would you recommend using style={{ width: "X%" }} instead of col-* in this case?

I believe using percentages instead of a fixed 60px width is a better approach since the browser can dynamically adjust it rather than us setting a fixed size manually.

And yes, I agree with you that a more generalized approach is needed here, and that this PR provides just a compromise.

Copy link
Contributor

Choose a reason for hiding this comment

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

The thing is -
We use this mechanism only for the checkbox column. And since a checkbox has a fixed size, why do you prefer to give it a dynamic width instead of a fixed width (assuming, of course, that fixed width also gives good results for this)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI: records with long names overflow modals boundaries
3 participants