Bugzilla – Attachment 189717 Details for
Bug 41275
VueJS: We should abandon type="vendor" resource attribute
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41275: Drop vendor in favor of relationshipSelect
Bug-41275-Drop-vendor-in-favor-of-relationshipSele.patch (text/plain), 6.78 KB, created by
Pedro Amorim
on 2025-11-19 17:30:06 UTC
(
hide
)
Description:
Bug 41275: Drop vendor in favor of relationshipSelect
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-11-19 17:30:06 UTC
Size:
6.78 KB
patch
obsolete
>From decd0980a482f9ffe49521b3282652aaa209e0db Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Wed, 19 Nov 2025 17:29:42 +0000 >Subject: [PATCH] Bug 41275: Drop vendor in favor of relationshipSelect > >This is only a PoC for AgreementResource. More are needed. >Type = 'vendor' was a measure taken at the time to solve the issue immediatelly, but we have since abstracted 'simple' relationships to use relationshipSelect and there's no reason to continue using type: 'vendor'. >The thing I'd like comments on here is that an API call is done by relationshipSelect, whereas before the vendors were coming from the vendorStore loaded in ERM. AFAIK, this vendorStore load in ERM is still required to populate the 'vendor' table column filter options. > >Thoughts? >--- > .../vue/components/ERM/AgreementResource.vue | 5 ++- > .../prog/js/vue/components/FormElement.vue | 9 ---- > .../js/vue/components/FormSelectVendors.vue | 45 ------------------- > .../prog/js/vue/components/ResourceList.vue | 18 -------- > .../prog/js/vue/composables/base-element.js | 3 -- > 5 files changed, 4 insertions(+), 76 deletions(-) > delete mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/FormSelectVendors.vue > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementResource.vue >index a1075e8a866..a31f208a545 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementResource.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementResource.vue >@@ -108,7 +108,7 @@ export default { > }, > { > name: "vendor_id", >- type: "vendor", >+ type: "relationshipSelect", > label: $__("Vendor"), > showElement: { > type: "text", >@@ -118,6 +118,9 @@ export default { > slug: "vendor_id", > }, > }, >+ relationshipAPIClient: APIClient.acquisition.vendors, >+ relationshipOptionLabelAttr: "name", >+ relationshipRequiredKey: "id", > }, > { > name: "description", >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormElement.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormElement.vue >index fbdec2a7648..22fa86ba39e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormElement.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormElement.vue >@@ -122,15 +122,6 @@ > </template> > </v-select> > </template> >- <template v-else-if="attr.type == 'vendor'"> >- <component >- :is="requiredComponent" >- :id="getElementId" >- v-bind="getComponentProps()" >- v-on="getEventHandlers()" >- v-model="resource[attr.name]" >- ></component> >- </template> > <template v-else-if="attr.type == 'date'"> > <component > :is="requiredComponent" >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormSelectVendors.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormSelectVendors.vue >deleted file mode 100644 >index f470d3b7c18..00000000000 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormSelectVendors.vue >+++ /dev/null >@@ -1,45 +0,0 @@ >-<template> >- <v-select >- label="name" >- :reduce="vendor => vendor.id" >- :options="vendorOptions" >- :filter-by="filterVendors" >- > >- <template v-slot:option="v"> >- {{ v.name }} >- <br /> >- <cite>{{ v.aliases.map(a => a.alias).join(", ") }}</cite> >- </template> >- </v-select> >-</template> >- >-<script> >-import { computed, inject } from "vue"; >-import { storeToRefs } from "pinia"; >-export default { >- setup() { >- const vendorStore = inject("vendorStore"); >- const { vendors } = storeToRefs(vendorStore); >- >- const filterVendors = (vendor, label, search) => { >- return ( >- (vendor.full_search || "") >- .toLocaleLowerCase() >- .indexOf(search.toLocaleLowerCase()) > -1 >- ); >- }; >- >- const vendorOptions = computed(() => { >- return vendors.value.map(v => ({ >- ...v, >- full_search: >- v.name + >- (v.aliases.length > 0 >- ? " (" + v.aliases.map(a => a.alias).join(", ") + ")" >- : ""), >- })); >- }); >- return { vendors, vendorOptions, filterVendors }; >- }, >-}; >-</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ResourceList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ResourceList.vue >index 636857763df..62c366ed3e6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ResourceList.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ResourceList.vue >@@ -159,24 +159,6 @@ export default { > }); > return acc; > } >- if (attr.type === "vendor") { >- acc.push({ >- title: attr.label, >- data: attr.name, >- searchable: true, >- orderable: true, >- render: function (data, type, row, meta) { >- return row.vendor_id != undefined >- ? '<a href="/cgi-bin/koha/acquisition/vendors/' + >- row.vendor_id + >- '">' + >- escape_str(row.vendor.name) + >- "</a>" >- : ""; >- }, >- }); >- return acc; >- } > if (attr.type === "relationshipSelect") { > acc.push({ > title: attr.label, >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-element.js b/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-element.js >index b54eb0fdd8f..8657d10386c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-element.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-element.js >@@ -10,9 +10,6 @@ export function useBaseElement(instancedElement) { > if (attr.type === "date") { > attr.componentPath = "@koha-vue/components/FlatPickrWrapper.vue"; > } >- if (attr.type === "vendor") { >- attr.componentPath = "@koha-vue/components/FormSelectVendors.vue"; >- } > if (attr.type === "relationshipWidget") { > attr.componentPath = "@koha-vue/components/RelationshipWidget.vue"; > } >-- >2.39.5
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 41275
: 189717