Bug 40172 - Remove jQuery from js/fetch/http-client.js
Summary: Remove jQuery from js/fetch/http-client.js
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Jonathan Druart
QA Contact: Pedro Amorim
URL:
Keywords:
Depends on:
Blocks: 40173
  Show dependency treegraph
 
Reported: 2025-06-18 20:48 UTC by Jonathan Druart
Modified: 2025-07-31 14:08 UTC (History)
3 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.11.00,25.05.02
Circulation function:


Attachments
Bug 40172: Replace jQuery with vanilla JS in js/fetch/http-client.js (2.73 KB, patch)
2025-06-18 20:54 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40172: Replace jQuery with vanilla JS in js/fetch/http-client.js (2.78 KB, patch)
2025-06-18 23:52 UTC, David Cook
Details | Diff | Splinter Review
Bug 40172: Replace jQuery with vanilla JS in js/fetch/http-client.js (2.84 KB, patch)
2025-07-08 15:37 UTC, Pedro Amorim
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2025-06-18 20:48:23 UTC
We do not really need jQuery, it can be replace with vanilla JavaScript.
Comment 1 Jonathan Druart 2025-06-18 20:54:19 UTC
Created attachment 183353 [details] [review]
Bug 40172: Replace jQuery with vanilla JS in js/fetch/http-client.js

So that we can reuse it from somewhere else.
The current need is to be able to reuse it from Cypress tests.

Test plan:
Try to hit several places where APIClient is used:
 * Syspref edition
 * Translation of item type description (be aware of bug 40161)
 * Delete of cover images
 * checkin, renew from the checkout list
 * etc.

Note that this does not affect Vue components.
Comment 2 David Cook 2025-06-18 23:43:51 UTC
(In reply to Jonathan Druart from comment #0)
> We do not really need jQuery, it can be replace with vanilla JavaScript.

This makes me very happy :D
Comment 3 David Cook 2025-06-18 23:51:45 UTC
I just tested with the syspref endpoint, but that does test all the changes.

Test plan:
0. Apply the patch
1. Log into staff interface
2. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=opacuserjs&ok=Search
3. Add a JS comment
4. Note that it succeeds
5. In a separate tab, log out of the staff interface
6. Try to update the JS comment
7. Note that the message "Error: Forbidden" appears at the top of the page
Comment 4 David Cook 2025-06-18 23:52:27 UTC
Created attachment 183361 [details] [review]
Bug 40172: Replace jQuery with vanilla JS in js/fetch/http-client.js

So that we can reuse it from somewhere else.
The current need is to be able to reuse it from Cypress tests.

Test plan:
Try to hit several places where APIClient is used:
 * Syspref edition
 * Translation of item type description (be aware of bug 40161)
 * Delete of cover images
 * checkin, renew from the checkout list
 * etc.

Note that this does not affect Vue components.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Comment 5 Pedro Amorim 2025-07-08 15:37:03 UTC
Created attachment 183871 [details] [review]
Bug 40172: Replace jQuery with vanilla JS in js/fetch/http-client.js

So that we can reuse it from somewhere else.
The current need is to be able to reuse it from Cypress tests.

Test plan:
Try to hit several places where APIClient is used:
 * Syspref edition
 * Translation of item type description (be aware of bug 40161)
 * Delete of cover images
 * checkin, renew from the checkout list
 * etc.

Note that this does not affect Vue components.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Comment 6 Lucas Gass (lukeg) 2025-07-11 21:29:45 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 7 Paul Derscheid 2025-07-24 08:20:32 UTC
Nice work everyone!

Pushed to 25.05.x
Comment 8 Fridolin Somers 2025-07-31 14:08:32 UTC
Enhancement not pushed to 24.11.x