Skip to content

Commit

Permalink
[Dashboard] show fullscreen mode when url has fullScreenMode param (e…
Browse files Browse the repository at this point in the history
…lastic#196275)

## Summary

Closes elastic#174561

Show fullscreen mode when url has fullScreenMode param
`&_a=(fullScreenMode:!t)`

### Screenshot

![20241015-184503](https://github.com/user-attachments/assets/fae01dcc-f081-4314-84f9-3923adc76e5b)

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Hannah Mudge <[email protected]>
(cherry picked from commit 72c0b81)
  • Loading branch information
lsq645599166 committed Oct 24, 2024
1 parent 6bde962 commit e210530
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ export interface InitialComponentState {
lastSavedInput: DashboardContainerInput;
lastSavedId: string | undefined;
managed: boolean;
fullScreenMode: boolean;
}

export function getDashboardApi(
initialComponentState: InitialComponentState,
untilEmbeddableLoaded: (id: string) => Promise<unknown>
) {
const animatePanelTransforms$ = new BehaviorSubject(false); // set panel transforms to false initially to avoid panels animating on initial render.
const fullScreenMode$ = new BehaviorSubject(false);
const fullScreenMode$ = new BehaviorSubject(initialComponentState.fullScreenMode);
const managed$ = new BehaviorSubject(initialComponentState.managed);
const savedObjectId$ = new BehaviorSubject<string | undefined>(initialComponentState.lastSavedId);

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
3 changes: 3 additions & 0 deletions src/plugins/dashboard/public/dashboard_app/dashboard_app.tsx
Original file line number Diff line number Diff line change
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,6 +110,7 @@ export const createDashboard = async (
},
lastSavedId: savedObjectId,
managed: savedObjectResult.managed ?? false,
fullScreenMode: creationOptions?.fullScreenMode ?? false,
};

const dashboardContainer = new DashboardContainer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ test('searchSessionId propagates to children', async () => {
lastSavedInput: sampleInput,
lastSavedId: undefined,
managed: false,
fullScreenMode: false,
}
);
container?.setControlGroupApi(mockControlGroupApi);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ export class DashboardContainer
isEmbeddedExternally: false,
lastSavedInput: initialInput,
lastSavedId: undefined,
fullScreenMode: false,
managed: false,
},
(id: string) => this.untilEmbeddableLoaded(id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,6 @@ export function InternalDashboardTopNav({
dashboardTitleRef.current?.focus();
}, [title, viewMode]);

/**
* Manage chrome visibility when dashboard is embedded.
*/
useEffect(() => {
if (!embedSettings) coreServices.chrome.setIsVisible(viewMode !== 'print');
}, [embedSettings, viewMode]);

/**
* populate recently accessed, and set is chrome visible.
*/
Expand Down
1 change: 1 addition & 0 deletions src/plugins/dashboard/public/mocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export function buildMockDashboard({
lastSavedInput: initialInput,
lastSavedId: savedObjectId,
managed: false,
fullScreenMode: false,
}
);
dashboardContainer?.setControlGroupApi(mockControlGroupApi);
Expand Down

0 comments on commit e210530

Please sign in to comment.