Skip to content

Commit c152782

Browse files
authored
feat: add dashboard fullscreen modes (#125806)
* feat(ui): add dashboard fullscreen modes * docs(ui): document dashboard fullscreen modes * fix(ui): scope dashboard fullscreen lifecycles * test(ui): align dashboard e2e grant fixture * fix(ui): surface dashboard document load failures
1 parent 82d48e0 commit c152782

23 files changed

Lines changed: 1001 additions & 131 deletions

‎docs/web/dashboards.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ thread's `/dashboard/<agent>/<sessionRef>` URL. An open Dashboards page updates
2525
as threads are renamed, archived, deleted, or switched between Chat and
2626
Dashboard, including after a Gateway reconnect.
2727

28+
Use **Open full-screen dashboard** on a row to open its board as a standalone
29+
browser document with no sidebar, top bar, or chat. The close button returns to
30+
the previous page. Inside a session, use the fullscreen button beside the
31+
Chat / Split / Dashboard switch to enter or leave browser fullscreen while the
32+
board is visible.
33+
2834
The Chat or Dashboard face preference is stored server-side per thread. It
2935
therefore follows you when you connect to the same gateway from another device.
3036
Opening a thread from the sidebar, Sessions, Tasks, Workboard, or Worktrees

‎docs/web/urls.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ own `?session=` parameter because that parameter expands a row; it is not a
123123
session deep link. The one-shot composer value `?draft=` remains supported on
124124
chat and dashboard session paths.
125125

126+
This canonical-link restriction applies to application routes. The standalone
127+
dashboard document described below intentionally uses
128+
`/?view=dashboard&session=<sessionKey>` because it is a special document, not a
129+
session route.
130+
126131
## Route table
127132

128133
This table lists every Control UI application route. A dash means the route has
@@ -205,6 +210,10 @@ These Gateway-served documents sit outside the application route table:
205210
- `/?view=terminal` opens the same terminal-only document in the WebView/embed
206211
form used by the mobile apps. Terminal availability in either form still
207212
requires `gateway.terminal.enabled` and `operator.admin`.
213+
- `/?view=dashboard&session=<sessionKey>` opens that session's interactive
214+
dashboard full-window without application or chat chrome. The document stays
215+
connected to live board updates and shows a visible empty state when the
216+
session or board is unavailable.
208217
- `/approve/<approvalId>` opens a standalone approval document. With a base
209218
path, use `<basePath>/approve/<approvalId>`. The id identifies an approval but
210219
never authorizes it; normal Gateway authentication still applies.

‎ui/src/app/app-root.ts‎

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ import { isDesktopPanelAvailable } from "./app-shell-chrome.ts";
1717
import { bootstrapApplication, type ApplicationRuntime } from "./bootstrap.ts";
1818
import { resolveControlUiBasePath } from "./browser.ts";
1919
import { applicationContext, type ApplicationContext } from "./context.ts";
20+
import { dashboardDocumentSession, isDashboardOnlyView } from "./dashboard-document-mode.ts";
2021
import { desktopDocumentOptions, isDesktopOnlyView } from "./desktop-document-mode.ts";
2122
import {
2223
APPROVAL_PAGE_ELEMENT,
24+
DASHBOARD_DOCUMENT_ELEMENT,
2325
DESKTOP_PANEL_ELEMENT,
2426
isOptionalElementDefined,
2527
preloadOptionalElement,
@@ -86,6 +88,8 @@ export class OpenClawApp extends OpenClawLightDomElement {
8688
globalThis.location,
8789
resolveControlUiBasePath(globalThis.location?.pathname ?? "/"),
8890
);
91+
private readonly dashboardOnly = isDashboardOnlyView(globalThis.location);
92+
private readonly dashboardSession = dashboardDocumentSession(globalThis.location);
8993
private readonly desktopOptions = desktopDocumentOptions(globalThis.location);
9094
private runtime: ApplicationRuntime | undefined;
9195
private readonly contextProvider = new ContextProvider(this, {
@@ -130,6 +134,9 @@ export class OpenClawApp extends OpenClawLightDomElement {
130134
if (this.desktopOnly) {
131135
preloadOptionalElement(this, DESKTOP_PANEL_ELEMENT);
132136
}
137+
if (this.dashboardOnly) {
138+
preloadOptionalElement(this, DASHBOARD_DOCUMENT_ELEMENT);
139+
}
133140
if (this.runtime.documentMode?.kind === "approval") {
134141
preloadOptionalElement(this, APPROVAL_PAGE_ELEMENT);
135142
}
@@ -201,6 +208,14 @@ export class OpenClawApp extends OpenClawLightDomElement {
201208
this.loginShowGatewayPassword = false;
202209
}
203210

211+
private closeDocument(basePath: string): void {
212+
if (globalThis.history.length > 1) {
213+
globalThis.history.back();
214+
} else {
215+
globalThis.location.assign(basePath || "/");
216+
}
217+
}
218+
204219
override render() {
205220
const context = this.context;
206221
const runtime = this.runtime;
@@ -271,13 +286,7 @@ export class OpenClawApp extends OpenClawLightDomElement {
271286
.documentSource=${this.desktopOptions.source}
272287
.documentSession=${this.desktopOptions.session}
273288
.documentControl=${this.desktopOptions.control}
274-
.onDocumentClose=${() => {
275-
if (globalThis.history.length > 1) {
276-
globalThis.history.back();
277-
} else {
278-
globalThis.location.assign(context.basePath || "/");
279-
}
280-
}}
289+
.onDocumentClose=${() => this.closeDocument(context.basePath)}
281290
></openclaw-desktop-panel>
282291
${!gatewayConnected && gatewaySnapshot.lastError === null
283292
? renderConnectingSplash(gatewayStartupStatus)
@@ -290,6 +299,23 @@ export class OpenClawApp extends OpenClawLightDomElement {
290299
: nothing}
291300
`;
292301
}
302+
// Dashboard documents reuse the live board provider and widget bridge while
303+
// keeping the application shell, transcript, and navigation chrome unmounted.
304+
if (this.dashboardOnly) {
305+
return html`
306+
<openclaw-board-document
307+
.gatewaySnapshot=${gatewaySnapshot}
308+
.sessionKey=${this.dashboardSession}
309+
.onDocumentClose=${() => this.closeDocument(context.basePath)}
310+
></openclaw-board-document>
311+
${!gatewayConnected && gatewaySnapshot.lastError === null
312+
? renderConnectingSplash(gatewayStartupStatus)
313+
: nothing}
314+
${!isOptionalElementDefined(DASHBOARD_DOCUMENT_ELEMENT) && gatewayConnected
315+
? renderConnectingSplash(gatewayStartupStatus)
316+
: nothing}
317+
`;
318+
}
293319
// In the normal Control UI document, the Gateway lifecycle owns unresolved
294320
// first-connect state across every auth mode. Failures publish lastError
295321
// before the gate returns; reconnects keep the shell mounted, and

‎ui/src/app/bootstrap.ts‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import type {
4040
ApplicationThemeServerSelection,
4141
} from "./context.ts";
4242
import { syncCustomThemeStyleTag } from "./custom-theme.ts";
43+
import { isDashboardOnlyView } from "./dashboard-document-mode.ts";
4344
import { isDesktopDocumentPath, isDesktopOnlyView } from "./desktop-document-mode.ts";
4445
import { createApplicationGateway } from "./gateway-store.ts";
4546
import { createInitialUserMessageHandoff } from "./initial-user-message-handoff.ts";
@@ -273,9 +274,11 @@ export function bootstrapApplication(
273274
const basePath = resolveControlUiBasePath(
274275
startup.location.pathname || globalThis.location?.pathname || "/",
275276
);
277+
const dashboardDocument = isDashboardOnlyView(startup.location);
276278
const standaloneDocument =
277279
isTerminalDocumentPath(startup.location.pathname, basePath) ||
278-
isDesktopDocumentPath(startup.location.pathname, basePath);
280+
isDesktopDocumentPath(startup.location.pathname, basePath) ||
281+
dashboardDocument;
279282
const firstRunDefaultLanding =
280283
documentMode === null && isDefaultChatLanding(startup.location, basePath, routeIdFromPath);
281284
// A `?view=` document mode still lands on the chat path, so it counts as the default landing
@@ -284,10 +287,11 @@ export function bootstrapApplication(
284287
const firstRunRedirectEnabled =
285288
firstRunDefaultLanding &&
286289
!isTerminalOnlyView(startup.location, basePath) &&
287-
!isDesktopOnlyView(startup.location, basePath);
290+
!isDesktopOnlyView(startup.location, basePath) &&
291+
!dashboardDocument;
288292
const sessionPathBuilderReady =
289293
dependencies.sessionPathBuilderReady ??
290-
(documentMode
294+
(documentMode || dashboardDocument
291295
? Promise.resolve()
292296
: import("@openclaw/session-url-contract").then((contract) => {
293297
setSessionPathBuilder(contract.buildControlUiSessionPath);
@@ -320,7 +324,7 @@ export function bootstrapApplication(
320324
firstRunDefaultLanding &&
321325
!parseAgentSessionKey(settings.sessionKey);
322326
const initialLocationReady = (
323-
documentMode
327+
documentMode || dashboardDocument
324328
? Promise.resolve(startup.location)
325329
: Promise.all([sessionPathBuilderReady, import("./bootstrap-location.ts")]).then(
326330
([, location]) =>
@@ -383,8 +387,8 @@ export function bootstrapApplication(
383387
const chatAttachmentHandoff = createChatAttachmentHandoff();
384388
applyThemePresentation(settings);
385389
const router = createApplicationRouter();
386-
// Standalone terminal and desktop paths render before the shell; starting
387-
// the page router would rewrite these special documents to /chat.
390+
// Standalone terminal, desktop, and dashboard documents render before the
391+
// shell; starting the page router would rewrite them to an application route.
388392
const startsApplicationRouter = documentMode === null && !standaloneDocument;
389393
let routerStarted = false;
390394
// Pre-start navigations are invisible to history; retain the latest request so
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { normalizeRouteBasePath } from "@openclaw/uirouter";
2+
3+
type DashboardDocumentLocation = Pick<Location, "search">;
4+
5+
export function isDashboardOnlyView(
6+
location: DashboardDocumentLocation | undefined = globalThis.location,
7+
): boolean {
8+
return new URLSearchParams(location?.search ?? "").get("view") === "dashboard";
9+
}
10+
11+
export function dashboardDocumentSession(
12+
location: DashboardDocumentLocation | undefined = globalThis.location,
13+
): string | null {
14+
return new URLSearchParams(location?.search ?? "").get("session");
15+
}
16+
17+
export function dashboardDocumentHref(basePath: string, sessionRef: string): string {
18+
const path = normalizeRouteBasePath(basePath) || "/";
19+
const search = new URLSearchParams({ view: "dashboard", session: sessionRef });
20+
return `${path}?${search}`;
21+
}

‎ui/src/app/desktop-document-mode.test.ts‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,41 @@
11
import { describe, expect, it } from "vitest";
22
import type { GatewaySessionRow } from "../api/types.ts";
33
import { resolveDesktopDocumentTarget } from "../components/desktop/desktop-source.ts";
4+
import {
5+
dashboardDocumentHref,
6+
dashboardDocumentSession,
7+
isDashboardOnlyView,
8+
} from "./dashboard-document-mode.ts";
49
import { desktopDocumentOptions } from "./desktop-document-mode.ts";
510

11+
describe("dashboard document mode", () => {
12+
it("parses the dashboard session reference", () => {
13+
const location = {
14+
search: "?view=dashboard&session=agent%3Amain%3Awork",
15+
};
16+
17+
expect(isDashboardOnlyView(location)).toBe(true);
18+
expect(dashboardDocumentSession(location)).toBe("agent:main:work");
19+
});
20+
21+
it("keeps a missing session visible to the document empty state", () => {
22+
const location = { search: "?view=dashboard" };
23+
24+
expect(isDashboardOnlyView(location)).toBe(true);
25+
expect(dashboardDocumentSession(location)).toBeNull();
26+
});
27+
28+
it("does not treat an ordinary route as a dashboard document", () => {
29+
expect(isDashboardOnlyView({ search: "" })).toBe(false);
30+
});
31+
32+
it("builds an encoded base-path-aware document URL", () => {
33+
expect(dashboardDocumentHref("/openclaw/", "agent:main:work item")).toBe(
34+
"/openclaw?view=dashboard&session=agent%3Amain%3Awork+item",
35+
);
36+
});
37+
});
38+
639
describe("desktop document mode", () => {
740
it("parses desktop source, session, and control options", () => {
841
expect(

‎ui/src/app/lazy-custom-element.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ export const DESKTOP_PANEL_ELEMENT = {
7070
loadModule: () => import("../components/desktop/desktop-panel.ts"),
7171
} satisfies OptionalCustomElement;
7272

73+
export const DASHBOARD_DOCUMENT_ELEMENT = {
74+
tagName: "openclaw-board-document",
75+
label: "dashboard document",
76+
loadModule: () => import("../components/board/board-document.ts"),
77+
} satisfies OptionalCustomElement;
78+
7379
export const CUSTODIAN_PANEL_ELEMENT = {
7480
tagName: "openclaw-custodian-panel",
7581
label: "custodian panel",

0 commit comments

Comments
 (0)