feat(FN-3785): add standalone HTML rendering and export routes for reports
Adds a complete HTML rendering and export pipeline to the fusion-plugin-reports plugin, including a standalone HTML renderer with template and stylesheet support, new export routes (`/api/reports/:id/export/html`) that persist rendered HTML to the store, and plugin-type support for non-JSON route re Fusion-Task-Id: FN-3785
This commit is contained in:
@@ -579,6 +579,14 @@ export function createPluginRouter(
|
||||
const result = await route.handler(req as unknown, ctx);
|
||||
|
||||
if (isPluginRouteResponse(result)) {
|
||||
if (result.headers) {
|
||||
for (const [name, value] of Object.entries(result.headers)) {
|
||||
res.setHeader(name, value);
|
||||
}
|
||||
}
|
||||
if (result.contentType) {
|
||||
res.setHeader("Content-Type", result.contentType);
|
||||
}
|
||||
if (result.status === 204) {
|
||||
res.status(204).send();
|
||||
return;
|
||||
@@ -587,6 +595,14 @@ export function createPluginRouter(
|
||||
res.status(result.status).send();
|
||||
return;
|
||||
}
|
||||
if (
|
||||
result.contentType
|
||||
|| typeof result.body === "string"
|
||||
|| Buffer.isBuffer(result.body)
|
||||
) {
|
||||
res.status(result.status).send(result.body);
|
||||
return;
|
||||
}
|
||||
res.status(result.status).json(result.body);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user