Bug 33289 - Vue - Add API client class to interact with svc/config/systempreferences
Summary: Vue - Add API client class to interact with svc/config/systempreferences
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 33290
Blocks: 30708 33408
  Show dependency treegraph
 
Reported: 2023-03-21 07:47 UTC by Jonathan Druart
Modified: 2024-07-04 20:37 UTC (History)
4 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.05
Circulation function:


Attachments
Bug 33289: Add API client class to interact with svc/config/systempreferences (2.70 KB, patch)
2023-03-21 08:05 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 33289: Add API client class to interact with svc/config/systempreferences (2.75 KB, patch)
2023-03-23 10:12 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 33289: DO NOT PUSH - test plan only (1016 bytes, patch)
2023-04-12 11:03 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 33289: Add API client class to interact with svc/config/systempreferences (2.82 KB, patch)
2023-04-12 11:18 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2023-03-21 07:47:10 UTC
From Vue components.
Comment 1 Jonathan Druart 2023-03-21 08:05:06 UTC
Created attachment 148442 [details] [review]
Bug 33289: Add API client class to interact with svc/config/systempreferences

On bug 30708 we will need to modify sysprefs from the UI (Vue app), it
could be useful for other developments as well and so it is moved on its
own bug report.

Test plan:
It can be tested independently of bug 30708 using the following code:

const client = APIClient.sysprefs
client.sysprefs
    .update(
        "CardnumberLength",
        "42"
    )

Sponsored-by: BULAC - http://www.bulac.fr/
Comment 2 Pedro Amorim 2023-03-23 10:12:23 UTC
Created attachment 148596 [details] [review]
Bug 33289: Add API client class to interact with svc/config/systempreferences

On bug 30708 we will need to modify sysprefs from the UI (Vue app), it
could be useful for other developments as well and so it is moved on its
own bug report.

Test plan:
It can be tested independently of bug 30708 using the following code:

const client = APIClient.sysprefs
client.sysprefs
    .update(
        "CardnumberLength",
        "42"
    )

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Comment 3 Katrin Fischer 2023-04-09 13:31:49 UTC
Sorry, the test plan is not detailed enough for me - can you please add some more info?
Comment 4 Jonathan Druart 2023-04-11 10:34:46 UTC
(In reply to Katrin Fischer from comment #3)
> Sorry, the test plan is not detailed enough for me - can you please add some
> more info?

You need to play with the code, or test a follow-up bug.

The code I pasted in the commit message is enough to test the change. You can pick a place in a Vue component ('script' part),  add the change, hit the page when the component is mounted, then confirm that the syspref value has been changed in DB.
Comment 5 Katrin Fischer 2023-04-11 20:29:31 UTC
(In reply to Jonathan Druart from comment #4)
> (In reply to Katrin Fischer from comment #3)
> > Sorry, the test plan is not detailed enough for me - can you please add some
> > more info?
> 
> You need to play with the code, or test a follow-up bug.
> 
> The code I pasted in the commit message is enough to test the change. You
> can pick a place in a Vue component ('script' part),  add the change, hit
> the page when the component is mounted, then confirm that the syspref value
> has been changed in DB.

I only understood half of that, probably because I have not even basic knowledge of how Vue works. I'll leave this to someone more knowledgeable.
Comment 6 Pedro Amorim 2023-04-12 11:03:37 UTC
Created attachment 149525 [details] [review]
Bug 33289: DO NOT PUSH - test plan only
Comment 7 Pedro Amorim 2023-04-12 11:06:22 UTC
@Katrin:

Before applying patches:
* Verify that 'cardnumberlength' is empty in the system preferences

Apply both patches:
* Visit /cgi-bin/koha/erm/agreements
(it will run the test code to change a syspref value from the api-client.js + http-client.js)
* Go back to the system preferences and verify that 'cardnumberlength' now has a value of 42
Comment 8 Martin Renvoize (ashimema) 2023-04-12 11:18:51 UTC
Created attachment 149526 [details] [review]
Bug 33289: Add API client class to interact with svc/config/systempreferences

On bug 30708 we will need to modify sysprefs from the UI (Vue app), it
could be useful for other developments as well and so it is moved on its
own bug report.

Test plan:
It can be tested independently of bug 30708 using the following code:

const client = APIClient.sysprefs
client.sysprefs
    .update(
        "CardnumberLength",
        "42"
    )

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize (ashimema) 2023-04-12 11:19:40 UTC
Clear and simple code all working as expected.

Passing QA
Comment 10 Tomás Cohen Arazi (tcohen) 2023-04-13 14:49:34 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 11 Matt Blenkinsop 2023-04-17 09:16:30 UTC
Nice work everyone!

Pushed to stable for 22.11.x
Comment 12 Lucas Gass (lukeg) 2023-05-05 22:09:33 UTC
Missing dependencies for 22.05.x backport.