Skip to content

Commit

Permalink
undo accidental commit
Browse files Browse the repository at this point in the history
  • Loading branch information
banders committed Dec 5, 2024
1 parent 2327de1 commit 7fb365c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 26 deletions.
25 changes: 1 addition & 24 deletions admin-frontend/src/components/reports/ReportActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down
3 changes: 2 additions & 1 deletion backend/src/v1/routes/admin-report-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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}`,
Expand Down
5 changes: 4 additions & 1 deletion backend/src/v1/services/admin-report-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -246,6 +246,7 @@ const adminReportService = {
return report;
},

<<<<<<< Updated upstream
async getReportFileName(reportId: string): Promise<string> {
const report: Report = await reportService.getReportById(reportId);
if (report) {
Expand All @@ -256,6 +257,8 @@ const adminReportService = {
}
},

=======
>>>>>>> Stashed changes
/**
* Get dashboard metrics
* @param param0
Expand Down

0 comments on commit 7fb365c

Please sign in to comment.