Bugzilla – Attachment 144715 Details for
Bug 32468
Vendors select only allows selecting from first 20 vendors by default
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32468: Use fetchLocalTitleCount to know if local titles exist
Bug-32468-Use-fetchLocalTitleCount-to-know-if-loca.patch (text/plain), 6.97 KB, created by
Martin Renvoize (ashimema)
on 2022-12-19 14:42:41 UTC
(
hide
)
Description:
Bug 32468: Use fetchLocalTitleCount to know if local titles exist
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-12-19 14:42:41 UTC
Size:
6.97 KB
patch
obsolete
>From 9fd6ba6c1fc1e9502425416001980b492fc822be Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 15 Dec 2022 08:17:16 +0100 >Subject: [PATCH] Bug 32468: Use fetchLocalTitleCount to know if local titles > exist > >We don't need to fetch 20 titles to know if there is at least one. We >should call fetchLocalTitleCount. > >Note that this should be implemented for all 'List' views. > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../ERM/EHoldingsEBSCOTitlesList.vue | 16 +++++------ > .../ERM/EHoldingsLocalTitlesList.vue | 21 ++++++-------- > koha-tmpl/intranet-tmpl/prog/js/vue/fetch.js | 28 +++++++++++-------- > 3 files changed, 32 insertions(+), 33 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlesList.vue >index 3554c0f00ed..7e807400ea3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlesList.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlesList.vue >@@ -46,15 +46,13 @@ > > > <div > v-if=" >- local_count_titles !== undefined && >- local_count_titles !== null >+ local_title_count !== undefined && >+ local_title_count !== null > " > > > <router-link :to="local_titles_url"> > {{ >- $__("%s titles found locally").format( >- local_count_titles >- ) >+ $__("%s titles found locally").format(local_title_count) > }}</router-link > > > </div> >@@ -68,7 +66,7 @@ > <script> > import { inject, createVNode, render } from "vue" > import { storeToRefs } from "pinia" >-import { fetchCountLocalTitles } from "./../../fetch" >+import { fetchLocalTitleCount } from "./../../fetch" > import { > useDataTable, > build_url_params, >@@ -106,7 +104,7 @@ export default { > }, > cannot_search: false, > show_table: false, >- local_count_titles: null, >+ local_title_count: null, > } > }, > computed: { >@@ -137,12 +135,12 @@ export default { > ) > this.$router.push(new_route) > this.show_table = true >- this.local_count_titles = null >+ this.local_title_count = null > $("#" + this.table_id) > .DataTable() > .draw() > if (this.erm_providers.includes("local")) { >- this.local_count_titles = await fetchCountLocalTitles( >+ this.local_title_count = await fetchLocalTitleCount( > this.filters > ) > } >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue >index 7cf7bcdfb5d..a30c5a65ad5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue >@@ -1,14 +1,10 @@ > <template> > <div> > <div v-if="!initialized">{{ $__("Loading") }}</div> >- <div v-else-if="titles" id="titles_list"> >+ <div v-else-if="title_count" id="titles_list"> > <Toolbar /> >- <div >- v-if="titles.length" >- id="title_list_result" >- class="page-section" >- > >- <table v-if="titles.length" :id="table_id"></table> >+ <div v-if="title_count" id="title_list_result" class="page-section"> >+ <table v-if="title_count" :id="table_id"></table> > </div> > <div v-else-if="initialized" class="dialog message"> > {{ $__("There are no titles defined") }} >@@ -21,7 +17,7 @@ > import Toolbar from "./EHoldingsLocalTitlesToolbar.vue" > import { inject, createVNode, render } from "vue" > import { storeToRefs } from "pinia" >-import { fetchLocalTitles } from "../../fetch" >+import { fetchLocalTitleCount } from "../../fetch" > import { useDataTable } from "../../composables/datatables" > > export default { >@@ -42,7 +38,7 @@ export default { > }, > data: function () { > return { >- titles: [], >+ title_count: undefined, > initialized: false, > filters: { > publication_title: this.$route.query.publication_title || "", >@@ -53,13 +49,12 @@ export default { > }, > beforeRouteEnter(to, from, next) { > next(vm => { >- vm.getTitles().then(() => vm.build_datatable()) >+ vm.getTitleCount().then(() => vm.build_datatable()) > }) > }, > methods: { >- async getTitles() { >- const titles = await fetchLocalTitles() >- this.titles = titles >+ async getTitleCount() { >+ this.title_count = await fetchLocalTitleCount() > this.initialized = true > }, > show_title: function (title_id) { >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch.js >index 39ff7c9f7e1..4ee84a97902 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch.js >@@ -290,19 +290,25 @@ export const fetchEBSCOTitles = function () { > return _fetchTitles(apiUrl); > }; > >-export const fetchCountLocalTitles = async function (filters) { >- const q = { >- "me.publication_title": { >- like: "%" + filters.publication_title + "%", >- }, >- ...(filters.publication_type >- ? { "me.publication_type": filters.publication_type } >- : {}), >- }; >+export const fetchLocalTitleCount = async function (filters) { >+ const q = filters >+ ? { >+ ...(filters.publication_title >+ ? { >+ "me.publication_title": { >+ like: "%" + filters.publication_title + "%", >+ }, >+ } >+ : {}), >+ ...(filters.publication_type >+ ? { "me.publication_type": filters.publication_type } >+ : {}), >+ } >+ : undefined; > const params = { > _page: 1, > _per_page: 1, >- q: JSON.stringify(q), >+ ...(q ? { q: JSON.stringify(q) } : {}), > }; > let count_local_titles; > var apiUrl = "/api/v1/erm/eholdings/local/titles"; >@@ -367,7 +373,7 @@ export const fetchEBSCOResources = function () { > return _fetchResources(apiUrl); > }; > >-export const checkError = function(response) { >+export const checkError = function (response) { > if (response.status >= 200 && response.status <= 299) { > return response.json(); > } else { >-- >2.39.0
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 32468
:
144601
|
144602
|
144603
|
144620
|
144621
|
144622
|
144714
| 144715 |
144716