mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [[Reporting] fix dashboard "Copy Post URL" action (#192530)](https://github.com/elastic/kibana/pull/192530) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Tim Sullivan","email":"tsullivan@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-10-07T23:54:21Z","message":"[Reporting] fix dashboard \"Copy Post URL\" action (#192530)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/191673\r\nCloses https://github.com/elastic/kibana/issues/183566\r\n\r\nFixes the ability for the POST URL used to automate generation of\r\nreports by adding a `generateExportUrl` function to the ShareMenuItemV2\r\ninterface. This function returns a dynamic export URL for PDF generation\r\nby using the selected layout option.\r\n\r\nOther changes: provides more strictness in type definitions by:\r\n * splitting the types that define `ShareMenuProvider`:\r\n * `ShareMenuProviderV2` provides the `getShareMenuItems` function\r\n* `ShareMenuProviderLegacy` provides the `getShareMenuItemsLegacy`\r\nfunction\r\n\r\n### Release note\r\nFixed an issue with the export options for PNG/PDF reports in a\r\ndashboard.\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [x] Use the `generateExportUrl` function inputs to return a POST URL\r\nthat is aware of the layout mode (`print` or `preserve_layout`) and\r\nscreen dimensions\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] Flaky test runner:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6986","sha":"38407ae6b01e071757083fe358116b6dd75c4422","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","v8.16.0","backport:version","v8.15.2"],"title":"[Reporting] fix dashboard \"Copy Post URL\" action","number":192530,"url":"https://github.com/elastic/kibana/pull/192530","mergeCommit":{"message":"[Reporting] fix dashboard \"Copy Post URL\" action (#192530)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/191673\r\nCloses https://github.com/elastic/kibana/issues/183566\r\n\r\nFixes the ability for the POST URL used to automate generation of\r\nreports by adding a `generateExportUrl` function to the ShareMenuItemV2\r\ninterface. This function returns a dynamic export URL for PDF generation\r\nby using the selected layout option.\r\n\r\nOther changes: provides more strictness in type definitions by:\r\n * splitting the types that define `ShareMenuProvider`:\r\n * `ShareMenuProviderV2` provides the `getShareMenuItems` function\r\n* `ShareMenuProviderLegacy` provides the `getShareMenuItemsLegacy`\r\nfunction\r\n\r\n### Release note\r\nFixed an issue with the export options for PNG/PDF reports in a\r\ndashboard.\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [x] Use the `generateExportUrl` function inputs to return a POST URL\r\nthat is aware of the layout mode (`print` or `preserve_layout`) and\r\nscreen dimensions\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] Flaky test runner:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6986","sha":"38407ae6b01e071757083fe358116b6dd75c4422"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/192530","number":192530,"mergeCommit":{"message":"[Reporting] fix dashboard \"Copy Post URL\" action (#192530)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/191673\r\nCloses https://github.com/elastic/kibana/issues/183566\r\n\r\nFixes the ability for the POST URL used to automate generation of\r\nreports by adding a `generateExportUrl` function to the ShareMenuItemV2\r\ninterface. This function returns a dynamic export URL for PDF generation\r\nby using the selected layout option.\r\n\r\nOther changes: provides more strictness in type definitions by:\r\n * splitting the types that define `ShareMenuProvider`:\r\n * `ShareMenuProviderV2` provides the `getShareMenuItems` function\r\n* `ShareMenuProviderLegacy` provides the `getShareMenuItemsLegacy`\r\nfunction\r\n\r\n### Release note\r\nFixed an issue with the export options for PNG/PDF reports in a\r\ndashboard.\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [x] Use the `generateExportUrl` function inputs to return a POST URL\r\nthat is aware of the layout mode (`print` or `preserve_layout`) and\r\nscreen dimensions\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] Flaky test runner:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6986","sha":"38407ae6b01e071757083fe358116b6dd75c4422"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Tim Sullivan <tsullivan@users.noreply.github.com>
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
/*
|
|
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
|
* Public License v 1"; you may not use this file except in compliance with, at
|
|
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
|
* License v3.0 only", or the "Server Side Public License, v 1".
|
|
*/
|
|
|
|
import { SharePluginStart, SharePluginSetup } from '@kbn/share-plugin/public';
|
|
import { Plugin, CoreSetup, CoreStart } from '@kbn/core/public';
|
|
|
|
interface SetupDeps {
|
|
share: SharePluginSetup;
|
|
}
|
|
|
|
interface StartDeps {
|
|
share: SharePluginStart;
|
|
}
|
|
|
|
export class ShareDemoPlugin implements Plugin<void, void, SetupDeps, StartDeps> {
|
|
public setup(core: CoreSetup<StartDeps>, { share }: SetupDeps) {
|
|
share.register({
|
|
id: 'demo',
|
|
getShareMenuItemsLegacy: (context) => [
|
|
{
|
|
panel: {
|
|
id: 'demo',
|
|
title: 'Panel title',
|
|
content: 'Panel content',
|
|
},
|
|
shareMenuItem: {
|
|
name: 'Demo list item (from share_example plugin)',
|
|
},
|
|
},
|
|
],
|
|
});
|
|
}
|
|
|
|
public start(core: CoreStart, { share }: StartDeps) {}
|
|
|
|
public stop() {}
|
|
}
|