Bugzilla – Attachment 172912 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 licenses
Bug-37301-Apply-changes-to-licenses.patch (text/plain), 9.48 KB, created by
Pedro Amorim
on 2024-10-17 16:24:19 UTC
(
hide
)
Description:
Bug 37301: Apply changes to licenses
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-10-17 16:24:19 UTC
Size:
9.48 KB
patch
obsolete
>From 935a632a377cda0200042f50c3fbab2cfbce2014 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Thu, 17 Oct 2024 11:29:20 +0000 >Subject: [PATCH] Bug 37301: Apply changes to licenses > >--- > .../js/vue/components/ERM/LicenseResource.vue | 29 +++++++++ > .../js/vue/components/ERM/LicensesList.vue | 60 ++++--------------- > .../js/vue/components/ERM/LicensesShow.vue | 52 +++------------- > 3 files changed, 48 insertions(+), 93 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicenseResource.vue > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicenseResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicenseResource.vue >new file mode 100644 >index 0000000000..9348542167 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicenseResource.vue >@@ -0,0 +1,29 @@ >+<script> >+import BaseResource from "../BaseResource.vue" >+import { APIClient } from "../../fetch/api-client.js" >+ >+export default { >+ extends: BaseResource, >+ setup(props) { >+ return { >+ ...BaseResource.setup({ >+ resource_name: "license", >+ name_attr: "name", >+ id_attr: "license_id", >+ show_component: "LicensesShow", >+ list_component: "LicensesList", >+ add_component: "LicensesFormAdd", >+ edit_component: "LicensesFormAddEdit", >+ api_client: APIClient.erm.licenses, >+ resource_table_url: APIClient.erm._baseURL + "licenses", >+ i18n: { >+ display_name: __("License"), >+ }, >+ }), >+ //LicenseResource specific setup here >+ } >+ }, >+ methods: {}, >+ name: "LicenseResource", >+} >+</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesList.vue >index e52511ef1a..95ec928456 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesList.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesList.vue >@@ -3,8 +3,8 @@ > <div v-else id="licenses_list"> > <Toolbar> > <ToolbarButton >- :to="{ name: 'LicensesFormAdd' }" >- icon="plus" >+ action="add" >+ @go-to-add-resource="goToResourceAdd" > :title="$__('New license')" > /> > </Toolbar> >@@ -12,9 +12,9 @@ > <KohaTable > ref="table" > v-bind="tableOptions" >- @show="doShow" >- @edit="doEdit" >- @delete="doDelete" >+ @show="goToResourceShow" >+ @edit="goToResourceEdit" >+ @delete="doResourceDelete" > ></KohaTable> > </div> > <div v-else class="alert alert-info"> >@@ -30,8 +30,10 @@ import { inject, ref } from "vue" > import { storeToRefs } from "pinia" > import { APIClient } from "../../fetch/api-client.js" > import KohaTable from "../KohaTable.vue" >+import LicenseResource from "./LicenseResource.vue" > > export default { >+ extends: LicenseResource, > setup() { > const vendorStore = inject("vendorStore") > const { vendors } = storeToRefs(vendorStore) >@@ -39,17 +41,14 @@ export default { > const AVStore = inject("AVStore") > const { get_lib_from_av, map_av_dt_filter } = AVStore > >- const { setConfirmationDialog, setMessage } = inject("mainStore") >- > const table = ref() > > return { >+ ...LicenseResource.setup(), > vendors, > get_lib_from_av, > map_av_dt_filter, > table, >- setConfirmationDialog, >- setMessage, > license_table_settings, > } > }, >@@ -66,7 +65,7 @@ export default { > ], > tableOptions: { > columns: this.getTableColumns(), >- url: "/api/v1/erm/licenses", >+ url: this.getResourceTableUrl(), > options: { embed: "vendor" }, > table_settings: this.license_table_settings, > add_filters: true, >@@ -102,43 +101,6 @@ export default { > error => {} > ) > }, >- doShow: function ({ license_id }, dt, event) { >- event.preventDefault() >- this.$router.push({ name: "LicensesShow", params: { license_id } }) >- }, >- doEdit: function ({ license_id }, dt, event) { >- this.$router.push({ >- name: "LicensesFormAddEdit", >- params: { license_id }, >- }) >- }, >- doDelete: function (license, dt, event) { >- this.setConfirmationDialog( >- { >- title: this.$__( >- "Are you sure you want to remove this license?" >- ), >- message: license.name, >- accept_label: this.$__("Yes, delete"), >- cancel_label: this.$__("No, do not delete"), >- }, >- () => { >- const client = APIClient.erm >- client.licenses.delete(license.license_id).then( >- success => { >- this.setMessage( >- this.$__("License %s deleted").format( >- license.name >- ), >- true >- ) >- dt.draw() >- }, >- error => {} >- ) >- } >- ) >- }, > getTableColumns: function () { > let get_lib_from_av = this.get_lib_from_av > >@@ -150,9 +112,7 @@ export default { > orderable: true, > render: function (data, type, row, meta) { > return ( >- '<a href="/cgi-bin/koha/erm/licenses/' + >- row.license_id + >- '" class="show">' + >+ '<a role="button" class="show">' + > escape_str(`${row.name} (#${row.license_id})`) + > "</a>" > ) >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesShow.vue >index 400267c08f..311e3ec20a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesShow.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesShow.vue >@@ -3,19 +3,13 @@ > <div v-else id="licenses_show"> > <Toolbar> > <ToolbarButton >- :to="{ >- name: 'LicensesFormAddEdit', >- params: { license_id: license.license_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_license(license.license_id, license.name)" >- class="btn btn-default" >- ><font-awesome-icon icon="trash" /> {{ $__("Delete") }}</a >- > > </Toolbar> > > <h2> >@@ -153,23 +147,22 @@ import { inject } from "vue" > import { APIClient } from "../../fetch/api-client.js" > import Toolbar from "../Toolbar.vue" > import ToolbarButton from "../ToolbarButton.vue" >+import LicenseResource from "./LicenseResource.vue" > > export default { >+ extends: LicenseResource, > setup() { > const format_date = $date > const patron_to_html = $patron_to_html > >- const { setConfirmationDialog, setMessage } = inject("mainStore") >- > const AVStore = inject("AVStore") > const { get_lib_from_av } = AVStore > > return { >+ ...LicenseResource.setup(), > format_date, > patron_to_html, > get_lib_from_av, >- setConfirmationDialog, >- setMessage, > } > }, > data() { >@@ -205,33 +198,6 @@ export default { > error => {} > ) > }, >- delete_license: function (license_id, license_name) { >- this.setConfirmationDialog( >- { >- title: this.$__( >- "Are you sure you want to remove this license?" >- ), >- message: license_name, >- accept_label: this.$__("Yes, delete"), >- cancel_label: this.$__("No, do not delete"), >- }, >- () => { >- const client = APIClient.erm >- client.licenses.delete(license_id).then( >- success => { >- this.setMessage( >- this.$__("License %s deleted").format( >- license_name >- ), >- true >- ) >- this.$router.push({ name: "LicensesList" }) >- }, >- error => {} >- ) >- } >- ) >- }, > }, > components: { Toolbar, ToolbarButton }, > name: "LicensesShow", >-- >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
|
175450
|
177173
|
177174
|
177175
|
177176
|
177177
|
177178
|
177179
|
177180
|
177181
|
177182
|
177183
|
177184
|
177185
|
177186
|
177187
|
177188
|
177189
|
177190
|
177191
|
177192
|
177193
|
177351