Bugzilla – Attachment 187901 Details for
Bug 40141
Add "Run" and "Test" buttons to data provider toolbar
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40141: Add "Run" and "Test" buttons to data provider toolbar
Bug-40141-Add-Run-and-Test-buttons-to-data-provide.patch (text/plain), 7.11 KB, created by
Jan Kissig
on 2025-10-15 08:35:34 UTC
(
hide
)
Description:
Bug 40141: Add "Run" and "Test" buttons to data provider toolbar
Filename:
MIME Type:
Creator:
Jan Kissig
Created:
2025-10-15 08:35:34 UTC
Size:
7.11 KB
patch
obsolete
>From 9e283e75dca75d0d43c86b636c41a9987df6eda0 Mon Sep 17 00:00:00 2001 >From: Jan Kissig <bibliothek@th-wildau.de> >Date: Mon, 13 Oct 2025 08:31:58 +0000 >Subject: [PATCH] Bug 40141: Add "Run" and "Test" buttons to data provider > toolbar > >This patch adds the SUSHI test and run options to the toolbar of the data providers detail page. >If a provider is not active the buttons are disabled. > >Testplan: >- go to /cgi-bin/koha/erm/eusage/usage_data_providers >- add a dummy provider >- notice the toolbar on the data provider detail page: Only Edit and Delete are available >- apply the patch >- run 'yarn js:build' >- I needed to call 'restart_all' >- refresh the providers detail page and notice the two new buttons: Test and run now >- click on 'test' and wait for the result >- click on 'Run now' and enter some appropriate dates. >- Click 'yes run' to see the jobs queued >- (Please do not dismiss the 'run now' dialog by clicking outside, as this triggers bug 41001) > >Signed-off-by: Clemens Tubach <clemens.tubach@kit.edu> >Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> >--- > .../ERM/UsageStatisticsDataProvidersShow.vue | 122 ++++++++++++++++++ > 1 file changed, 122 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsDataProvidersShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsDataProvidersShow.vue >index f640f3ea659..95f3935f63e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsDataProvidersShow.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsDataProvidersShow.vue >@@ -23,6 +23,29 @@ > class="btn btn-default" > ><font-awesome-icon icon="trash" /> {{ $__("Delete") }}</a > > >+ <button >+ @click=" >+ test_usage_data_provider( >+ usage_data_provider.erm_usage_data_provider_id, >+ usage_data_provider.name >+ ) >+ " >+ class="btn btn-default" >+ :disabled="!usage_data_provider.active" >+ > >+ <i class="fa fa-check"></i> {{ $__("Test") }} >+ </button> >+ <button >+ @click=" >+ run_harvester( >+ usage_data_provider.erm_usage_data_provider_id >+ ) >+ " >+ class="btn btn-default" >+ :disabled="!usage_data_provider.active" >+ > >+ <i class="fa fa-play"></i> {{ $__("Run now") }} >+ </button> > </Toolbar> > > <h2> >@@ -220,6 +243,103 @@ export default { > } > ); > }; >+ >+ const test_usage_data_provider = ( >+ usage_data_provider_id, >+ usage_data_provider_name >+ ) => { >+ const client = APIClient.erm; >+ client.usage_data_providers.test(usage_data_provider_id).then( >+ success => { >+ if (success) { >+ setMessage( >+ $__( >+ "Harvester connection was successful for usage data provider %s" >+ ).format(usage_data_provider_name), >+ true >+ ); >+ } else { >+ setMessage( >+ $__( >+ "No connection for usage data provider %s, please check your credentials and try again." >+ ).format(usage_data_provider_name), >+ true >+ ); >+ } >+ }, >+ error => {} >+ ); >+ }; >+ >+ const run_harvester = usage_data_provider_id => { >+ let date = new Date(); >+ setConfirmationDialog( >+ { >+ title: $__( >+ "Are you sure you want to run the harvester for this data provider?" >+ ), >+ message: name, >+ accept_label: $__("Yes, run"), >+ cancel_label: $__("No, do not run"), >+ inputs: [ >+ { >+ name: "begin_date", >+ type: "date", >+ value: null, >+ label: $__("Begin date"), >+ required: true, >+ componentProps: { >+ required: { >+ type: "boolean", >+ value: true, >+ }, >+ }, >+ }, >+ { >+ name: "end_date", >+ type: "date", >+ value: $date_to_rfc3339($date(date.toString())), >+ label: $__("End date"), >+ required: true, >+ componentProps: { >+ required: { >+ type: "boolean", >+ value: true, >+ }, >+ }, >+ }, >+ ], >+ }, >+ (callback_result, inputFields) => { >+ const client = APIClient.erm; >+ client.usage_data_providers >+ .process_SUSHI_response( >+ usage_data_provider_id, >+ inputFields >+ ) >+ .then( >+ success => { >+ let message = ""; >+ success.jobs.forEach((job, i) => { >+ message += >+ "<li>" + >+ $__( >+ "Job for report type <strong>%s</strong> has been queued" >+ ).format(job.report_type) + >+ '. <a href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=' + >+ job.job_id + >+ '" target="_blank">' + >+ $__("Check job progress") + >+ ".</a></li>"; >+ }); >+ setMessage(message, true); >+ }, >+ error => {} >+ ); >+ } >+ ); >+ }; >+ > const change_tab_content = e => { > tab_content.value = e.target.getAttribute("data-content"); > }; >@@ -235,6 +355,8 @@ export default { > tab_content, > available_data_types, > delete_usage_data_provider, >+ test_usage_data_provider, >+ run_harvester, > change_tab_content, > }; > }, >-- >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 40141
:
187813
|
187854
|
187885
| 187901