Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.16] [Dashboard] show fullscreen mode when url has fullScreenMode param (#196275) #197728

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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