Bugzilla – Attachment 149131 Details for
Bug 33408
Fetch sysprefs from svc/config/systempreferences
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33408: Fetch sysprefs from svc/config/systempreferences
Bug-33408-Fetch-sysprefs-from-svcconfigsystemprefe.patch (text/plain), 2.12 KB, created by
Jonathan Druart
on 2023-04-04 15:04:11 UTC
(
hide
)
Description:
Bug 33408: Fetch sysprefs from svc/config/systempreferences
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-04-04 15:04:11 UTC
Size:
2.12 KB
patch
obsolete
>From 82f97515af5f3856bb40d91c08820b16637f857c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 4 Apr 2023 15:51:51 +0200 >Subject: [PATCH] Bug 33408: Fetch sysprefs from svc/config/systempreferences > >It will be easier to mock/set them from cypress tests. >--- > .../fetch/system-preferences-api-client.js | 4 +++ > svc/config/systempreferences | 30 +++++++++++++++++++ > 2 files changed, 34 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/system-preferences-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/system-preferences-api-client.js >index 1e4cd3f7a70..f11906630fc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/system-preferences-api-client.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/system-preferences-api-client.js >@@ -9,6 +9,10 @@ export class SysprefAPIClient extends HttpClient { > > get sysprefs() { > return { >+ get: (variable) => >+ this.get({ >+ endpoint: `/?pref=${variable}`, >+ }), > update: (variable, value) => > this.post({ > endpoint: "", >diff --git a/svc/config/systempreferences b/svc/config/systempreferences >index acaf3e485f9..367f220b44f 100755 >--- a/svc/config/systempreferences >+++ b/svc/config/systempreferences >@@ -70,6 +70,35 @@ sub set_preference { > C4::Service->return_success( $response ); > } > >+=head2 get_preference >+ >+=over 4 >+ >+=item url path >+ >+GET /svc/config/systempreferences/$preference >+ >+=item url query >+ >+preference=$pref_name >+ >+=back >+ >+Used to get a single system preference. >+ >+=cut >+ >+sub get_preference { >+ my $preference = scalar $query->param('pref'); >+ >+ my $value = C4::Context->preference( $preference ); >+ $response->param( value => $value ); >+ >+ C4::Service->return_success( $response ); >+} >+ >+ >+ > =head2 set_preferences > > =over 4 >@@ -109,4 +138,5 @@ sub set_preferences { > C4::Service->dispatch( > [ 'POST /([A-Za-z0-9_-]+)', [ 'value' ], \&set_preference ], > [ 'POST /', [], \&set_preferences ], >+ [ 'GET /', [ 'pref' ], \&get_preference], > ); >-- >2.25.1
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 33408
:
149131
|
149132
|
149133
|
149134
|
149184
|
149185
|
149186
|
149196
|
149197
|
149198
|
149200
|
149204
|
149205
|
149206
|
149207
|
149208
|
149209
|
149254
|
149438
|
149516
|
149517
|
149518
|
149535
|
149536
|
149537
|
149538
|
149539
|
149540
|
149541
|
149542
|
149543
|
149570