add export modal to prevent firefox popup blocking behaviour

This commit is contained in:
Gregor Vostrak
2024-12-09 15:29:44 +01:00
parent 959cad8f74
commit 4e10f9538f
4 changed files with 88 additions and 5 deletions

View File

@@ -198,15 +198,20 @@ async function downloadExport(format: ExportFormat) {
'Export successful',
'Export failed'
);
if (response?.download_url) {
window.open(response.download_url as string, '_blank')?.focus();
showExportModal.value = true;
exportUrl.value = response.download_url as string;
}
}
}
const { getNameForReportingRowEntry, emptyPlaceholder } = useReportingStore();
import { useProjectsStore } from '@/utils/useProjects';
import ReportingExportModal from '@/Components/Common/Reporting/ReportingExportModal.vue';
const projectsStore = useProjectsStore();
const { projects } = storeToRefs(projectsStore);
const showExportModal = ref(false);
const exportUrl = ref<string | null>(null);
const groupedPieChartData = computed(() => {
return (
@@ -274,6 +279,9 @@ const tableData = computed(() => {
title="Reporting"
data-testid="reporting_view"
class="overflow-hidden">
<ReportingExportModal
v-model:show="showExportModal"
:exportUrl="exportUrl"></ReportingExportModal>
<MainContainer
class="py-3 sm:py-5 border-b border-default-background-separator flex justify-between items-center">
<div class="flex items-center space-x-3 sm:space-x-6">

View File

@@ -67,6 +67,7 @@ import { useNotificationsStore } from '@/utils/notification';
import TimeEntryMassActionRow from '@/packages/ui/src/TimeEntry/TimeEntryMassActionRow.vue';
import { isAllowedToPerformPremiumAction } from '@/utils/billing';
import { canCreateProjects } from '@/utils/permissions';
import ReportingExportModal from '@/Components/Common/Reporting/ReportingExportModal.vue';
const startDate = useSessionStorage<string>(
'reporting-start-date',
@@ -167,6 +168,9 @@ const { clients } = storeToRefs(clientStore);
const selectedTimeEntries = ref<TimeEntry[]>([]);
const showExportModal = ref(false);
const exportUrl = ref<string | null>(null);
async function createTag(name: string) {
return await useTagsStore().createTag(name);
}
@@ -234,7 +238,8 @@ async function downloadExport(format: ExportFormat) {
'Export failed'
);
if (response?.download_url) {
window.open(response.download_url as string, '_blank')?.focus();
showExportModal.value = true;
exportUrl.value = response.download_url as string;
}
}
}
@@ -245,6 +250,9 @@ async function downloadExport(format: ExportFormat) {
title="Reporting"
data-testid="reporting_view"
class="overflow-hidden">
<ReportingExportModal
v-model:show="showExportModal"
:exportUrl="exportUrl"></ReportingExportModal>
<MainContainer
class="py-3 sm:py-5 border-b border-default-background-separator flex justify-between items-center">
<div class="flex items-center space-x-3 sm:space-x-6">