mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
[Portable Dashboards] Fix Print Mode Regression (#148161)
Fixes a regression where the print mode setting wasn't properly passed to the Dashboard Container when using PDF reporting with the Optimize for Printing setting ON.
This commit is contained in:
parent
871e7bbed1
commit
b7624367b6
1 changed files with 18 additions and 1 deletions
|
@ -10,6 +10,7 @@ import { History } from 'history';
|
||||||
import useMount from 'react-use/lib/useMount';
|
import useMount from 'react-use/lib/useMount';
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { ViewMode } from '@kbn/embeddable-plugin/public';
|
||||||
import { useExecutionContext } from '@kbn/kibana-react-plugin/public';
|
import { useExecutionContext } from '@kbn/kibana-react-plugin/public';
|
||||||
import { createKbnUrlStateStorage, withNotifyOnErrors } from '@kbn/kibana-utils-plugin/public';
|
import { createKbnUrlStateStorage, withNotifyOnErrors } from '@kbn/kibana-utils-plugin/public';
|
||||||
|
|
||||||
|
@ -64,12 +65,14 @@ export function DashboardApp({
|
||||||
* Unpack & set up dashboard services
|
* Unpack & set up dashboard services
|
||||||
*/
|
*/
|
||||||
const {
|
const {
|
||||||
|
screenshotMode: { isScreenshotMode, getScreenshotContext },
|
||||||
coreContext: { executionContext },
|
coreContext: { executionContext },
|
||||||
embeddable: { getStateTransfer },
|
embeddable: { getStateTransfer },
|
||||||
notifications: { toasts },
|
notifications: { toasts },
|
||||||
settings: { uiSettings },
|
settings: { uiSettings },
|
||||||
data: { search },
|
data: { search },
|
||||||
} = pluginServices.getServices();
|
} = pluginServices.getServices();
|
||||||
|
|
||||||
const incomingEmbeddable = getStateTransfer().getIncomingEmbeddablePackage(
|
const incomingEmbeddable = getStateTransfer().getIncomingEmbeddablePackage(
|
||||||
DASHBOARD_APP_ID,
|
DASHBOARD_APP_ID,
|
||||||
true
|
true
|
||||||
|
@ -115,6 +118,7 @@ export function DashboardApp({
|
||||||
const getCreationOptions = useCallback((): DashboardCreationOptions => {
|
const getCreationOptions = useCallback((): DashboardCreationOptions => {
|
||||||
const initialUrlState = loadAndRemoveDashboardState(kbnUrlStateStorage);
|
const initialUrlState = loadAndRemoveDashboardState(kbnUrlStateStorage);
|
||||||
const searchSessionIdFromURL = getSearchSessionIdFromURL(history);
|
const searchSessionIdFromURL = getSearchSessionIdFromURL(history);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
incomingEmbeddable,
|
incomingEmbeddable,
|
||||||
|
|
||||||
|
@ -139,11 +143,24 @@ export function DashboardApp({
|
||||||
// State loaded from the dashboard app URL and from the locator overrides all other dashboard state.
|
// State loaded from the dashboard app URL and from the locator overrides all other dashboard state.
|
||||||
...initialUrlState,
|
...initialUrlState,
|
||||||
...stateFromLocator,
|
...stateFromLocator,
|
||||||
|
|
||||||
|
// if print mode is active, force viewMode.PRINT
|
||||||
|
...(isScreenshotMode() && getScreenshotContext('layout') === 'print'
|
||||||
|
? { viewMode: ViewMode.PRINT }
|
||||||
|
: {}),
|
||||||
},
|
},
|
||||||
|
|
||||||
validateLoadedSavedObject: validateOutcome,
|
validateLoadedSavedObject: validateOutcome,
|
||||||
};
|
};
|
||||||
}, [kbnUrlStateStorage, history, stateFromLocator, incomingEmbeddable, validateOutcome]);
|
}, [
|
||||||
|
history,
|
||||||
|
validateOutcome,
|
||||||
|
stateFromLocator,
|
||||||
|
isScreenshotMode,
|
||||||
|
kbnUrlStateStorage,
|
||||||
|
incomingEmbeddable,
|
||||||
|
getScreenshotContext,
|
||||||
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the redux wrapper from the dashboard container. This is used to wrap the top nav so it can interact with the
|
* Get the redux wrapper from the dashboard container. This is used to wrap the top nav so it can interact with the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue