diff --git a/netbox/project-static/dist/graphiql.js.map b/netbox/project-static/dist/graphiql.js.map index 5a7a6a823..fce5c4536 100644 Binary files a/netbox/project-static/dist/graphiql.js.map and b/netbox/project-static/dist/graphiql.js.map differ diff --git a/netbox/project-static/dist/netbox.js b/netbox/project-static/dist/netbox.js index c0f1e123d..93f8ecf32 100644 Binary files a/netbox/project-static/dist/netbox.js and b/netbox/project-static/dist/netbox.js differ diff --git a/netbox/project-static/dist/netbox.js.map b/netbox/project-static/dist/netbox.js.map index 3f86f2108..197b62541 100644 Binary files a/netbox/project-static/dist/netbox.js.map and b/netbox/project-static/dist/netbox.js.map differ diff --git a/netbox/project-static/src/sidenav.ts b/netbox/project-static/src/sidenav.ts index 628b4f58d..90f0623ae 100644 --- a/netbox/project-static/src/sidenav.ts +++ b/netbox/project-static/src/sidenav.ts @@ -17,7 +17,10 @@ class SideNav { constructor(base: HTMLDivElement) { this.base = base; - this.state = new StateManager({ pinned: true }, { persist: true }); + this.state = new StateManager( + { pinned: true }, + { persist: true, key: 'netbox-sidenav' }, + ); this.init(); this.initLinks(); diff --git a/netbox/project-static/src/state/index.ts b/netbox/project-static/src/state/index.ts index 3fcdb5889..6d9e46de0 100644 --- a/netbox/project-static/src/state/index.ts +++ b/netbox/project-static/src/state/index.ts @@ -8,6 +8,11 @@ interface StateOptions { * exists in localStorage, the value will be read and used as the initial value. */ persist?: boolean; + + /** + * Use a static localStorage key instead of automatically generating one. + */ + key?: string; } /** @@ -49,10 +54,15 @@ export class StateManager { private key: string = ''; constructor(raw: T, options: StateOptions) { - this.key = this.generateStateKey(raw); - this.options = options; + // Use static key if defined. + if (typeof this.options.key === 'string') { + this.key = this.options.key; + } else { + this.key = this.generateStateKey(raw); + } + if (this.options.persist) { const saved = this.retrieve(); if (saved !== null) { diff --git a/netbox/templates/base/base.html b/netbox/templates/base/base.html index 556c9e079..04e980e9d 100644 --- a/netbox/templates/base/base.html +++ b/netbox/templates/base/base.html @@ -21,7 +21,7 @@ {# Page title #} {% block title %}Home{% endblock %} | NetBox - {# Page layout #} {% block layout %}{% endblock %}