Restore term clicking AJAX functionality

Created on 7 February 2025, about 2 months ago

Problem/Motivation

πŸ› AJAX error when editing term content Postponed: needs info removed the core feature of Taxonomy Manager: to be able to quickly navigate a taxonomy with an AJAX user interface. This avoids unnecessary full page loads.

Some users reported AJAX errors, but for other users the AJAX functionality is working normally and a very important feature of taxonomy manager.

Therefore I think this issue is critical.

Steps to reproduce

Install taxonomy manager and go to https://jd.ddev.site/admin/structure/taxonomy_manager/voc/tags . Click on a term. Note that the browser reloads the page on every click making navigating and inspecting terms extremely slow.

Proposed resolution

Restore the AJAX functionality.

Remaining tasks

Review merge request and agree on the approach.

User interface changes

Quick AJAX navigation between terms is restored.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΉAustria klausi πŸ‡¦πŸ‡Ή Vienna

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

Merge Requests

Comments & Activities

  • Issue created by @klausi
  • πŸ‡¦πŸ‡ΉAustria klausi πŸ‡¦πŸ‡Ή Vienna

    merge request created.

  • πŸ‡¦πŸ‡ΉAustria klausi πŸ‡¦πŸ‡Ή Vienna

    Uploading patch file for composer patches.

  • πŸ‡¦πŸ‡ΊAustralia VladimirAus Brisbane, Australia
  • πŸ‡¦πŸ‡ΊAustralia VladimirAus Brisbane, Australia

    Tested on 10.4. Ajax functionality is back, but styling for media library and clicking media library is broken.

    One of the reasons Ajax was removed in πŸ› AJAX error when editing term content Postponed: needs info is that it stopped working with media libraries and other Ajax dependent module.

  • πŸ‡¦πŸ‡ΊAustralia VladimirAus Brisbane, Australia

    I would recommend a solution similar to views where we can toggle ajax / not ajax in config.

  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States torfj Seattle, WA

    I concur with @klausi’s assessment of the critical nature of this issue, as the AJAX functionality is central to the module’s purpose.

    After investigating the problems with AJAX interactions in media libraries and the non-functional β€œAdd another item” button (which appears when a field has unlimited cardinality), I found that initiating the AJAX call to render the term edit form directly in JavaScript resolves these issues.

    I plan to conduct further testing and clean up the code next week when I have more time.

    Currently, both the AJAX that renders the term edit form when clicking in the tree and the AJAX and styling within the term edit form are functioning well.

  • Pipeline finished with Failed
    about 2 months ago
    Total: 342s
    #418636
  • πŸ‡ΊπŸ‡ΈUnited States torfj Seattle, WA
  • Pipeline finished with Failed
    about 2 months ago
    Total: 154s
    #427916
  • Pipeline finished with Failed
    about 2 months ago
    Total: 162s
    #427925
  • Pipeline finished with Failed
    about 2 months ago
    Total: 150s
    #427954
  • Pipeline finished with Failed
    about 2 months ago
    Total: 204s
    #427955
  • Pipeline finished with Failed
    about 2 months ago
    Total: 224s
    #427959
  • Pipeline finished with Failed
    about 2 months ago
    Total: 199s
    #427962
  • Pipeline finished with Failed
    about 2 months ago
    Total: 348s
    #427970
  • Pipeline finished with Failed
    about 2 months ago
    Total: 161s
    #428059
  • Pipeline finished with Failed
    about 2 months ago
    Total: 246s
    #428065
  • Pipeline finished with Failed
    about 2 months ago
    Total: 236s
    #428075
  • πŸ‡ΊπŸ‡ΈUnited States torfj Seattle, WA

    Thank you @klausi for the feedback! Having someone like you help maintain this module would it greatly.

    I cleaned up the code, addressed the concerned in the MR and checked for code quality warnings.
    For me it works well now. The only thing missing is that before the term ID was added to the URL. I think this should be a follow up issue, but let me know.

  • πŸ‡¦πŸ‡ΉAustria klausi πŸ‡¦πŸ‡Ή Vienna

    Thanks a lot, nice progress!

    Left some more small comments on the PR that we should address.

  • Pipeline finished with Failed
    about 2 months ago
    Total: 156s
    #429215
  • πŸ‡ΊπŸ‡ΈUnited States torfj Seattle, WA

    Thank you, I addressed the comments. I think we need to discuss further how to handle having the tid in the URL.

  • πŸ‡¦πŸ‡ΉAustria klausi πŸ‡¦πŸ‡Ή Vienna

    Thanks!

    One issue I found is that when you save a term it redirects you to the term page. But I would expect that I stay in Taxonomy Manager. Should be fixable by setting the correct form state redirect.

    I did not test the media library integration - does that work as well that there are no AJAX errors? Then we could avoid introducing a setting to switch on/off Ajax mode as @vladimiraus suggested.

  • Pipeline finished with Failed
    about 2 months ago
    Total: 190s
    #430139
  • πŸ‡ΊπŸ‡ΈUnited States torfj Seattle, WA

    Good point! I was able to fix the redirect issue by overwriting the redirect in the save function of the TaxonomyManagerTermForm. Let me know if you have a better way of doing that.
    Also, I removed an unused function (taxonomyTermSubmitHandler) from the TaxonomyManagerForm class.

    I did some more testing with media library integration and it works well for me now. In addition I also checked that you can still use the 'Add another item' button (if you have a field with unlimited amount of values allowed) without it causing any AJAX errors.

    This should mean that we don't need a setting to enable/disable AJAX.

  • πŸ‡¦πŸ‡ΉAustria klausi πŸ‡¦πŸ‡Ή Vienna

    Nice, looks good to me! Please fix the coding standard issues, otherwise I think we are ready to merge. The CI pipeline is failing, but that is independent of this issue and we can ignore here.

    Marking this as RTBC.

    @vladimiraus I would wait a couple of days if there are any objections and then merge this.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 154s
    #430969
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 32s
    #430995
  • Pipeline finished with Failed
    about 1 month ago
    Total: 321s
    #430996
  • Pipeline finished with Failed
    about 1 month ago
    Total: 153s
    #431003
  • Pipeline finished with Failed
    about 1 month ago
    Total: 152s
    #431007
  • πŸ‡ΊπŸ‡ΈUnited States torfj Seattle, WA

    Thanks again @klausi for all the help on this! I fixed the two coding standard issues you noticed.

    I did do some more testing with a user that doesn't have edit term permissions and noticed that when clicking on terms in the tree it will cause an ajax error. I added some more logic to make sure that the ajax request is only send to the server if the user has the edit term permission. In addition, I noticed console errors when a user doesn't have the delete term permission, which I also fixed.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 218s
    #431582
  • Pipeline finished with Failed
    about 1 month ago
    Total: 159s
    #432988
  • πŸ‡¦πŸ‡ΊAustralia jannakha Brisbane!

    I've tested MR - it looks like it's working with media as required.

    I think it still needs more testing - especially for security/permissions.

    @torfj - what were your test cases for term permissions?

  • πŸ‡¦πŸ‡ΊAustralia jannakha Brisbane!
  • πŸ‡ΊπŸ‡ΈUnited States torfj Seattle, WA

    @jannahka I tested with a user that only has permission to edit terms in a specific vocabulary.
    I also tested with a user that has the administer taxonomy permission which allows a user to edit any taxonomy term.

  • πŸ‡¦πŸ‡ΉAustria klausi πŸ‡¦πŸ‡Ή Vienna

    Thank you!

    Looking good to me, I think we are ready to commit.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 155s
    #434702
  • πŸ‡ΊπŸ‡ΈUnited States torfj Seattle, WA

    Thanks again @klausi for working with me on this! I added the missing title.

    Please note the following issue can also be closed once the changes has been committed: #3491197 πŸ“Œ Wrong Toolbar position after updating to 2.0.16 Active

  • πŸ‡ΊπŸ‡ΈUnited States torfj Seattle, WA
    • klausi β†’ committed e0c70164 on 2.0.x
      fix(term): Restore term click and edit AJAX functionality (#3505219 by...
  • πŸ‡¦πŸ‡ΉAustria klausi πŸ‡¦πŸ‡Ή Vienna

    Merged manually, thanks!

    Will fix the broken pipelines in a follow-up.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024