Add text field to paste filters for documentation

Created on 21 October 2024, 7 months ago

Problem/Motivation

It's not always clear what a particular filter was intended to do, especially for more complex filters and those created by other developers. Something as simple as a space at the end of a filter, or replacement, could easily go unnoticed. And for many of us, it doesn't take long to forget exactly why we included a particular filter.

Proposed resolution

Add a text field to each filter for notes, so developers and site builders can optionally document the intent of their filters.

Remaining tasks

  1. Decide on label for new text field (Notes, Description, Intent, ???).
  2. Update module to include new text field.
  3. Add test coverage for new text field.

User interface changes

A third field, labeled "Notes" (or something along those lines), will appear with each filter in the paste filter configuration.

API changes

None.

Data model changes

None.

✨ Feature request
Status

Active

Version

1.0

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States jstoller

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @jstoller
  • πŸ‡¨πŸ‡¦Canada star-szr

    Thanks for the feature request @jstoller! I like the idea and don’t have any immediate concerns, although it will make the form vertically larger. I’m not sure when I can work on this feature in the near future but I’m happy to review patches/MRs and help it along with reviews and such.

  • First commit to issue fork.
  • Pipeline finished with Failed
    25 days ago
    Total: 224s
    #473334
  • πŸ‡¨πŸ‡¦Canada joel_osc

    Not sure what is going with the tests, but I have tested the plain diff and it works as long as you drush updb to update sites with any existing filters configured.

  • πŸ‡¨πŸ‡¦Canada star-szr

    Thanks @joel_osc, I will take a look.

  • πŸ‡¨πŸ‡¦Canada star-szr

    Pushed a commit that should resolve the test failures, it was due to the config in the test module not being updated with the new description field.

    I think at least one other thing that deserves some thought is the behaviour for deleting rows, should we check that all three text fields are empty? Currently we just check that the search and replace are empty and delete the filter row if they are both empty. I think we should probably include the description field and update the messaging/tests/etc. accordingly, but open to other suggestions and thoughts here.

  • πŸ‡¨πŸ‡¦Canada joel_osc

    Thanks for the fix to the tests!!! I am not sure we need to check if description is empty - I think the main fields are the search and replace. If someone has emptied both of those then I would say that we are sure they want the row gone. Cheers and thank-you!

  • πŸ‡¨πŸ‡¦Canada star-szr

    @joel_osc I am leaning that way as well, thanks for weighing in. Could you please take a look at the phpcs errors in the .install?

  • Pipeline finished with Failed
    23 days ago
    Total: 643s
    #475743
  • πŸ‡¨πŸ‡¦Canada star-szr

    I re-ran the Nightwatch tests (it tends to randomly fail, I am working on replacing it), looks like there is one phpcs error left. Thanks!

  • Pipeline finished with Failed
    20 days ago
    Total: 237s
    #477383
  • πŸ‡¨πŸ‡¦Canada star-szr

    I've hit retry three times on the test, but it's still randomly failing. Not your fault @joel_osc, thanks for your work on this! See 🌱 Replace Nightwatch testing with another solution Active .

    I think this feature also needs additional test coverage to:

    1. Ensure that the Description field saves and displays properly
    2. Explicitly test for the "empty row" behaviour (row should be deleted if Description is non-empty but Search and Replace are empty)

    Sadly those tests would need to be ported to Playwright later if we write them in Nightwatch now, but I won't merge this without test coverage. If nobody comes back to this I will add those tests at a later date, but I will be working on 🌱 Replace Nightwatch testing with another solution Active first.

  • πŸ‡¨πŸ‡¦Canada joel_osc

    Cool, thanks @star-szr!

Production build 0.71.5 2024