Bug 32939 - Have generic fetch functions in vue modules
Summary: Have generic fetch functions in vue modules
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Jonathan Druart
QA Contact:
URL:
Keywords:
Depends on: 32806
Blocks: 32925 33290 33443 33485
  Show dependency treegraph
 
Reported: 2023-02-10 12:14 UTC by Pedro Amorim
Modified: 2023-12-28 20:42 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.04
Circulation function:


Attachments
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules (3.80 KB, patch)
2023-02-10 12:22 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules (7.84 KB, patch)
2023-02-10 17:44 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules (18.65 KB, patch)
2023-02-14 16:17 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules (15.26 KB, patch)
2023-02-14 17:27 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules (16.83 KB, patch)
2023-02-14 18:25 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules (17.22 KB, patch)
2023-02-15 09:45 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Have a generic APIClient object (6.23 KB, patch)
2023-02-15 09:45 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Set the default header at lower level (2.93 KB, patch)
2023-02-15 09:45 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Restore checkError (2.17 KB, patch)
2023-02-15 09:45 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Introduce count (1.95 KB, patch)
2023-02-15 09:45 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Introduce count (2.10 KB, patch)
2023-02-15 09:52 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules (15.26 KB, patch)
2023-02-15 11:57 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Have a generic APIClient object (6.23 KB, patch)
2023-02-15 11:57 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Set the default header at lower level (2.93 KB, patch)
2023-02-15 11:57 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Restore checkError (2.17 KB, patch)
2023-02-15 11:57 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Introduce count (2.10 KB, patch)
2023-02-15 11:57 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Fix delete (835 bytes, patch)
2023-02-15 11:57 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: To be removed (1.54 KB, patch)
2023-02-15 11:57 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Uniformize api calls (8.79 KB, patch)
2023-02-15 11:57 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules (15.26 KB, patch)
2023-02-21 13:49 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Have a generic APIClient object (6.23 KB, patch)
2023-02-21 13:49 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Set the default header at lower level (2.93 KB, patch)
2023-02-21 13:49 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Restore checkError (2.17 KB, patch)
2023-02-21 13:49 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Introduce count (2.10 KB, patch)
2023-02-21 13:49 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Fix delete (835 bytes, patch)
2023-02-21 13:50 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Uniformize api calls (8.79 KB, patch)
2023-02-21 13:50 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch agreements (4.34 KB, patch)
2023-02-21 13:50 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch licenses (12.58 KB, patch)
2023-02-21 13:50 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch patrons (3.56 KB, patch)
2023-02-21 13:50 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch vendors (3.72 KB, patch)
2023-02-21 13:50 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch local eHoldings (40.08 KB, patch)
2023-02-21 13:50 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch EBSCO eHoldings (10.16 KB, patch)
2023-02-21 13:50 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Remove fetch/erm.js (3.79 KB, patch)
2023-02-21 13:50 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Use APIClient to replace some more fetch calls (2.47 KB, patch)
2023-02-21 13:50 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Use APIClient to replace PATCH requests (9.25 KB, patch)
2023-02-21 13:50 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules (15.34 KB, patch)
2023-02-21 16:06 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules (15.34 KB, patch)
2023-02-21 16:07 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Have a generic APIClient object (6.31 KB, patch)
2023-02-21 16:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Set the default header at lower level (3.01 KB, patch)
2023-02-21 16:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Restore checkError (2.25 KB, patch)
2023-02-21 16:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Introduce count (2.18 KB, patch)
2023-02-21 16:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Fix delete (918 bytes, patch)
2023-02-21 16:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Uniformize api calls (8.87 KB, patch)
2023-02-21 16:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch agreements (4.42 KB, patch)
2023-02-21 16:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch licenses (12.66 KB, patch)
2023-02-21 16:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch patrons (3.64 KB, patch)
2023-02-21 16:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch vendors (3.80 KB, patch)
2023-02-21 16:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch local eHoldings (40.17 KB, patch)
2023-02-21 16:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch EBSCO eHoldings (10.24 KB, patch)
2023-02-21 16:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Remove fetch/erm.js (3.87 KB, patch)
2023-02-21 16:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Use APIClient to replace some more fetch calls (2.55 KB, patch)
2023-02-21 16:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Use APIClient to replace PATCH requests (9.33 KB, patch)
2023-02-21 16:16 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules (15.37 KB, patch)
2023-02-24 12:22 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: Have a generic APIClient object (6.33 KB, patch)
2023-02-24 12:22 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: Set the default header at lower level (3.04 KB, patch)
2023-02-24 12:22 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: Restore checkError (2.29 KB, patch)
2023-02-24 12:22 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: Introduce count (2.21 KB, patch)
2023-02-24 12:22 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: Fix delete (954 bytes, patch)
2023-02-24 12:22 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: Uniformize api calls (8.90 KB, patch)
2023-02-24 12:22 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch agreements (4.45 KB, patch)
2023-02-24 12:22 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch licenses (12.68 KB, patch)
2023-02-24 12:22 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch patrons (3.67 KB, patch)
2023-02-24 12:22 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch vendors (3.83 KB, patch)
2023-02-24 12:22 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch local eHoldings (40.17 KB, patch)
2023-02-24 12:22 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: Use APIClient to fetch EBSCO eHoldings (10.27 KB, patch)
2023-02-24 12:22 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: Remove fetch/erm.js (3.91 KB, patch)
2023-02-24 12:23 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: Use APIClient to replace some more fetch calls (2.59 KB, patch)
2023-02-24 12:23 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: Use APIClient to replace PATCH requests (9.36 KB, patch)
2023-02-24 12:23 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32939: (follow-up) Use APIClient to fetch vendors (1002 bytes, patch)
2023-02-24 12:24 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32939: (follow-up) Use APIClient to fetch vendors (1.03 KB, patch)
2023-02-24 13:43 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 32939: Fix title endpoint (999 bytes, patch)
2023-04-11 12:58 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Amorim 2023-02-10 12:14:55 UTC

    
Comment 1 Pedro Amorim 2023-02-10 12:22:55 UTC
Created attachment 146470 [details] [review]
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules

