Bugzilla – Attachment 188974 Details for
Bug 39320
Create a 'landing page' for ERM
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39320: Simplify ERMCounts
Bug-39320-Simplify-ERMCounts.patch (text/plain), 5.98 KB, created by
Jonathan Druart
on 2025-11-03 14:40:51 UTC
(
hide
)
Description:
Bug 39320: Simplify ERMCounts
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-11-03 14:40:51 UTC
Size:
5.98 KB
patch
obsolete
>From bd0b01df13815d03a177069261c1c8b329600526 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 3 Nov 2025 15:36:16 +0100 >Subject: [PATCH] Bug 39320: Simplify ERMCounts > >* Move count endpoint to the definition list >* Remove useless try-catch - we need to retrieve the response from > fetch, not what we do by default. We could add them back later but not > feeling important for now >* Remove not needed function createCountText > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../ModuleDashboard/Widgets/ERMCounts.vue | 63 +++++-------------- > 1 file changed, 14 insertions(+), 49 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard/Widgets/ERMCounts.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard/Widgets/ERMCounts.vue >index a3cc1a7c4f8..2ac37eb9b98 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard/Widgets/ERMCounts.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard/Widgets/ERMCounts.vue >@@ -8,14 +8,14 @@ > v-if="def.page && !def.loading" > :to="{ name: def.page }" > > >- {{ createCountText(def) }} >+ {{ def.i18nLabel(def.count) }} > </router-link> > <span v-else class="inactive-link"> > <div > class="spinner-border spinner-border-sm" > role="status" > ></div> >- {{ createCountText(def) }} >+ {{ def.i18nLabel(def.count) }} > </span> > </strong> > </li> >@@ -58,6 +58,7 @@ export default { > { > page: "AgreementsList", > name: "agreements_count", >+ fetchCount: () => APIClient.erm.agreements.count(), > i18nLabel: count => > __nx("{count} agreement", "{count} agreements", count, { > count, >@@ -68,6 +69,7 @@ export default { > { > page: "LicensesList", > name: "licenses_count", >+ fetchCount: () => APIClient.erm.licenses.count(), > i18nLabel: count => > __nx("{count} license", "{count} licenses", count, { > count, >@@ -78,6 +80,7 @@ export default { > { > page: "EHoldingsLocalPackagesList", > name: "eholdings_packages_count", >+ fetchCount: () => APIClient.erm.localPackages.count(), > i18nLabel: count => > __nx( > "{count} local package", >@@ -91,6 +94,7 @@ export default { > { > page: "EHoldingsLocalTitlesList", > name: "eholdings_titles_count", >+ fetchCount: () => APIClient.erm.localTitles.count(), > i18nLabel: count => > __nx("{count} local title", "{count} local titles", count, { > count, >@@ -101,6 +105,7 @@ export default { > { > page: "UsageStatisticsDataProvidersList", > name: "usage_data_providers_count", >+ fetchCount: () => APIClient.erm.usage_data_providers.count(), > i18nLabel: count => > __nx( > "{count} usage data provider", >@@ -113,53 +118,14 @@ export default { > }, > ]); > >- const createCountText = definition => { >- return definition.i18nLabel(definition.count); >- }; >- > async function getCounts() { >- try { >- const endpoints = [ >- { >- name: "agreements_count", >- endpoint: APIClient.erm.agreements.count(), >- }, >- { >- name: "licenses_count", >- endpoint: APIClient.erm.licenses.count(), >- }, >- { >- name: "eholdings_packages_count", >- endpoint: APIClient.erm.localPackages.count(), >- }, >- { >- name: "eholdings_titles_count", >- endpoint: APIClient.erm.localTitles.count(), >- }, >- { >- name: "usage_data_providers_count", >- endpoint: APIClient.erm.usage_data_providers.count(), >- }, >- ]; >- >- endpoints.forEach(({ name, endpoint }) => { >- endpoint >- .then(response => { >- const definition = countDefinitions.find( >- i => i.name === name >- ); >- if (definition) { >- definition.count = response; >- definition.loading = false; >- } >- }) >- .catch(error => { >- console.error(`Error fetching ${name}:`, error); >- }); >- }); >- } catch (error) { >- console.error(error); >- } >+ await Promise.all( >+ countDefinitions.map(async definition => { >+ const response = await definition.fetchCount(); >+ definition.count = response; >+ definition.loading = false; >+ }) >+ ); > } > > baseWidget.onDashboardMounted(() => { >@@ -172,7 +138,6 @@ export default { > > return { > ...baseWidget, >- createCountText, > countDefinitions, > goToPage, > }; >-- >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 39320
:
187513
|
187514
|
187515
|
187516
|
187517
|
187518
|
187519
|
187520
|
187521
|
187522
|
187563
|
187568
|
187635
|
187636
|
187637
|
187638
|
187639
|
187640
|
187641
|
187642
|
187643
|
187644
|
187645
|
188094
|
188095
|
188096
|
188097
|
188098
|
188099
|
188100
|
188101
|
188102
|
188103
|
188104
|
188151
|
188279
|
188280
|
188281
|
188282
|
188283
|
188284
|
188285
|
188312
|
188315
|
188372
|
188375
|
188376
|
188637
|
188638
|
188639
|
188640
|
188641
|
188830
|
188831
|
188832
|
188833
|
188834
|
188835
|
188836
|
188837
|
188838
|
188839
|
188840
|
188841
|
188842
|
188843
|
188844
|
188845
|
188846
|
188847
|
188848
|
188849
|
188850
|
188851
|
188852
|
188853
|
188854
|
188855
|
188856
|
188857
|
188858
|
188859
|
188860
|
188861
|
188862
|
188863
|
188864
|
188885
|
188886
|
188887
|
188888
|
188889
|
188890
|
188891
|
188892
|
188893
|
188894
|
188895
|
188896
|
188897
|
188898
|
188899
|
188900
|
188901
|
188902
|
188903
|
188904
|
188905
|
188906
|
188907
|
188908
|
188909
|
188910
|
188911
|
188912
|
188913
|
188914
|
188915
|
188916
|
188917
|
188918
|
188919
|
188932
|
188938
|
188939
|
188940
|
188941
|
188942
|
188943
|
188944
|
188945
|
188946
|
188947
|
188948
|
188949
|
188950
|
188951
|
188952
|
188953
|
188954
|
188955
|
188956
|
188957
|
188958
|
188959
|
188960
|
188961
|
188962
|
188963
|
188964
|
188965
|
188966
|
188967
|
188968
|
188969
|
188970
|
188971
|
188972
|
188973
|
188974
|
188980
|
188981
|
188982
|
188987