From 00058a5fa3353492df41c5b2cf4b33156d936f1c Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 27 Nov 2023 10:49:45 +0000 Subject: [PATCH] Bug 35392: New getDialoJobEnqueueMessage DRY the dialog message shown when a background job is enqueued in ERM This takes Tomas work in UsageStatisticsDataProvidersList.vue, DRYs it and also applies it to UsageStatisticsDataProvidersFileImport.vue to address the issue mentioned by Caroline. To test: 1) Do a regular harvest, 2) Do a file upload 3) Notice in both cases the message is shown as before --- ...UsageStatisticsDataProvidersFileImport.vue | 12 ++++++++--- .../ERM/UsageStatisticsDataProvidersList.vue | 20 +++++++++---------- .../intranet-tmpl/prog/js/vue/stores/erm.js | 13 ++++++++++++ 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsDataProvidersFileImport.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsDataProvidersFileImport.vue index abcaf414b6..37c0e56010 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsDataProvidersFileImport.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsDataProvidersFileImport.vue @@ -46,8 +46,11 @@ export default { const { setMessage } = inject("mainStore") + const { getDialogJobEnqueueMessage } = inject("reportsStore") + return { setMessage, + getDialogJobEnqueueMessage, } }, data() { @@ -89,9 +92,12 @@ export default { success => { let message = "" success.jobs.forEach((job, i) => { - message += this.$__( - '
  • Job for uploaded file has been queued, click here to check its progress.
  • ' - ).format(job.job_id) + message += this.getDialogJobEnqueueMessage( + this.$__( + "Job for uploaded file has been queued" + ), + job + ) }) this.setMessage(message, true) }, diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsDataProvidersList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsDataProvidersList.vue index 420bdceeab..a27e2a18a0 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsDataProvidersList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsDataProvidersList.vue @@ -48,6 +48,8 @@ export default { const { setConfirmationDialog, setMessage, setWarning } = inject("mainStore") + const { getDialogJobEnqueueMessage } = inject("reportsStore") + const table = ref() return { @@ -56,6 +58,7 @@ export default { setConfirmationDialog, setMessage, setWarning, + getDialogJobEnqueueMessage, table, } }, @@ -246,17 +249,12 @@ export default { let message = "" success.jobs.forEach((job, i) => { message += - "
  • " + - this.$__( - "Job for report type %s has been queued" - ).format(job.report_type) + - ', ' + - this.$__("click here") + - " " + - $this.__("to check its progress.") + - "
  • " + this.getDialogJobEnqueueMessage( + this.$__( + "Job for report type %s has been queued" + ), + job + ) }) this.setMessage(message, true) }, diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/erm.js b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/erm.js index 157cf5b676..430d4663b1 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/erm.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/erm.js @@ -145,5 +145,18 @@ export const useReportsStore = defineStore("reports", { if (!this.report_type_map.hasOwnProperty(report_type)) return false; return this.report_type_map[report_type].includes(column); }, + getDialogJobEnqueueMessage(message, job) { + return ( + "
  • " + + message.format(job.report_type) + + ', ' + + __("click here") + + " " + + __("to check its progress.") + + "
  • " + ); + }, }, }); -- 2.30.2