In bug 32925 it's discussed the possibility of having a generic fetch function to handle basic CRUD creates and edits for vuejs modules in the future and move all common POST+PUT async requests workflow in there, like the 'Submitting...' loading behaviour.
This POC illustrates this and it's intent is to start discussion, plan on iterating further to the rest of ERM if agreed upon.
Comment 2 Pedro Amorim 2023-02-10 17:44:24 UTC
Created attachment 146509 [details] [review]
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules

In bug 32925 it's discussed the possibility of having a generic fetch function to handle basic CRUD creates and edits for vuejs modules in the future and move all common POST+PUT async requests workflow in there, like the 'Submitting...' loading behaviour.
This POC illustrates this and it's intent is to start discussion, plan on iterating further to the rest of ERM if agreed upon.
Comment 3 Jonathan Druart 2023-02-14 09:12:51 UTC
I love it!

Some feedback:
1. a_id => prefer the full var name, agreement_id ;)

2. if ( this.$route.path.includes("edit") )

I don't really like this, I would prefer to rely on the status code (but I do understand why you did that!). Imagine we have another form on this url, it won't work in all cases.
Actually you don't need this, we know already if we are editing or adding (search for "method", if there is agreement_id it's an edit). Note that there is code that is no longer needed there (variable options, etc.)

3. I would add a "count" method in http-client

4. fetch/api-client.js is a too generic name, it should be tight to the "erm" module. Don't you think? 

5. Looks like we don't need fetch/fetch.js? Was it expected?

6. There are things in http-client.js we are not using, we should remove them.

7. Instead of the async/await you add, shouldn't we prefer client.agreements.(create).then(addMessage())?
Maybe it's only a matter of taste?

8. Code is not tidy, don't forget to install the pre-commit git hook!

I would like a version of this that is before bug 32925, then we added the "isSubmitting info" there.
Comment 4 Pedro Amorim 2023-02-14 16:17:00 UTC
Created attachment 146642 [details] [review]
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules

- Cleaned up the code and further extended the implementation concept on agreements only.
- Jonathan I followed your suggestions but had to keep async/await or the catch will not work if an error is thrown from the http-client
- I'm keeping this as a separate patch for diff check (intention is to squash all of it once we're happy)
- I plan on continuing with this in coming days but more feedback is always welcome, also plan on rebasing this to 32925

