pdf content disposition config option
parent
5e768961ff
commit
6455591fa8
|
|
@ -10,7 +10,8 @@ export const config = {
|
||||||
lot: {},
|
lot: {},
|
||||||
lotOccupancy: {},
|
lotOccupancy: {},
|
||||||
workOrders: {},
|
workOrders: {},
|
||||||
adminCleanup: {}
|
adminCleanup: {},
|
||||||
|
printPdf: {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,8 @@ export const config: Config = {
|
||||||
lot: {},
|
lot: {},
|
||||||
lotOccupancy: {},
|
lotOccupancy: {},
|
||||||
workOrders: {},
|
workOrders: {},
|
||||||
adminCleanup: {}
|
adminCleanup: {},
|
||||||
|
printPdf: {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import * as lotOccupancyFunctions from "../../helpers/functions.lotOccupancy.js"
|
||||||
import { getReportData, getPdfPrintConfig } from "../../helpers/functions.print.js";
|
import { getReportData, getPdfPrintConfig } from "../../helpers/functions.print.js";
|
||||||
import { convertHTMLToPDF } from "@cityssm/pdf-puppeteer";
|
import { convertHTMLToPDF } from "@cityssm/pdf-puppeteer";
|
||||||
import camelcase from "camelcase";
|
import camelcase from "camelcase";
|
||||||
const attachmentOrInline = "attachment";
|
const attachmentOrInline = configFunctions.getProperty("settings.printPdf.contentDisposition");
|
||||||
export const handler = async (request, response, next) => {
|
export const handler = async (request, response, next) => {
|
||||||
const printName = request.params.printName;
|
const printName = request.params.printName;
|
||||||
const printConfig = getPdfPrintConfig(printName);
|
const printConfig = getPdfPrintConfig(printName);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import { getReportData, getPdfPrintConfig } from "../../helpers/functions.print.
|
||||||
import { convertHTMLToPDF } from "@cityssm/pdf-puppeteer";
|
import { convertHTMLToPDF } from "@cityssm/pdf-puppeteer";
|
||||||
import camelcase from "camelcase";
|
import camelcase from "camelcase";
|
||||||
|
|
||||||
const attachmentOrInline: "attachment" | "inline" = "attachment";
|
const attachmentOrInline = configFunctions.getProperty("settings.printPdf.contentDisposition");
|
||||||
|
|
||||||
export const handler: RequestHandler = async (request, response, next) => {
|
export const handler: RequestHandler = async (request, response, next) => {
|
||||||
const printName = request.params.printName;
|
const printName = request.params.printName;
|
||||||
|
|
|
||||||
|
|
@ -41,4 +41,5 @@ export declare function getProperty(propertyName: "settings.workOrders.workOrder
|
||||||
export declare function getProperty(propertyName: "settings.workOrders.calendarEmailAddress"): string;
|
export declare function getProperty(propertyName: "settings.workOrders.calendarEmailAddress"): string;
|
||||||
export declare function getProperty(propertyName: "settings.workOrders.prints"): string[];
|
export declare function getProperty(propertyName: "settings.workOrders.prints"): string[];
|
||||||
export declare function getProperty(propertyName: "settings.adminCleanup.recordDeleteAgeDays"): number;
|
export declare function getProperty(propertyName: "settings.adminCleanup.recordDeleteAgeDays"): number;
|
||||||
|
export declare function getProperty(propertyName: "settings.printPdf.contentDisposition"): "attachment" | "inline";
|
||||||
export declare const keepAliveMillis: number;
|
export declare const keepAliveMillis: number;
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,12 @@ configFallbackValues.set("settings.workOrders.workOrderNumberLength", 6);
|
||||||
configFallbackValues.set("settings.workOrders.workOrderMilestoneDateRecentBeforeDays", 5);
|
configFallbackValues.set("settings.workOrders.workOrderMilestoneDateRecentBeforeDays", 5);
|
||||||
configFallbackValues.set("settings.workOrders.workOrderMilestoneDateRecentAfterDays", 60);
|
configFallbackValues.set("settings.workOrders.workOrderMilestoneDateRecentAfterDays", 60);
|
||||||
configFallbackValues.set("settings.workOrders.calendarEmailAddress", "no-reply@127.0.0.1");
|
configFallbackValues.set("settings.workOrders.calendarEmailAddress", "no-reply@127.0.0.1");
|
||||||
configFallbackValues.set("settings.workOrders.prints", ["pdf/workOrder", "pdf/workOrder-commentLog"]);
|
configFallbackValues.set("settings.workOrders.prints", [
|
||||||
|
"pdf/workOrder",
|
||||||
|
"pdf/workOrder-commentLog"
|
||||||
|
]);
|
||||||
configFallbackValues.set("settings.adminCleanup.recordDeleteAgeDays", 60);
|
configFallbackValues.set("settings.adminCleanup.recordDeleteAgeDays", 60);
|
||||||
|
configFallbackValues.set("settings.printPdf.contentDisposition", "attachment");
|
||||||
export function getProperty(propertyName) {
|
export function getProperty(propertyName) {
|
||||||
const propertyNameSplit = propertyName.split(".");
|
const propertyNameSplit = propertyName.split(".");
|
||||||
let currentObject = config;
|
let currentObject = config;
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,15 @@ configFallbackValues.set("settings.workOrders.workOrderNumberLength", 6);
|
||||||
configFallbackValues.set("settings.workOrders.workOrderMilestoneDateRecentBeforeDays", 5);
|
configFallbackValues.set("settings.workOrders.workOrderMilestoneDateRecentBeforeDays", 5);
|
||||||
configFallbackValues.set("settings.workOrders.workOrderMilestoneDateRecentAfterDays", 60);
|
configFallbackValues.set("settings.workOrders.workOrderMilestoneDateRecentAfterDays", 60);
|
||||||
configFallbackValues.set("settings.workOrders.calendarEmailAddress", "no-reply@127.0.0.1");
|
configFallbackValues.set("settings.workOrders.calendarEmailAddress", "no-reply@127.0.0.1");
|
||||||
configFallbackValues.set("settings.workOrders.prints", ["pdf/workOrder", "pdf/workOrder-commentLog"]);
|
configFallbackValues.set("settings.workOrders.prints", [
|
||||||
|
"pdf/workOrder",
|
||||||
|
"pdf/workOrder-commentLog"
|
||||||
|
]);
|
||||||
|
|
||||||
configFallbackValues.set("settings.adminCleanup.recordDeleteAgeDays", 60);
|
configFallbackValues.set("settings.adminCleanup.recordDeleteAgeDays", 60);
|
||||||
|
|
||||||
|
configFallbackValues.set("settings.printPdf.contentDisposition", "attachment");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up function overloads
|
* Set up function overloads
|
||||||
*/
|
*/
|
||||||
|
|
@ -136,6 +141,10 @@ export function getProperty(propertyName: "settings.workOrders.prints"): string[
|
||||||
|
|
||||||
export function getProperty(propertyName: "settings.adminCleanup.recordDeleteAgeDays"): number;
|
export function getProperty(propertyName: "settings.adminCleanup.recordDeleteAgeDays"): number;
|
||||||
|
|
||||||
|
export function getProperty(
|
||||||
|
propertyName: "settings.printPdf.contentDisposition"
|
||||||
|
): "attachment" | "inline";
|
||||||
|
|
||||||
export function getProperty(propertyName: string): unknown {
|
export function getProperty(propertyName: string): unknown {
|
||||||
const propertyNameSplit = propertyName.split(".");
|
const propertyNameSplit = propertyName.split(".");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,9 @@ export interface Config {
|
||||||
adminCleanup: {
|
adminCleanup: {
|
||||||
recordDeleteAgeDays?: number;
|
recordDeleteAgeDays?: number;
|
||||||
};
|
};
|
||||||
|
printPdf: {
|
||||||
|
contentDisposition?: "attachment" | "inline";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
interface ConfigApplication {
|
interface ConfigApplication {
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,9 @@ export interface Config {
|
||||||
adminCleanup: {
|
adminCleanup: {
|
||||||
recordDeleteAgeDays?: number;
|
recordDeleteAgeDays?: number;
|
||||||
};
|
};
|
||||||
|
printPdf: {
|
||||||
|
contentDisposition?: "attachment" | "inline";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue