forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reintroduced pdfv2 export type, see https://github.com/elastic/kibana…
- Loading branch information
1 parent
af84716
commit e582439
Showing
29 changed files
with
1,058 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { isObject } from 'lodash'; | ||
|
||
// TODO: Remove this code once everyone is using the new PDF format, then we can also remove the legacy | ||
// export type entirely | ||
export const isJobV2Params = ({ sharingData }: { sharingData: Record<string, unknown> }): boolean => | ||
isObject(sharingData.locator); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
x-pack/plugins/reporting/server/export_types/printable_pdf/v2/create_job.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { cryptoFactory } from '../../../lib'; | ||
import { CreateJobFn, CreateJobFnFactory } from '../../../types'; | ||
import { JobParamsPDFV2, TaskPayloadPDFV2 } from './types'; | ||
|
||
export const createJobFnFactory: CreateJobFnFactory< | ||
CreateJobFn<JobParamsPDFV2, TaskPayloadPDFV2> | ||
> = function createJobFactoryFn(reporting, logger) { | ||
const config = reporting.getConfig(); | ||
const crypto = cryptoFactory(config.get('encryptionKey')); | ||
|
||
return async function createJob( | ||
{ title, locator, browserTimezone, layout, objectType }, | ||
context, | ||
req | ||
) { | ||
const serializedEncryptedHeaders = await crypto.encrypt(req.headers); | ||
|
||
return { | ||
headers: serializedEncryptedHeaders, | ||
spaceId: reporting.getSpaceId(req, logger), | ||
browserTimezone, | ||
forceNow: new Date().toISOString(), | ||
layout, | ||
locator, | ||
title, | ||
objectType, | ||
}; | ||
}; | ||
}; |
Oops, something went wrong.