Bugzilla – Attachment 174623 Details for
Bug 37301
Further improve how we build Vue components
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37301: Apply changes to eHoldings local packages
Bug-37301-Apply-changes-to-eHoldings-local-package.patch (text/plain), 10.58 KB, created by
Pedro Amorim
on 2024-11-15 16:45:17 UTC
(
hide
)
Description:
Bug 37301: Apply changes to eHoldings local packages
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-11-15 16:45:17 UTC
Size:
10.58 KB
patch
obsolete
>From 8935000530aec2d9a7b55325406cd0f57fc3cf34 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Thu, 17 Oct 2024 11:48:23 +0000 >Subject: [PATCH] Bug 37301: Apply changes to eHoldings local packages > >--- > .../ERM/EHoldingsLocalPackageResource.vue | 30 +++++++++ > .../ERM/EHoldingsLocalPackagesList.vue | 63 +++---------------- > .../ERM/EHoldingsLocalPackagesShow.vue | 56 +++-------------- > 3 files changed, 49 insertions(+), 100 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackageResource.vue > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackageResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackageResource.vue >new file mode 100644 >index 0000000000..65713bc92a >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackageResource.vue >@@ -0,0 +1,30 @@ >+<script> >+import BaseResource from "../BaseResource.vue" >+import { APIClient } from "../../fetch/api-client.js" >+ >+export default { >+ extends: BaseResource, >+ setup(props) { >+ return { >+ ...BaseResource.setup({ >+ resource_name: "erm_package", >+ name_attr: "name", >+ id_attr: "package_id", >+ show_component: "EHoldingsLocalPackagesShow", >+ list_component: "EHoldingsLocalPackagesList", >+ add_component: "EHoldingsLocalPackagesFormAdd", >+ edit_component: "EHoldingsLocalPackagesFormAddEdit", >+ api_client: APIClient.erm.localPackages, >+ resource_table_url: >+ APIClient.erm._baseURL + "eholdings/local/packages", >+ i18n: { >+ display_name: __("Local package"), >+ }, >+ }), >+ //EHoldingsLocalPackageResource specific setup here >+ } >+ }, >+ methods: {}, >+ name: "EHoldingsLocalPackageResource", >+} >+</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesList.vue >index 51e2f87f81..2c1602aaed 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesList.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesList.vue >@@ -4,8 +4,8 @@ > <div v-else id="packages_list"> > <Toolbar> > <ToolbarButton >- :to="{ name: 'EHoldingsLocalPackagesFormAdd' }" >- icon="plus" >+ action="add" >+ @go-to-add-resource="goToResourceAdd" > :title="$__('New package')" > /> > </Toolbar> >@@ -19,9 +19,9 @@ > v-bind="tableOptions" > :searchable_additional_fields="searchable_additional_fields" > :searchable_av_options="searchable_av_options" >- @show="doShow" >- @edit="doEdit" >- @delete="doDelete" >+ @show="goToResourceShow" >+ @edit="goToResourceEdit" >+ @delete="doResourceDelete" > ></KohaTable> > </div> > <div v-else class="alert alert-info"> >@@ -38,8 +38,10 @@ import { inject, ref, reactive } from "vue" > import { storeToRefs } from "pinia" > import { APIClient } from "../../fetch/api-client.js" > import KohaTable from "../KohaTable.vue" >+import EHoldingsLocalPackageResource from "./EHoldingsLocalPackageResource.vue" > > export default { >+ extends: EHoldingsLocalPackageResource, > setup() { > const vendorStore = inject("vendorStore") > const { vendors } = storeToRefs(vendorStore) >@@ -47,8 +49,6 @@ export default { > const AVStore = inject("AVStore") > const { get_lib_from_av, map_av_dt_filter } = AVStore > >- const { setConfirmationDialog, setMessage } = inject("mainStore") >- > const table = ref() > const filters = reactive({ > package_name: "", >@@ -56,13 +56,12 @@ export default { > }) > > return { >+ ...EHoldingsLocalPackageResource.setup(), > vendors, > get_lib_from_av, > map_av_dt_filter, > table, > filters, >- setConfirmationDialog, >- setMessage, > escape_str, > eholdings_packages_table_settings, > } >@@ -80,7 +79,7 @@ export default { > searchable_av_options: [], > tableOptions: { > columns: this.getTableColumns(), >- url: "/api/v1/erm/eholdings/local/packages", >+ url: this.getResourceTableUrl(), > options: { > embed: "resources+count,vendor.name,extended_attributes,+strings", > searchCols: [ >@@ -169,46 +168,6 @@ export default { > }) > }) > }, >- doShow: function ({ package_id }, dt, event) { >- event.preventDefault() >- this.$router.push({ >- name: "EHoldingsLocalPackagesShow", >- params: { package_id }, >- }) >- }, >- doEdit: function ({ package_id }, dt, event) { >- this.$router.push({ >- name: "EHoldingsLocalPackagesFormAddEdit", >- params: { package_id }, >- }) >- }, >- doDelete: function (erm_package, dt, event) { >- this.setConfirmationDialog( >- { >- title: this.$__( >- "Are you sure you want to remove this package?" >- ), >- message: erm_package.name, >- accept_label: this.$__("Yes, delete"), >- cancel_label: this.$__("No, do not delete"), >- }, >- () => { >- const client = APIClient.erm >- client.localPackages.delete(erm_package.package_id).then( >- success => { >- this.setMessage( >- this.$__("Local package %s deleted").format( >- erm_package.name >- ), >- true >- ) >- dt.draw() >- }, >- error => {} >- ) >- } >- ) >- }, > getTableColumns: function () { > let get_lib_from_av = this.get_lib_from_av > let escape_str = this.escape_str >@@ -220,9 +179,7 @@ export default { > orderable: true, > render: function (data, type, row, meta) { > return ( >- '<a href="/cgi-bin/koha/erm/eholdings/local/packages/' + >- row.package_id + >- '" class="show">' + >+ '<a role="button" class="show">' + > escape_str(`${row.name} (#${row.package_id})`) + > "</a>" > ) >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesShow.vue >index 5f73b9d80d..381061d718 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesShow.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesShow.vue >@@ -3,21 +3,13 @@ > <div v-else-if="erm_package" id="packages_show"> > <Toolbar> > <ToolbarButton >- :to="{ >- name: 'EHoldingsLocalPackagesFormAddEdit', >- params: { package_id: erm_package.package_id }, >- }" >- class="btn btn-default" >- icon="pencil" >- :title="$__('Edit')" >+ action="edit" >+ @go-to-edit-resource="goToResourceEdit" >+ /> >+ <ToolbarButton >+ action="delete" >+ @delete-resource="doResourceDelete" > /> >- <a >- @click=" >- delete_package(erm_package.package_id, erm_package.name) >- " >- class="btn btn-default" >- ><font-awesome-icon icon="trash" /> {{ $__("Delete") }}</a >- > > </Toolbar> > > <h2> >@@ -127,21 +119,20 @@ import { APIClient } from "../../fetch/api-client.js" > import Toolbar from "../Toolbar.vue" > import ToolbarButton from "../ToolbarButton.vue" > import AdditionalFieldsDisplay from "../AdditionalFieldsDisplay.vue" >+import EHoldingsLocalPackageResource from "./EHoldingsLocalPackageResource.vue" > > export default { >+ extends: EHoldingsLocalPackageResource, > setup() { > const format_date = $date > >- const { setConfirmationDialog, setMessage } = inject("mainStore") >- > const AVStore = inject("AVStore") > const { get_lib_from_av } = AVStore > > return { >+ ...EHoldingsLocalPackageResource.setup(), > format_date, > get_lib_from_av, >- setConfirmationDialog, >- setMessage, > } > }, > data() { >@@ -181,35 +172,6 @@ export default { > error => {} > ) > }, >- delete_package: function (package_id, package_name) { >- this.setConfirmationDialog( >- { >- title: this.$__( >- "Are you sure you want to remove this package?" >- ), >- message: package_name, >- accept_label: this.$__("Yes, delete"), >- cancel_label: this.$__("No, do not delete"), >- }, >- () => { >- const client = APIClient.erm >- client.localPackages.delete(package_id).then( >- success => { >- this.setMessage( >- this.$__("Local package %s deleted").format( >- package_name >- ), >- true >- ) >- this.$router.push({ >- name: "EHoldingsLocalPackagesList", >- }) >- }, >- error => {} >- ) >- } >- ) >- }, > }, > components: { > EHoldingsPackageTitlesList, >-- >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 37301
:
168709
|
168739
|
168740
|
168741
|
168800
|
168827
|
168828
|
168829
|
168836
|
172713
|
172911
|
172912
|
172913
|
172914
|
172915
|
172916
|
172917
|
172918
|
172919
|
172920
|
172921
|
174612
|
174613
|
174614
|
174615
|
174616
|
174617
|
174618
|
174619
|
174620
|
174621
|
174622
| 174623 |
174624
|
174625
|
174626
|
174627
|
174628
|
174629
|
174630
|
174631