Skip to content

Commit

Permalink
[Dashboard] put fullScreenMode as a top level key in creationOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
lsq645599166 committed Oct 21, 2024
1 parent 78fd591 commit 267aab2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/plugins/dashboard/common/dashboard_container/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export interface DashboardContainerInput extends EmbeddableInput {
timeRange?: TimeRange;
timeslice?: [number, number];
refreshInterval?: RefreshInterval;
fullScreenMode?: boolean;

// dashboard meta info
title: string;
Expand Down
1 change: 1 addition & 0 deletions src/plugins/dashboard/public/dashboard_api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export interface DashboardCreationOptions {

validateLoadedSavedObject?: (result: LoadDashboardReturn) => 'valid' | 'invalid' | 'redirected';

fullScreenMode?: boolean;
isEmbeddedExternally?: boolean;

getEmbeddableAppContext?: (dashboardId?: string) => EmbeddableAppContext;
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/dashboard/public/dashboard_app/dashboard_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ export function DashboardApp({
*/
const getCreationOptions = useCallback((): Promise<DashboardCreationOptions> => {
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 {
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 267aab2

Please sign in to comment.