Bugzilla – Attachment 156483 Details for
Bug 32474
Implement infinite scroll in vue-select
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32474: Pass label and identifier
Bug-32474-Pass-label-and-identifier.patch (text/plain), 4.35 KB, created by
Jonathan Druart
on 2023-10-03 08:28:45 UTC
(
hide
)
Description:
Bug 32474: Pass label and identifier
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-10-03 08:28:45 UTC
Size:
4.35 KB
patch
obsolete
>From 6f642cbb02c51801b062783619331570deaed446 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 3 Oct 2023 10:22:46 +0200 >Subject: [PATCH] Bug 32474: Pass label and identifier > >This is a try to fix the last remaining Cypress failure. >The problem is that the label of the existing license does not display, >only its id. >To recreate: >Create a license >Create an agreement and select the license >Edit the agreement >=> The display shows "License: {id}", not its name > >This patch is removing the code from created() because I thought it was >the problem originally, and it didn't seem correct to let >InfiniteScrollSelect deal with the "id" and "label" for the different >dataType. But the problem is somewhere else: we have not fetched any >licenses yet from the AgreementLicenses. However we do have the selected >license that we could pass to InfiniteScrollSelect, but that's yet >another param to pass. It feels like there is something better to do >here. >--- > .../vue/components/ERM/AgreementLicenses.vue | 2 ++ > .../vue/components/InfiniteScrollSelect.vue | 32 +++---------------- > 2 files changed, 7 insertions(+), 27 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementLicenses.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementLicenses.vue >index cab8cb1927a..27664975ff2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementLicenses.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementLicenses.vue >@@ -22,6 +22,8 @@ > <InfiniteScrollSelect > :id="`license_id_${counter}`" > v-model="agreement_license.license_id" >+ dataIdentifier="license_id" >+ label="name" > dataType="licenses" > :required="true" > /> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/InfiniteScrollSelect.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/InfiniteScrollSelect.vue >index f92726b3a02..f7d408b481b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/InfiniteScrollSelect.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/InfiniteScrollSelect.vue >@@ -2,7 +2,7 @@ > <v-select > :id="id" > v-model="model" >- :label="queryProperty" >+ :label="label" > :options="paginationRequired ? paginated : data" > :reduce="item => item[dataIdentifier]" > @open="onOpen" >@@ -30,40 +30,18 @@ > import { APIClient } from "../fetch/api-client.js" > > export default { >- created() { >- switch (this.dataType) { >- case "vendors": >- this.dataIdentifier = "id" >- this.queryProperty = "name" >- break >- case "agreements": >- this.dataIdentifier = "agreement_id" >- this.queryProperty = "name" >- break >- case "licenses": >- this.dataIdentifier = "license_id" >- this.queryProperty = "name" >- break >- case "localPackages": >- this.dataIdentifier = "package_id" >- this.queryProperty = "name" >- break >- default: >- break >- } >- }, > props: { > id: String, > dataType: String, > modelValue: Number, >+ label: String, >+ dataIdentifier: String, > required: Boolean, > }, > emits: ["update:modelValue"], > data() { > return { > observer: null, >- dataIdentifier: null, >- queryProperty: null, > limit: null, > search: "", > scrollPage: null, >@@ -82,7 +60,7 @@ export default { > }, > filtered() { > return this.data.filter(item => >- item[this.queryProperty].includes(this.search) >+ item[this.label].includes(this.search) > ) > }, > paginated() { >@@ -124,7 +102,7 @@ export default { > this.data = [] > this.search = e > const client = APIClient.erm >- const attribute = "me." + this.queryProperty >+ const attribute = "me." + this.label > const q = {} > q[attribute] = { like: `%${e}%` } > await client[this.dataType] >-- >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 32474
:
144614
|
144719
|
144720
|
145143
|
145144
|
145154
|
150030
|
150031
|
150282
|
150283
|
150284
|
150287
|
150305
|
150308
|
150309
|
153110
|
153111
|
153112
|
153113
|
154094
|
156410
|
156470
|
156471
|
156472
|
156473
|
156474
|
156475
|
156476
|
156477
|
156478
|
156479
|
156481
|
156482
|
156483
|
156504
|
156505
|
159327
|
159328
|
159329
|
159330
|
159340
|
159343
|
159386
|
159389
|
159395
|
159397
|
159398
|
159399
|
159400
|
159401
|
159402
|
159403
|
159404
|
159405
|
159406
|
159407
|
161724