From 43134c301443a3852a0af2ac49fa089ca26622db Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 17 Oct 2024 11:28:41 +0000 Subject: [PATCH] Bug 37301: Move table_url declaration to resource class This is relevant because doResourceDelete expected table_url to be implemented, but LicensesList does not implement it for example. We now have a getResourceTableUrl implemented by all resources --- .../prog/js/vue/components/BaseResource.vue | 12 +++++++++++- .../prog/js/vue/components/ERM/AgreementResource.vue | 1 + .../prog/js/vue/components/ERM/AgreementsList.vue | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/BaseResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/BaseResource.vue index 3e08316701..c2b9a1c577 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/BaseResource.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/BaseResource.vue @@ -102,7 +102,9 @@ export default { if ( this.$options.name === this.list_component ) { - this.$refs.table.redraw(this.table_url()) + this.$refs.table.redraw( + this.getResourceTableUrl() + ) } else if ( this.$options.name === this.show_component ) { @@ -115,6 +117,14 @@ export default { } ) }, + /** + * Return the URL for the resource table. + * + * @return {string} + */ + getResourceTableUrl: function () { + return this.resource_table_url + }, }, name: "BaseResource", props: { 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 6e0fd17327..b43644b6fc 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 @@ -15,6 +15,7 @@ export default { add_component: "AgreementsFormAdd", edit_component: "AgreementsFormAddEdit", api_client: APIClient.erm.agreements, + resource_table_url: APIClient.erm._baseURL + "agreements", i18n: { display_name: __("Agreement"), }, diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue index 58a8ef1996..2b24220799 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue @@ -181,7 +181,7 @@ export default { return new Date().toISOString().substring(0, 10) }, table_url: function () { - let url = "/api/v1/erm/agreements" + let url = this.getResourceTableUrl() if (this.filters.by_expired) url += "?max_expiration_date=" + this.filters.max_expiration_date -- 2.39.5