From ab4dbd64df8e3f9c6b09e4edccffc89230d3b34f Mon Sep 17 00:00:00 2001 From: Gregor Vostrak Date: Fri, 25 Oct 2024 18:09:28 +0200 Subject: [PATCH] add support for history_group and loading indicators to export buttons --- .../Reporting/ReportingExportButton.vue | 28 +++++---- resources/js/Pages/Reporting.vue | 28 ++++++--- resources/js/Pages/ReportingDetailed.vue | 2 +- resources/js/packages/api/src/index.ts | 2 +- .../packages/api/src/openapi.json.client.ts | 61 ++++++++++--------- .../ui/src/Buttons/SecondaryButton.vue | 9 ++- 6 files changed, 74 insertions(+), 56 deletions(-) diff --git a/resources/js/Components/Common/Reporting/ReportingExportButton.vue b/resources/js/Components/Common/Reporting/ReportingExportButton.vue index cc92e030..ce074a85 100644 --- a/resources/js/Components/Common/Reporting/ReportingExportButton.vue +++ b/resources/js/Components/Common/Reporting/ReportingExportButton.vue @@ -3,43 +3,47 @@ import { SecondaryButton } from '@/packages/ui/src'; import { ArrowDownTrayIcon } from '@heroicons/vue/20/solid'; import Dropdown from '@/packages/ui/src/Input/Dropdown.vue'; import type { ExportFormat } from '@/types/reporting'; +import { ref } from 'vue'; -const emit = defineEmits<{ - submit: [ExportFormat]; +const props = defineProps<{ + download: (format: ExportFormat) => Promise; }>(); +const loading = ref(false); +function triggerDownload(format: ExportFormat) { + loading.value = true; + props.download(format).finally(() => { + loading.value = false; + }); +}