From f57d5088c7366e1633d181ded7656450df1a319e Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Tue, 1 Aug 2023 09:14:36 +0000 Subject: [PATCH] Bug 34587: Add ability to delete saved reports Signed-off-by: Jessica Zairo Signed-off-by: Michaela Sieber Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- .gitignore | 3 +- Koha/REST/V1/ERM/DefaultUsageReports.pm | 1 + Koha/Schema/Result/ErmDefaultUsageReport.pm | 8 +++ .../ERM/UsageStatisticsReportBuilder.vue | 13 +++- .../ERM/UsageStatisticsSavedReports.vue | 64 +++++++++++++++++-- .../prog/js/vue/fetch/erm-api-client.js | 4 ++ 6 files changed, 84 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 343534876e..e746d60b55 100644 --- a/.gitignore +++ b/.gitignore @@ -22,5 +22,4 @@ koha-tmpl/intranet-tmpl/prog/css/staff-global.css koha-tmpl/intranet-tmpl/prog/js/vue/dist/ how-to.pl -koha-tmpl/intranet-tmpl/prog/en/modules/how-to.tt -installer/data/mysql/atomicupdate/demo_data.pl \ No newline at end of file +koha-tmpl/intranet-tmpl/prog/en/modules/how-to.tt \ No newline at end of file diff --git a/Koha/REST/V1/ERM/DefaultUsageReports.pm b/Koha/REST/V1/ERM/DefaultUsageReports.pm index 50554b9c60..21857be97b 100644 --- a/Koha/REST/V1/ERM/DefaultUsageReports.pm +++ b/Koha/REST/V1/ERM/DefaultUsageReports.pm @@ -19,6 +19,7 @@ use Modern::Perl; use Mojo::Base 'Mojolicious::Controller'; +use Koha::ERM::DefaultUsageReport; use Koha::ERM::DefaultUsageReports; use Scalar::Util qw( blessed ); diff --git a/Koha/Schema/Result/ErmDefaultUsageReport.pm b/Koha/Schema/Result/ErmDefaultUsageReport.pm index df82587491..81ef05c206 100644 --- a/Koha/Schema/Result/ErmDefaultUsageReport.pm +++ b/Koha/Schema/Result/ErmDefaultUsageReport.pm @@ -75,4 +75,12 @@ __PACKAGE__->set_primary_key("erm_default_usage_report_id"); # You can replace this text with custom code or comments, and it will be preserved on regeneration + +sub koha_object_class { + 'Koha::ERM::DefaultUsageReport'; +} +sub koha_objects_class { + 'Koha::ERM::DefaultUsageReports'; +} + 1; diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportBuilder.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportBuilder.vue index 810ce0d324..b014852853 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportBuilder.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportBuilder.vue @@ -69,8 +69,17 @@ @update:modelValue=" setMetricTypesAndProviderList($event) " - required - /> + :required="!query.report_type" + > + + {{ $__("Required") }}
  • diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsSavedReports.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsSavedReports.vue index d61c3460ab..110bd61ddd 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsSavedReports.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsSavedReports.vue @@ -24,14 +24,32 @@ id="default_usage_reports" v-model="default_usage_report" label="report_name" - :reduce="report => report.report_url_params" + :reduce="report => report" :options="default_usage_reports" - /> + :required="!default_usage_report" + > + + + {{ $__("Required") }}
  • +
    @@ -40,8 +58,17 @@ - + diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js index 6fec7cbf71..72341e6c79 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js @@ -377,6 +377,10 @@ export class ERMAPIClient extends HttpClient { endpoint: "default_usage_reports", body: default_usage_report, }), + delete: (id) => + this.delete({ + endpoint: "default_usage_reports/" + id, + }), }; } } -- 2.39.5