Later:
- api-client.js should be renamed to erm-api-client.js (or something of the sort) but I kept the same name for now for diff check
- erm.js will ultimately disappear once this is all done (or api-client.js will become erm.js)
Comment 5 Pedro Amorim 2023-02-14 17:27:25 UTC
Created attachment 146644 [details] [review]
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules

Rebase to 32806 and prior to 32925. Squash
Comment 6 Pedro Amorim 2023-02-14 18:25:06 UTC
Created attachment 146645 [details] [review]
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules

Rebase to 32806 and prior to 32925. Squash
More updates. Ready for review, for now.
Comment 7 Jonathan Druart 2023-02-15 09:45:27 UTC
Created attachment 146668 [details] [review]
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules

Rebase to 32806 and prior to 32925. Squash
More updates. Ready for review, for now.

JD amended patch:
* prettier
* remove changes to AgreementRelationships.vue and EHoldingsLocalPackageAgreements.vue to have less files to update in upcoming patches
Comment 8 Jonathan Druart 2023-02-15 09:45:30 UTC
Created attachment 146669 [details] [review]
Bug 32939: Have a generic APIClient object

You always import the same, only once, and you can access other
resources from the same object.
Comment 9 Jonathan Druart 2023-02-15 09:45:33 UTC
Created attachment 146670 [details] [review]
Bug 32939: Set the default header at lower level
Comment 10 Jonathan Druart 2023-02-15 09:45:37 UTC
Created attachment 146671 [details] [review]
Bug 32939: Restore checkError
Comment 11 Jonathan Druart 2023-02-15 09:45:41 UTC
Created attachment 146672 [details] [review]
Bug 32939: Introduce count

Not used yet, will replace myFetchTotal
Comment 12 Jonathan Druart 2023-02-15 09:52:37 UTC
Created attachment 146674 [details] [review]
Bug 32939: Introduce count

Not used yet, will replace myFetchTotal
Comment 13 Jonathan Druart 2023-02-15 11:57:06 UTC
Created attachment 146675 [details] [review]
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules

Rebase to 32806 and prior to 32925. Squash
More updates. Ready for review, for now.

JD amended patch:
* prettier
* remove changes to AgreementRelationships.vue and EHoldingsLocalPackageAgreements.vue to have less files to update in upcoming patches
Comment 14 Jonathan Druart 2023-02-15 11:57:09 UTC
Created attachment 146676 [details] [review]
Bug 32939: Have a generic APIClient object

You always import the same, only once, and you can access other
resources from the same object.
Comment 15 Jonathan Druart 2023-02-15 11:57:12 UTC
Created attachment 146677 [details] [review]
Bug 32939: Set the default header at lower level
Comment 16 Jonathan Druart 2023-02-15 11:57:15 UTC
Created attachment 146678 [details] [review]
Bug 32939: Restore checkError
Comment 17 Jonathan Druart 2023-02-15 11:57:18 UTC
Created attachment 146679 [details] [review]
Bug 32939: Introduce count

Not used yet, will replace myFetchTotal
Comment 18 Jonathan Druart 2023-02-15 11:57:21 UTC
Created attachment 146680 [details] [review]
Bug 32939: Fix delete
Comment 19 Jonathan Druart 2023-02-15 11:57:25 UTC
Created attachment 146681 [details] [review]
Bug 32939: To be removed

Re-add the function we removed earlier, to prevent failures.
This patch will be dropped later, when we will touch all the
occurrences.
Comment 20 Jonathan Druart 2023-02-15 11:57:27 UTC
Created attachment 146682 [details] [review]
Bug 32939: Uniformize api calls

We want to make the call easier and without less errors possible.
Here, no need to async keyword, try-catch, etc.
Only call the method and use the common then with the 2 success and
error Promise arguments.

We will certainly want to add later a parameter to prevent the display
of the error in fetchJSON, in case the failure does not require a message
for the end user.
Comment 21 Jonathan Druart 2023-02-21 13:49:46 UTC
Created attachment 147029 [details] [review]
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules

Rebase to 32806 and prior to 32925. Squash
More updates. Ready for review, for now.

