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

[#52147] quick action table headers #16944

Merged
merged 23 commits into from
Oct 18, 2024
Merged

Conversation

EinLama
Copy link
Contributor

@EinLama EinLama commented Oct 14, 2024

Ticket

https://community.openproject.org/wp/52147

What are you trying to accomplish?

Clicking on the table header in the project list offers a variety of actions to perform on this column.

Sort by a column, move columns around, use a filter by a column value, add or remove columns. All this now at the convenience of a click.

Screenshots

quick_action_table_headers.mov

What approach did you choose and why?

I went with Primers ActionMenu as it seemed like a good fit. Where possible, existing functionality of the project list was kept. For example, remembering the query parameters for previous changes when making further changes (first sort, then change available columns, then sort again).

To interact with the filter component and configure view components, I used Stimulus. All other operations are triggered by visiting a URL.

In general, the quick action table headers should be easily portable to other tables. This is why all of the action menu methods went into the general sort_helper. Model-specific infos such as custom filter mappings (see next paragraph) are provided from the view when calling the component.

About column filter mappings: Some actions are not suitable for certain columns. This depends on the column itself and its position within the table. You cannot move the leftmost column further to the left. At the same time, you cannot filter by columns where we have no fitting filter for. For mapping existing filters to certain columns, I have added constant to projects_helper.rb. When applying the action menu to other tables, the models must provide their column-filter-mapping in a similar fashion.

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@EinLama EinLama force-pushed the feature/52147-quick-action-table-headers branch 4 times, most recently from 2261910 to df3fde6 Compare October 15, 2024 15:14
@EinLama EinLama force-pushed the feature/52147-quick-action-table-headers branch from 5299c4a to 0a0df25 Compare October 16, 2024 09:27
@EinLama EinLama marked this pull request as ready for review October 16, 2024 11:55
@EinLama EinLama force-pushed the feature/52147-quick-action-table-headers branch from 0a0df25 to 9c26b60 Compare October 17, 2024 06:56
@ulferts
Copy link
Contributor

ulferts commented Oct 17, 2024

I didn't do a proper review but rather only tried out the PR for a bit. I really enjoyed playing around with it cause the UX felt nicely direct. But while playing around, I stumbled over two things:

image
  • The table headers are no longer ensured to be fully visible. E.g. "Version" is cut off. That used to be different before.
  • There is no quick action on text columns. I get that they are not sortable but one could move or remove such a column via the quick actions.

Since you can do more things, such as (re)moving a column, it would be a
shame to not offer these options.

For non-sortable columns, we will just not offer the sort-action.
@EinLama
Copy link
Contributor Author

EinLama commented Oct 17, 2024

Thanks for the feedback, Jens. I agree and have added a style fix as well as the option to use the action menu on non-sortable columns, too.

What's left now is to also allow the "mark as favorite" column to work with the action menu with the same reasoning. Currently looking into that.

@aaron-contreras aaron-contreras self-assigned this Oct 17, 2024
Copy link
Contributor

Choose a reason for hiding this comment

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

Excellent!

Comment on lines +120 to +125

// When our generic table uses the quick action menu, column headers are cut off and no longer fully readable.
// This fix ensures that column headers are always displayed. An example for such a table is the project list.
.generic-table
.generic-table--action-menu-button
min-width: max-content !important
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@aaron-contreras aaron-contreras left a comment

Choose a reason for hiding this comment

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

🌴 Great work. Left a question as I recall some of the behavior in a Stimulus controller might be duplicated. If not, feel free to merge with this approval

@EinLama
Copy link
Contributor Author

EinLama commented Oct 18, 2024

Thank you 🎉

@EinLama EinLama merged commit f27bd0a into dev Oct 18, 2024
14 checks passed
@EinLama EinLama deleted the feature/52147-quick-action-table-headers branch October 18, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants