Bugzilla – Attachment 150362 Details for
Bug 33623
getAll not encoding URL params
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33623: Move ULSearchParams into http-client.js
Bug-33623-Move-ULSearchParams-into-http-clientjs.patch (text/plain), 6.85 KB, created by
Pedro Amorim
on 2023-04-28 10:45:14 UTC
(
hide
)
Description:
Bug 33623: Move ULSearchParams into http-client.js
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2023-04-28 10:45:14 UTC
Size:
6.85 KB
patch
obsolete
>From b6d633d53888a69f6297290e8a9f22090173e624 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Fri, 28 Apr 2023 10:23:35 +0000 >Subject: [PATCH] Bug 33623: Move ULSearchParams into http-client.js > >Remove unused getAll methods in erm-api-client.js >Make use of new getAll query in AgreementRelationships >--- > .../components/ERM/AgreementRelationships.vue | 18 +++--- > .../prog/js/vue/fetch/erm-api-client.js | 63 +++---------------- > .../prog/js/vue/fetch/http-client.js | 13 ++++ > 3 files changed, 31 insertions(+), 63 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementRelationships.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementRelationships.vue >index 0465bb867e..5cf3a23314 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementRelationships.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementRelationships.vue >@@ -99,15 +99,15 @@ export default { > }, > beforeCreate() { > const client = APIClient.erm >- client.agreements.getAll().then( >- agreements => { >- this.agreements = agreements.filter( >- agreement => agreement.agreement_id !== this.agreement_id >- ) >- this.initialized = true >- }, >- error => {} >- ) >+ client.agreements >+ .getAll({ "me.agreement_id": { "!=": this.agreement_id } }) >+ .then( >+ agreements => { >+ this.agreements = agreements >+ this.initialized = true >+ }, >+ error => {} >+ ) > }, > methods: { > addRelationship() { >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js >index d28320f176..f9be2c5aa0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js >@@ -18,13 +18,9 @@ export class ERMAPIClient extends HttpClient { > }, > }), > getAll: query => >- this.get({ >- endpoint: >- "agreements?" + >- new URLSearchParams({ >- _per_page: -1, >- ...(query && { q: JSON.stringify(query) }), >- }), >+ this.getAll({ >+ endpoint: "agreements", >+ query: query, > }), > delete: id => > this.delete({ >@@ -64,13 +60,9 @@ export class ERMAPIClient extends HttpClient { > }, > }), > getAll: query => >- this.get({ >- endpoint: >- "licenses?" + >- new URLSearchParams({ >- _per_page: -1, >- ...(query && { q: JSON.stringify(query) }), >- }), >+ this.getAll({ >+ endpoint: "licenses", >+ query: query, > headers: { > "x-koha-embed": "vendor", > }, >@@ -113,13 +105,9 @@ export class ERMAPIClient extends HttpClient { > }, > }), > getAll: query => >- this.get({ >- endpoint: >- "eholdings/local/packages?" + >- new URLSearchParams({ >- _per_page: -1, >- ...(query && { q: JSON.stringify(query) }), >- }), >+ this.getAll({ >+ endpoint: "eholdings/local/packages", >+ query: query, > headers: { > "x-koha-embed": "resources+count,vendor.name", > }, >@@ -160,15 +148,6 @@ export class ERMAPIClient extends HttpClient { > "x-koha-embed": "resources,resources.package", > }, > }), >- getAll: query => >- this.get({ >- endpoint: >- "eholdings/local/titles?" + >- new URLSearchParams({ >- _per_page: -1, >- ...(query && { q: JSON.stringify(query) }), >- }), >- }), > delete: id => > this.delete({ > endpoint: "eholdings/local/titles/" + id, >@@ -223,20 +202,6 @@ export class ERMAPIClient extends HttpClient { > "package_agreements,package_agreements.agreement,resources+count,vendor", > }, > }), >- getAll: query => >- this.get({ >- endpoint: >- "eholdings/ebsco/packages/" + >- id + >- "?" + >- new URLSearchParams({ >- _per_page: -1, >- ...(query && { q: JSON.stringify(query) }), >- }), >- headers: { >- "x-koha-embed": "resources+count,vendor.name", >- }, >- }), > patch: (id, body) => > this.patch({ > endpoint: "eholdings/ebsco/packages/" + id, >@@ -254,16 +219,6 @@ export class ERMAPIClient extends HttpClient { > "x-koha-embed": "resources,resources.package", > }, > }), >- getAll: query => >- this.get({ >- endpoint: >- "eholdings/local/ebsco/titles" + >- "?" + >- new URLSearchParams({ >- _per_page: -1, >- ...(query && { q: JSON.stringify(query) }), >- }), >- }), > }; > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/http-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/http-client.js >index ac999e9f9a..fda106b9e1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/http-client.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/http-client.js >@@ -50,6 +50,19 @@ class HttpClient { > }); > } > >+ getAll(params = {}) { >+ let url = >+ params.endpoint + "?" + >+ new URLSearchParams({ >+ _per_page: -1, >+ ...(params.query && { q: JSON.stringify(params.query) }), >+ }) >+ return this._fetchJSON(url, params.headers, { >+ ...params.options, >+ method: "GET", >+ }); >+ } >+ > post(params = {}) { > const body = params.body > ? typeof params.body === "string" >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33623
:
150281
|
150362
|
150498
|
150499
|
150506
|
150507