JD amended patch:
* prettier
* remove changes to AgreementRelationships.vue and EHoldingsLocalPackageAgreements.vue to have less files to update in upcoming patches
Comment 22 Jonathan Druart 2023-02-21 13:49:49 UTC
Created attachment 147030 [details] [review]
Bug 32939: Have a generic APIClient object

You always import the same, only once, and you can access other
resources from the same object.
Comment 23 Jonathan Druart 2023-02-21 13:49:52 UTC
Created attachment 147031 [details] [review]
Bug 32939: Set the default header at lower level
Comment 24 Jonathan Druart 2023-02-21 13:49:55 UTC
Created attachment 147032 [details] [review]
Bug 32939: Restore checkError
Comment 25 Jonathan Druart 2023-02-21 13:49:58 UTC
Created attachment 147033 [details] [review]
Bug 32939: Introduce count

Not used yet, will replace myFetchTotal
Comment 26 Jonathan Druart 2023-02-21 13:50:01 UTC
Created attachment 147034 [details] [review]
Bug 32939: Fix delete
Comment 27 Jonathan Druart 2023-02-21 13:50:04 UTC
Created attachment 147035 [details] [review]
Bug 32939: Uniformize api calls

We want to make the call easier and without less errors possible.
Here, no need to async keyword, try-catch, etc.
Only call the method and use the common then with the 2 success and
error Promise arguments.

We will certainly want to add later a parameter to prevent the display
of the error in fetchJSON, in case the failure does not require a message
for the end user.
Comment 28 Jonathan Druart 2023-02-21 13:50:07 UTC
Created attachment 147036 [details] [review]
Bug 32939: Use APIClient to fetch agreements
Comment 29 Jonathan Druart 2023-02-21 13:50:10 UTC
Created attachment 147037 [details] [review]
Bug 32939: Use APIClient to fetch licenses
Comment 30 Jonathan Druart 2023-02-21 13:50:13 UTC
Created attachment 147038 [details] [review]
Bug 32939: Use APIClient to fetch patrons
Comment 31 Jonathan Druart 2023-02-21 13:50:17 UTC
Created attachment 147039 [details] [review]
Bug 32939: Use APIClient to fetch vendors
Comment 32 Jonathan Druart 2023-02-21 13:50:21 UTC
Created attachment 147040 [details] [review]
Bug 32939: Use APIClient to fetch local eHoldings
Comment 33 Jonathan Druart 2023-02-21 13:50:25 UTC
Created attachment 147041 [details] [review]
Bug 32939: Use APIClient to fetch EBSCO eHoldings
Comment 34 Jonathan Druart 2023-02-21 13:50:29 UTC
Created attachment 147042 [details] [review]
Bug 32939: Remove fetch/erm.js
Comment 35 Jonathan Druart 2023-02-21 13:50:33 UTC
Created attachment 147043 [details] [review]
Bug 32939: Use APIClient to replace some more fetch calls
Comment 36 Jonathan Druart 2023-02-21 13:50:36 UTC
Created attachment 147044 [details] [review]
Bug 32939: Use APIClient to replace PATCH requests
Comment 37 Jonathan Druart 2023-02-21 13:55:06 UTC
Test plan:
Retest the whole ERM module.
Comment 38 Matt Blenkinsop 2023-02-21 15:51:37 UTC
Needs 32981 applied - added to dependencies
Comment 39 Matt Blenkinsop 2023-02-21 16:06:02 UTC
Created attachment 147056 [details] [review]
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules

Rebase to 32806 and prior to 32925. Squash
More updates. Ready for review, for now.

JD amended patch:
* prettier
* remove changes to AgreementRelationships.vue and EHoldingsLocalPackageAgreements.vue to have less files to update in upcoming patches

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 40 Matt Blenkinsop 2023-02-21 16:07:38 UTC
Created attachment 147057 [details] [review]
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules

Rebase to 32806 and prior to 32925. Squash
More updates. Ready for review, for now.

JD amended patch:
* prettier
* remove changes to AgreementRelationships.vue and EHoldingsLocalPackageAgreements.vue to have less files to update in upcoming patches

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 41 Matt Blenkinsop 2023-02-21 16:15:12 UTC
Created attachment 147059 [details] [review]
Bug 32939: Have a generic APIClient object

