Bugzilla – Attachment 180770 Details for
Bug 37930
Change how we handle authorised values in Vue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37930: Return actions from the composable file
Bug-37930-Return-actions-from-the-composable-file.patch (text/plain), 3.66 KB, created by
Jonathan Druart
on 2025-04-10 13:14:45 UTC
(
hide
)
Description:
Bug 37930: Return actions from the composable file
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-04-10 13:14:45 UTC
Size:
3.66 KB
patch
obsolete
>From df247a9d06b6f2110765f1e752b45081efa85fb2 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 7 Apr 2025 12:50:09 +0200 >Subject: [PATCH] Bug 37930: Return actions from the composable file > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../js/vue/composables/authorisedValues.js | 26 ++++++++++++++++--- > .../intranet-tmpl/prog/js/vue/stores/erm.js | 15 +++-------- > 2 files changed, 26 insertions(+), 15 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/composables/authorisedValues.js b/koha-tmpl/intranet-tmpl/prog/js/vue/composables/authorisedValues.js >index 3bfdb9ac305..c6861e9245f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/composables/authorisedValues.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/composables/authorisedValues.js >@@ -1,6 +1,6 @@ > import { APIClient } from "../fetch/api-client.js"; > >-export const get_lib_from_av_handler = (arr_name, av, store) => { >+const get_lib_from_av_handler = (arr_name, av, store) => { > if (store.authorisedValues[arr_name] === undefined) { > console.warn( > "The authorised value category for '%s' is not defined.".format( >@@ -12,14 +12,17 @@ export const get_lib_from_av_handler = (arr_name, av, store) => { > let o = store.authorisedValues[arr_name].find(e => e.value == av); > return o ? o.description : av; > }; >-export const map_av_dt_filter_handler = (arr_name, store) => { >+const map_av_dt_filter_handler = (arr_name, store) => { > return store.authorisedValues[arr_name].map(e => { > e["_id"] = e["value"]; > e["_str"] = e["description"]; > return e; > }); > }; >-export const loadAuthorisedValues = async (authorisedValues, targetStore) => { >+const load_authorised_values_handler = async ( >+ authorisedValues, >+ targetStore >+) => { > const AVsToFetch = Object.keys(authorisedValues).reduce((acc, avKey) => { > if (Array.isArray(authorisedValues[avKey])) return acc; > acc[avKey] = authorisedValues[avKey]; >@@ -48,3 +51,20 @@ export const loadAuthorisedValues = async (authorisedValues, targetStore) => { > > return Promise.all(promises); > }; >+ >+export function withAuthorisedValueActions(store) { >+ return { >+ loadAuthorisedValues(authorisedValues, targetStore) { >+ return load_authorised_values_handler( >+ authorisedValues, >+ targetStore >+ ); >+ }, >+ get_lib_from_av(arr_name, av) { >+ return get_lib_from_av_handler(arr_name, av, store); >+ }, >+ map_av_dt_filter(arr_name) { >+ return map_av_dt_filter_handler(arr_name, store); >+ }, >+ }; >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/erm.js b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/erm.js >index 244501ea158..3a32409c99f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/erm.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/erm.js >@@ -1,9 +1,6 @@ > import { defineStore } from "pinia"; >-import { >- loadAuthorisedValues, >- get_lib_from_av_handler, >- map_av_dt_filter_handler, >-} from "../composables/authorisedValues"; >+ >+import { withAuthorisedValueActions } from "../composables/authorisedValues"; > > export const useERMStore = defineStore("erm", { > state: () => ({ >@@ -65,12 +62,6 @@ export const useERMStore = defineStore("erm", { > }, > }), > actions: { >- loadAuthorisedValues, >- get_lib_from_av(arr_name, av) { >- return get_lib_from_av_handler(arr_name, av, this); >- }, >- map_av_dt_filter(arr_name) { >- return map_av_dt_filter_handler(arr_name, this); >- }, >+ ...withAuthorisedValueActions(this), > }, > }); >-- >2.34.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 37930
:
171556
|
171557
|
171558
|
171628
|
172863
|
172864
|
172865
|
172886
|
172887
|
172888
|
172979
|
173069
|
176677
|
176678
|
176679
|
176719
|
176720
|
176721
|
176722
|
176830
|
178248
|
178249
|
178250
|
178251
|
180243
|
180244
|
180245
|
180246
|
180689
|
180698
|
180699
|
180700
|
180701
|
180767
|
180768
|
180769
| 180770 |
180771
|
180772
|
180773
|
180774
|
180775