From 383f42b6efd4b9f7363671624b56f2fa9d508082 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 27 Apr 2023 10:52:14 +0000 Subject: [PATCH] Bug 34587: Vue router, api client and authorised values Signed-off-by: Jessica Zairo Signed-off-by: Michaela Sieber Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- .../prog/js/vue/fetch/erm-api-client.js | 74 +++++++++++++++++++ .../intranet-tmpl/prog/js/vue/routes/erm.js | 72 +++++++++++++++++- .../prog/js/vue/stores/authorised-values.js | 5 ++ 3 files changed, 150 insertions(+), 1 deletion(-) 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 7f3679bd08..8fc8438cc7 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 @@ -250,6 +250,80 @@ export class ERMAPIClient extends HttpClient { }), }; } + + get usage_data_providers() { + return { + get: (id) => + this.get({ + endpoint: "usage_data_providers/" + id, + }), + getAll: (query) => + this.get({ + endpoint: "usage_data_providers", + query + }), + delete: (id) => + this.delete({ + endpoint: "usage_data_providers/" + id, + }), + create: (usage_data_provider) => + this.post({ + endpoint: "usage_data_providers", + body: usage_data_provider, + }), + update: (usage_data_provider, id) => + this.put({ + endpoint: "usage_data_providers/" + id, + body: usage_data_provider, + }), + //count: () => this.count("usage_data_providers"), //TODO: Implement count method + }; + } + + get titles() { + return { + get: (id) => + this.get({ + endpoint: "usage_titles/" + id, + headers: { + "x-koha-embed": + "usage_mus", + }, + }), + getAll: (query) => + this.get({ + endpoint: "usage_titles", + query + }), + getReport: (query, embed) => + this.get({ + endpoint: "usage_titles/report", + query, + headers: { + "x-koha-embed": + `${embed}`, + }, + }), + }; + } + + get counter_files() { + return { + getAll: (query) => + this.get({ + endpoint: "counter_files", + query, + headers: { + "x-koha-embed": + "counter_logs", + } + }), + delete: (id) => + this.delete({ + endpoint: "counter_files/" + id, + }), + }; + } } export default ERMAPIClient; diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js b/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js index dbd78f57f6..0a55ba62e4 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js @@ -20,6 +20,12 @@ import EHoldingsEBSCOTitlesShow from "../components/ERM/EHoldingsEBSCOTitlesShow import LicensesList from "../components/ERM/LicensesList.vue"; import LicensesShow from "../components/ERM/LicensesShow.vue"; import LicensesFormAdd from "../components/ERM/LicensesFormAdd.vue"; +import UsageStatisticsDataProvidersList from "../components/ERM/UsageStatisticsDataProvidersList.vue"; +import UsageStatisticsDataProvidersSummary from "../components/ERM/UsageStatisticsDataProvidersSummary.vue"; +import UsageStatisticsDataProvidersFormAdd from "../components/ERM/UsageStatisticsDataProvidersFormAdd.vue"; +import UsageStatisticsDataProvidersShow from "../components/ERM/UsageStatisticsDataProvidersShow.vue"; +import UsageStatisticsReportsHome from "../components/ERM/UsageStatisticsReportsHome.vue"; +import UsageStatisticsReportsViewer from "../components/ERM/UsageStatisticsReportsViewer.vue"; import { $__ } from "../i18n"; @@ -280,6 +286,70 @@ export const routes = [ }, ], }, + { + path: "/cgi-bin/koha/erm/eusage", + title: $__("eUsage"), + icon: "fa fa-tasks", + disabled: true, + children: [ + { + path: "usage_data_providers", + title: $__("Data providers"), + icon: "fa fa-exchange", + is_end_node: true, + children: [ + { + path: "", + name: "UsageStatisticsDataProvidersList", + component: markRaw(UsageStatisticsDataProvidersList), + }, + { + path: ":usage_data_provider_id", + name: "UsageStatisticsDataProvidersShow", + component: markRaw(UsageStatisticsDataProvidersShow), + title: $__("Show provider") + }, + { + path: "add", + name: "UsageStatisticsDataProvidersFormAdd", + component: markRaw(UsageStatisticsDataProvidersFormAdd), + title: $__("Add data provider") + }, + { + path: "edit/:usage_data_provider_id", + name: "UsageStatisticsDataProvidersFormAddEdit", + component: markRaw(UsageStatisticsDataProvidersFormAdd), + title: $__("Edit data provider") + }, + { + path: "summary", + name: "UsageStatisticsDataProvidersSummary", + component: markRaw(UsageStatisticsDataProvidersSummary), + title: $__("Data providers summary") + }, + ] + }, + { + path: "reports", + title: "Reports", + icon: "fa fa-bar-chart", + is_end_node: true, + children: [ + { + path: "", + name: "UsageStatisticsReportsHome", + component: markRaw(UsageStatisticsReportsHome), + }, + { + path: "viewer", + name: "UsageStatisticsReportsViewer", + component: markRaw(UsageStatisticsReportsViewer), + title: $__("View report") + } + ] + } + ] + } ], }, -]; +]; \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/authorised-values.js b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/authorised-values.js index e9e606fc83..ef77373d68 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/authorised-values.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/authorised-values.js @@ -37,6 +37,11 @@ export const useAVStore = defineStore("authorised_values", { av_package_content_types: [], av_title_publication_types: [], av_notforloan: [], + av_report_types: [], + av_platform_reports_metrics: [], + av_database_reports_metrics: [], + av_title_reports_metrics: [], + av_item_reports_metrics: [], }), actions: { get_lib_from_av(arr_name, av) { -- 2.39.5