You always import the same, only once, and you can access other
resources from the same object.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 42 Matt Blenkinsop 2023-02-21 16:15:15 UTC
Created attachment 147060 [details] [review]
Bug 32939: Set the default header at lower level

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 43 Matt Blenkinsop 2023-02-21 16:15:19 UTC
Created attachment 147061 [details] [review]
Bug 32939: Restore checkError

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 44 Matt Blenkinsop 2023-02-21 16:15:22 UTC
Created attachment 147062 [details] [review]
Bug 32939: Introduce count

Not used yet, will replace myFetchTotal

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 45 Matt Blenkinsop 2023-02-21 16:15:26 UTC
Created attachment 147063 [details] [review]
Bug 32939: Fix delete

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 46 Matt Blenkinsop 2023-02-21 16:15:30 UTC
Created attachment 147064 [details] [review]
Bug 32939: Uniformize api calls

We want to make the call easier and without less errors possible.
Here, no need to async keyword, try-catch, etc.
Only call the method and use the common then with the 2 success and
error Promise arguments.

We will certainly want to add later a parameter to prevent the display
of the error in fetchJSON, in case the failure does not require a message
for the end user.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 47 Matt Blenkinsop 2023-02-21 16:15:33 UTC
Created attachment 147065 [details] [review]
Bug 32939: Use APIClient to fetch agreements

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 48 Matt Blenkinsop 2023-02-21 16:15:37 UTC
Created attachment 147066 [details] [review]
Bug 32939: Use APIClient to fetch licenses

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 49 Matt Blenkinsop 2023-02-21 16:15:41 UTC
Created attachment 147067 [details] [review]
Bug 32939: Use APIClient to fetch patrons

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 50 Matt Blenkinsop 2023-02-21 16:15:44 UTC
Created attachment 147068 [details] [review]
Bug 32939: Use APIClient to fetch vendors

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 51 Matt Blenkinsop 2023-02-21 16:15:47 UTC
Created attachment 147069 [details] [review]
Bug 32939: Use APIClient to fetch local eHoldings

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 52 Matt Blenkinsop 2023-02-21 16:15:51 UTC
Created attachment 147070 [details] [review]
Bug 32939: Use APIClient to fetch EBSCO eHoldings

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 53 Matt Blenkinsop 2023-02-21 16:15:54 UTC
Created attachment 147071 [details] [review]
Bug 32939: Remove fetch/erm.js

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 54 Matt Blenkinsop 2023-02-21 16:15:57 UTC
Created attachment 147072 [details] [review]
Bug 32939: Use APIClient to replace some more fetch calls

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 55 Matt Blenkinsop 2023-02-21 16:16:01 UTC
Created attachment 147073 [details] [review]
Bug 32939: Use APIClient to replace PATCH requests

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 56 David Cook 2023-02-23 01:04:26 UTC
I wonder if it would be useful to implement a simple feature or a Koha plugin using Vue.js to see which components need to be specific to ERM and which need to be more generalized/re-usable...
Comment 57 Jonathan Druart 2023-02-23 07:41:20 UTC
(In reply to David Cook from comment #56)
> I wonder if it would be useful to implement a simple feature or a Koha
> plugin using Vue.js to see which components need to be specific to ERM and
> which need to be more generalized/re-usable...

I am already working on another module, on top of this tree. This is the result of the different situations I faced.
Comment 58 David Cook 2023-02-23 22:46:48 UTC
(In reply to Jonathan Druart from comment #57)
> (In reply to David Cook from comment #56)
> > I wonder if it would be useful to implement a simple feature or a Koha
> > plugin using Vue.js to see which components need to be specific to ERM and
> > which need to be more generalized/re-usable...
> 
> I am already working on another module, on top of this tree. This is the
> result of the different situations I faced.

Great! I'm very busy the next week, but sometime soon I want to stay online late, so that we can chat more about Vue.js in Koha on IRC.
Comment 59 Nick Clemens (kidclamp) 2023-02-24 12:22:26 UTC
Created attachment 147306 [details] [review]
Bug 32939: Have a generic fetch function for POST and PUT requests in vue modules

Rebase to 32806 and prior to 32925. Squash
More updates. Ready for review, for now.

JD amended patch:
* prettier
* remove changes to AgreementRelationships.vue and EHoldingsLocalPackageAgreements.vue to have less files to update in upcoming patches

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 60 Nick Clemens (kidclamp) 2023-02-24 12:22:28 UTC
Created attachment 147307 [details] [review]
Bug 32939: Have a generic APIClient object

You always import the same, only once, and you can access other
resources from the same object.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 61 Nick Clemens (kidclamp) 2023-02-24 12:22:31 UTC
Created attachment 147308 [details] [review]
Bug 32939: Set the default header at lower level

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 62 Nick Clemens (kidclamp) 2023-02-24 12:22:34 UTC
Created attachment 147309 [details] [review]
Bug 32939: Restore checkError

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 63 Nick Clemens (kidclamp) 2023-02-24 12:22:36 UTC
Created attachment 147310 [details] [review]
Bug 32939: Introduce count

Not used yet, will replace myFetchTotal

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 64 Nick Clemens (kidclamp) 2023-02-24 12:22:39 UTC
Created attachment 147311 [details] [review]
Bug 32939: Fix delete

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 65 Nick Clemens (kidclamp) 2023-02-24 12:22:41 UTC
Created attachment 147312 [details] [review]
Bug 32939: Uniformize api calls

We want to make the call easier and without less errors possible.
Here, no need to async keyword, try-catch, etc.
Only call the method and use the common then with the 2 success and
error Promise arguments.

We will certainly want to add later a parameter to prevent the display
of the error in fetchJSON, in case the failure does not require a message
for the end user.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 66 Nick Clemens (kidclamp) 2023-02-24 12:22:44 UTC
Created attachment 147313 [details] [review]
Bug 32939: Use APIClient to fetch agreements

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 67 Nick Clemens (kidclamp) 2023-02-24 12:22:47 UTC
Created attachment 147314 [details] [review]
Bug 32939: Use APIClient to fetch licenses

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 68 Nick Clemens (kidclamp) 2023-02-24 12:22:49 UTC
Created attachment 147315 [details] [review]
Bug 32939: Use APIClient to fetch patrons

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 69 Nick Clemens (kidclamp) 2023-02-24 12:22:52 UTC
Created attachment 147316 [details] [review]
Bug 32939: Use APIClient to fetch vendors

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 70 Nick Clemens (kidclamp) 2023-02-24 12:22:55 UTC
Created attachment 147317 [details] [review]
Bug 32939: Use APIClient to fetch local eHoldings

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 71 Nick Clemens (kidclamp) 2023-02-24 12:22:57 UTC
Created attachment 147318 [details] [review]
Bug 32939: Use APIClient to fetch EBSCO eHoldings

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 72 Nick Clemens (kidclamp) 2023-02-24 12:23:00 UTC
Created attachment 147319 [details] [review]
Bug 32939: Remove fetch/erm.js

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 73 Nick Clemens (kidclamp) 2023-02-24 12:23:02 UTC
Created attachment 147320 [details] [review]
Bug 32939: Use APIClient to replace some more fetch calls

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 74 Nick Clemens (kidclamp) 2023-02-24 12:23:05 UTC
Created attachment 147321 [details] [review]
Bug 32939: Use APIClient to replace PATCH requests

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 75 Jonathan Druart 2023-02-24 12:24:00 UTC
Created attachment 147322 [details] [review]
Bug 32939: (follow-up) Use APIClient to fetch vendors
Comment 76 Paul Derscheid 2023-02-24 13:36:03 UTC
Really cool to see how this thing is evolving!
Comment 77 Pedro Amorim 2023-02-24 13:43:17 UTC
Created attachment 147332 [details] [review]
Bug 32939: (follow-up) Use APIClient to fetch vendors

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Comment 78 Tomás Cohen Arazi (tcohen) 2023-02-27 14:22:51 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 79 Matt Blenkinsop 2023-02-28 19:10:02 UTC
Nice work everyone!

Pushed to stable for 22.11.x
Comment 80 Lucas Gass (lukeg) 2023-03-08 14:09:35 UTC
Not needed in 22.05.x
Comment 81 Jonathan Druart 2023-04-11 12:58:03 UTC
Created attachment 149441 [details] [review]
Bug 32939: Fix title endpoint
Comment 82 Jonathan Druart 2023-04-11 12:59:30 UTC
(In reply to Jonathan Druart from comment #81)
> Created attachment 149441 [details] [review] [review]
> Bug 32939: Fix title endpoint

Moved to bug 33485.