diff --git a/src/plugins/dashboard/common/dashboard_container/types.ts b/src/plugins/dashboard/common/dashboard_container/types.ts index 8324c6cb8400b..bcb7670f18e12 100644 --- a/src/plugins/dashboard/common/dashboard_container/types.ts +++ b/src/plugins/dashboard/common/dashboard_container/types.ts @@ -53,7 +53,6 @@ export interface DashboardContainerInput extends EmbeddableInput { timeRange?: TimeRange; timeslice?: [number, number]; refreshInterval?: RefreshInterval; - fullScreenMode?: boolean; // dashboard meta info title: string; diff --git a/src/plugins/dashboard/public/dashboard_api/types.ts b/src/plugins/dashboard/public/dashboard_api/types.ts index e0b6b8d3e4824..ec89a93dcd66e 100644 --- a/src/plugins/dashboard/public/dashboard_api/types.ts +++ b/src/plugins/dashboard/public/dashboard_api/types.ts @@ -68,6 +68,7 @@ export interface DashboardCreationOptions { validateLoadedSavedObject?: (result: LoadDashboardReturn) => 'valid' | 'invalid' | 'redirected'; + fullScreenMode?: boolean; isEmbeddedExternally?: boolean; getEmbeddableAppContext?: (dashboardId?: string) => EmbeddableAppContext; diff --git a/src/plugins/dashboard/public/dashboard_app/dashboard_app.tsx b/src/plugins/dashboard/public/dashboard_app/dashboard_app.tsx index f65ee8f7a80ca..400d56e97df09 100644 --- a/src/plugins/dashboard/public/dashboard_app/dashboard_app.tsx +++ b/src/plugins/dashboard/public/dashboard_app/dashboard_app.tsx @@ -119,9 +119,9 @@ export function DashboardApp({ */ const getCreationOptions = useCallback((): Promise => { const searchSessionIdFromURL = getSearchSessionIdFromURL(history); - const initialUrlState = loadAndRemoveDashboardState(kbnUrlStateStorage); const getInitialInput = () => { const stateFromLocator = loadDashboardHistoryLocationState(getScopedHistory); + const initialUrlState = loadAndRemoveDashboardState(kbnUrlStateStorage); // Override all state with URL + Locator input return { @@ -157,6 +157,9 @@ export function DashboardApp({ }, getInitialInput, validateLoadedSavedObject: validateOutcome, + fullScreenMode: + kbnUrlStateStorage.get<{ fullScreenMode?: boolean }>(DASHBOARD_STATE_STORAGE_KEY) + ?.fullScreenMode ?? false, isEmbeddedExternally: Boolean(embedSettings), // embed settings are only sent if the dashboard URL has `embed=true` getEmbeddableAppContext: (dashboardId) => ({ currentAppId: DASHBOARD_APP_ID, diff --git a/src/plugins/dashboard/public/dashboard_container/embeddable/create/create_dashboard.ts b/src/plugins/dashboard/public/dashboard_container/embeddable/create/create_dashboard.ts index d491d907c67b8..2510f2e015dfb 100644 --- a/src/plugins/dashboard/public/dashboard_container/embeddable/create/create_dashboard.ts +++ b/src/plugins/dashboard/public/dashboard_container/embeddable/create/create_dashboard.ts @@ -110,7 +110,7 @@ export const createDashboard = async ( }, lastSavedId: savedObjectId, managed: savedObjectResult.managed ?? false, - fullScreenMode: creationOptions?.getInitialInput?.().fullScreenMode ?? false, + fullScreenMode: creationOptions?.fullScreenMode ?? false, }; const dashboardContainer = new DashboardContainer(