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

[JENKINS-62024] Add quick filter box for dropdown lists in hetero-list #4688

Merged
merged 5 commits into from
Apr 19, 2022

Conversation

johnlinp
Copy link
Contributor

@johnlinp johnlinp commented Apr 26, 2020

See JENKINS-62024.

image

image

Proposed changelog entries

  • Add quick filter box for menus created by buttons.

Proposed upgrade guidelines

N/A

Submitter checklist

  • (If applicable) Jira issue is well described
  • Changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developer, depending on the change). Examples
    • Fill-in the Proposed changelog entries section only if there are breaking changes or other changes which may require extra steps from users during the upgrade
  • Appropriate autotests or explanation to why this change has no tests
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@mention Oleg Nenashev

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least 2 approvals for the pull request and no outstanding requests for change
  • Conversations in the pull request are over OR it is explicit that a reviewer does not block the change
  • Changelog entries in the PR title and/or Proposed changelog entries are correct
  • Proper changelog labels are set so that the changelog can be generated automatically
  • If the change needs additional upgrade steps from users, upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the PR title. (example)
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@MarkEWaite MarkEWaite added the work-in-progress The PR is under active development, not ready to the final review label Apr 26, 2020
@daniel-beck
Copy link
Member

Reviewer note: This change will not be reflected in the PR tester by default.

@fqueiruga
Copy link
Contributor

fqueiruga commented Apr 27, 2020

I don't think modifying the YUI code is a good approach. It's library code that's been stable for 12+ years, so I'd be very wary when making the decision to touch it.

The DragDrop widget also builds on the YUI code, but does so by decorating it: https://github.com/jenkinsci/jenkins/blob/master/core/src/main/resources/lib/form/dragdrop/dragdrop.js. This, if possible, is the approach I suggest. Otherwise I'd just build a new dropdown widget altogether.

@daniel-beck
Copy link
Member

I don't think modifying the YUI code is a good approach.

We've done it before 🤷 It's not like the library is pristine.

@fqueiruga
Copy link
Contributor

Still, I'd suggest trying the other approach first.

@johnlinp
Copy link
Contributor Author

@fqueiruga I was looking for an example of decorations on YUI but failed. Thank you for providing the DragDrop example. I'll work on it.

@johnlinp johnlinp changed the title [JENKINS-62024] PoC: Add quick filter box for dropdown lists [JENKINS-62024] Add quick filter box for dropdown lists in hetero-list May 1, 2020
@johnlinp
Copy link
Contributor Author

johnlinp commented May 1, 2020

Hi @fqueiruga,

I pushed a new commit that wraps around YAHOO.widget.Button and apply the quick filter box on it. Please take a look at it if it's acceptable. Thank you.

@varyvol
Copy link

varyvol commented Jun 4, 2020

@johnlinp I don't feel confident enough (with my UI knowledge) to approve, but it looks good. Maybe you could add some explanatory comments to the code and some screenshots where the functionality can be observed.

@fqueiruga could you maybe have a look? The current status uses your preferred approach.

@johnlinp
Copy link
Contributor Author

Hi @fqueiruga,

Would you please review my PR? Thanks!

@fqueiruga
Copy link
Contributor

fqueiruga commented Jul 23, 2020

I think the approach is good even though the styling is a bit rough, needs some paddings :D.

Did you consoider only applying the filter when the number of options is over 5 or something? There are many hetero lists with only 2 options and that may be overkill.

@johnlinp
Copy link
Contributor Author

johnlinp commented Jul 25, 2020

Hi @fqueiruga,

Thank you for the review. Yes, I think it makes sense to only apply the filter when the number of options is at least 5. I'll push a new commit to implement this.

@alecharp
Copy link
Member

@johnlinp is this still something we are attached to? do you have time to work on it or should we close this PR?

@johnlinp
Copy link
Contributor Author

@alecharp Yes, I would love to continue working on it. Let's see if the reviewers have any comments. Thanks.

@janfaracik
Copy link
Contributor

Works well 👍 UI is a touch rough but so is YUI in general.

I want to update/replace the YUI menus eventually but that's no reason to delay this enhancement.

Only thing I'd say is see if there's a way of disabling autocomplete/autocorrect on the filter field.

@johnlinp
Copy link
Contributor Author

Thanks @janfaracik! I'll try to disable autocomplete and autocorrect for this field.

@alecharp
Copy link
Member

@johnlinp this is great. Could you work on the merged conflicts so we can move this PR forward. Thanks.

@johnlinp
Copy link
Contributor Author

@alecharp I've updated the branch to resolve the conflict. Thanks.

@janfaracik I didn't see autocomplete or autocorrect on my end. Can you provide the reproduction steps to show autocomplete or autocorrect for the filter? Thank you!

@alecharp alecharp added needs-more-reviews Complex change, which would benefit from more eyes and removed unresolved-merge-conflict There is a merge conflict with the target branch. labels Mar 18, 2022
@alecharp alecharp removed the work-in-progress The PR is under active development, not ready to the final review label Mar 29, 2022
@alecharp
Copy link
Member

@janfaracik I saw in a PR that you are removing the YUI tooltip implementation. Is there an initiative to remove YUI completely from the core? The work here from @johnlinp seems to be good and could be integrated, no? WDYT @fqueiruga ?

function _createFilter (menu) {
var filterInput = document.createElement("input");
filterInput.style.width = '100%';
filterInput.setAttribute("placeholder", "Filter");
Copy link
Contributor

@janfaracik janfaracik Mar 30, 2022

Choose a reason for hiding this comment

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

Seems like the spellcheck might just be a macOS/Safari issue.

Suggested change
filterInput.setAttribute("placeholder", "Filter");
filterInput.setAttribute("placeholder", "Filter");
filterInput.setAttribute("spellcheck", "false");
filterInput.setAttribute("type", "search");

This fixed the spellcheck problem for me, also uses the correct input type so you get a nice little ⓧ button for clearing text 👍

@janfaracik
Copy link
Contributor

@janfaracik I saw in a PR that you are removing the YUI tooltip implementation. Is there an initiative to remove YUI completely from the core? The work here from @johnlinp seems to be good and could be integrated, no? WDYT @fqueiruga ?

Hoping to remove as much of the YUI stuff as possible eventually, might take a good while though just due to how much there is. This work is definitely good though and should be integrated 👍

@@ -0,0 +1,56 @@
function createFilterMenuButton (button, menu, menuAlignment, menuMinScrollHeight) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If these functions are to be global I'd suggest maybe namespacing them. I can see createFilterMenuButton being a name that could be easily overriden.

Copy link
Member

Choose a reason for hiding this comment

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

it's already quite a long name, I think it will be okay for now anyway. Unless you've got any specific suggestions?

@fqueiruga
Copy link
Contributor

My comments about holding off removing YUI are 2 years old and were of a time before @janfaracik 's amazing work. I'd say that, if possible, it may be beneficial to include this in YUI removal efforts.

@basil
Copy link
Member

basil commented Apr 10, 2022

I am getting a generally positive assessment of this PR from reviewers, but on the other hand none of them have approved the PR, which makes me wonder why. Reviewers should consider providing an Apache-style vote (+1, 0, -1, and fractions) to make their assessment explicit. If the general consensus is strongly positive (e.g., explicit GitHub approvals or +1 votes), I will merge the PR. In contrast, if the general consensus is strongly negative (which I do not believe is the case for this PR!) I would close the PR. If, on the other hand, the general consensus is closer toward neutral, it would be helpful for reviewers to explicitly state which action items are needed in order to move the PR closer to the positive side of the voting number line.

@basil basil requested a review from fqueiruga April 10, 2022 17:44
@timja
Copy link
Member

timja commented Apr 14, 2022

I like the change, 2 areas I think we can improve before I'll give a +1

  1. Focus state to match other components, e.g.:

image

  1. Text should be aligned to other text not touching the left edge

image

@timja timja added rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted and removed needs-more-reviews Complex change, which would benefit from more eyes labels Apr 14, 2022
filterInput.setAttribute("spellcheck", "false");
filterInput.setAttribute("type", "search");

filterInput.addEventListener('input', (event) => _applyFilterKeyword(menu, event));
Copy link
Member

Choose a reason for hiding this comment

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

changed to input from keyup so that the search clear event works

@timja timja requested review from janfaracik and a team April 17, 2022 08:34
@timja
Copy link
Member

timja commented Apr 17, 2022

Pushed a commit to address my concerns. (also reformatted it to match editorconfig file)

Copy link
Member

@NotMyFault NotMyFault left a comment

Choose a reason for hiding this comment

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

Looks ok to me, this component (likely) needs to be revisited in Jan's anyway, to align it with the overhauled look of the project configuration view.

Though to note, various tests are failing.

@timja
Copy link
Member

timja commented Apr 17, 2022

I assume that was an issue with optional chaining and html unit =/

@timja timja added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Apr 17, 2022
@timja
Copy link
Member

timja commented Apr 17, 2022

This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@johnlinp
Copy link
Contributor Author

Thank you @timja for reviewing my code and updating my branch!

@timja timja merged commit b3b059f into jenkinsci:master Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted
Projects
None yet
10 participants