From 7fb365c0a119abde7b839035651c8294ecdcd451 Mon Sep 17 00:00:00 2001 From: Brock Anderson Date: Thu, 5 Dec 2024 10:33:03 -0800 Subject: [PATCH] undo accidental commit --- .../src/components/reports/ReportActions.vue | 25 +------------------ backend/src/v1/routes/admin-report-routes.ts | 3 ++- .../src/v1/services/admin-report-service.ts | 5 +++- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/admin-frontend/src/components/reports/ReportActions.vue b/admin-frontend/src/components/reports/ReportActions.vue index 68bfba18d..91c557dd8 100644 --- a/admin-frontend/src/components/reports/ReportActions.vue +++ b/admin-frontend/src/components/reports/ReportActions.vue @@ -119,34 +119,11 @@ async function viewReportInNewTab(reportId: string) { isLoadingPdf.value = true; try { const pdfAsBlob = await ApiService.getPdfReportAsBlob(reportId); - console.log(pdfAsBlob); //admin_last_access_date will have changed ReportChangeService.reportChanged(reportId); - //const file = new File([pdfAsBlob], 'filename.pdf', { - // type: 'application/pdf', - //}); - //console.log(file); - //const objectUrl = URL.createObjectURL(file); - const objectUrl = URL.createObjectURL(pdfAsBlob); - - let fileLink = document.createElement('a'); - fileLink.href = objectUrl; - fileLink.target = '_blank'; - fileLink.id = 'bla.pdf'; - fileLink.title = 'bla.pdf'; - fileLink.name = 'bla.pdf'; - - //fileLink.download = 'pdf_name'; - //fileLink.setAttribute('download', 'custom_name.pdf'); - - fileLink.click(); - - fileLink.remove(); - URL.revokeObjectURL(objectUrl); - - //window.open(objectUrl); + window.open(objectUrl); } catch (e) { NotificationService.pushNotificationError( 'Something went wrong. Unable to download report.', diff --git a/backend/src/v1/routes/admin-report-routes.ts b/backend/src/v1/routes/admin-report-routes.ts index b63504d6b..dd4f36429 100644 --- a/backend/src/v1/routes/admin-report-routes.ts +++ b/backend/src/v1/routes/admin-report-routes.ts @@ -5,6 +5,7 @@ import { BAD_REQUEST } from '../../constants'; import { logger } from '../../logger'; import { adminReportService } from '../services/admin-report-service'; import { PayTransparencyUserError } from '../services/file-upload-service'; +import { reportService } from '../services/report-service'; import { utils } from '../services/utils-service'; import { UserInputError } from '../types/errors'; @@ -137,7 +138,7 @@ router.get( return res.status(404).json({ error: 'Report not found' }); } const filename: string = - await adminReportService.getReportFileName(reportId); + await reportService.getReportFileName(reportId); if (!filename) { logger.error( `Unable to determine PDF filename for reportId=${reportId}`, diff --git a/backend/src/v1/services/admin-report-service.ts b/backend/src/v1/services/admin-report-service.ts index bb07245b2..7771b7193 100644 --- a/backend/src/v1/services/admin-report-service.ts +++ b/backend/src/v1/services/admin-report-service.ts @@ -11,7 +11,7 @@ import { ReportSortType, } from '../types/report-search'; import { PayTransparencyUserError } from './file-upload-service'; -import { Report, reportService } from './report-service'; +import { reportService } from './report-service'; import { utils } from './utils-service'; interface IGetReportMetricsInput { @@ -246,6 +246,7 @@ const adminReportService = { return report; }, +<<<<<<< Updated upstream async getReportFileName(reportId: string): Promise { const report: Report = await reportService.getReportById(reportId); if (report) { @@ -256,6 +257,8 @@ const adminReportService = { } }, +======= +>>>>>>> Stashed changes /** * Get dashboard metrics * @param param0