diff --git a/web/src/interfaces/AdminInterface.ts b/web/src/interfaces/AdminInterface.ts index b8aa7a1a0..bfffc130f 100644 --- a/web/src/interfaces/AdminInterface.ts +++ b/web/src/interfaces/AdminInterface.ts @@ -25,6 +25,7 @@ import "../elements/messages/MessageContainer"; import "../elements/messages/MessageContainer"; import "../elements/notifications/NotificationDrawer"; import { ID_REGEX, SLUG_REGEX, UUID_REGEX } from "../elements/router/Route"; +import { getURLParam, updateURLParams } from "../elements/router/RouteMatch"; import "../elements/router/RouterOutlet"; import "../elements/sidebar/Sidebar"; import "../elements/sidebar/SidebarItem"; @@ -37,10 +38,10 @@ export class AdminInterface extends LitElement { sidebarOpen = true; @property({ type: Boolean }) - notificationOpen = false; + notificationDrawerOpen = getURLParam("notificationDrawerOpen", false); @property({ type: Boolean }) - apiDrawerOpen = false; + apiDrawerOpen = getURLParam("apiDrawerOpen", false); ws: WebsocketClient; @@ -87,10 +88,16 @@ export class AdminInterface extends LitElement { this.sidebarOpen = !this.sidebarOpen; }); window.addEventListener(EVENT_NOTIFICATION_DRAWER_TOGGLE, () => { - this.notificationOpen = !this.notificationOpen; + this.notificationDrawerOpen = !this.notificationDrawerOpen; + updateURLParams({ + notificationDrawerOpen: this.notificationDrawerOpen, + }); }); window.addEventListener(EVENT_API_DRAWER_TOGGLE, () => { this.apiDrawerOpen = !this.apiDrawerOpen; + updateURLParams({ + apiDrawerOpen: this.apiDrawerOpen, + }); }); this.version = new AdminApi(DEFAULT_CONFIG).adminVersionRetrieve(); } @@ -104,7 +111,7 @@ export class AdminInterface extends LitElement {
@@ -125,10 +132,10 @@ export class AdminInterface extends LitElement {
{ - this.notificationOpen = !this.notificationOpen; + this.notificationDrawerOpen = !this.notificationDrawerOpen; + updateURLParams({ + notificationDrawerOpen: this.notificationDrawerOpen, + }); }); window.addEventListener(EVENT_API_DRAWER_TOGGLE, () => { this.apiDrawerOpen = !this.apiDrawerOpen; + updateURLParams({ + apiDrawerOpen: this.apiDrawerOpen, + }); }); window.addEventListener(EVENT_REFRESH, () => { this.firstUpdated(); @@ -150,6 +157,9 @@ export class UserInterface extends LitElement { type="button" @click=${() => { this.apiDrawerOpen = !this.apiDrawerOpen; + updateURLParams({ + apiDrawerOpen: this.apiDrawerOpen, + }); }} > @@ -165,7 +175,12 @@ export class UserInterface extends LitElement { type="button" aria-label="${t`Unread notifications`}" @click=${() => { - this.notificationOpen = !this.notificationOpen; + this.notificationDrawerOpen = + !this.notificationDrawerOpen; + updateURLParams({ + notificationDrawerOpen: + this.notificationDrawerOpen, + }); }} >
@@ -288,10 +303,11 @@ export class UserInterface extends LitElement {
("search", undefined); fuse?: Fuse; @@ -125,6 +126,9 @@ export class LibraryPage extends LitElement { ? html` { this.query = (ev.target as HTMLInputElement).value; + updateURLParams({ + search: this.query, + }); if (!this.fuse) return; const apps = this.fuse.search(this.query); if (apps.length < 1) return; @@ -135,6 +139,10 @@ export class LibraryPage extends LitElement { window.location.assign(this.selectedApp.launchUrl); } else if (ev.key === "Escape") { (ev.target as HTMLInputElement).value = ""; + this.query = ""; + updateURLParams({ + search: this.query, + }); this.selectedApp = undefined; } }}