From bb93a49476c0474115dc05203243e490a5f151ef Mon Sep 17 00:00:00 2001 From: VargaJoe Date: Tue, 10 Nov 2026 13:52:24 +0100 Subject: [PATCH] fix(admin): prefix repository tab titles with Admin --- .../components/repository-document-title.tsx | 2 +- .../test/repository-document-title.test.tsx | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/sensenet/src/components/repository-document-title.tsx b/apps/sensenet/src/components/repository-document-title.tsx index df7ef25da..e227af99c 100644 --- a/apps/sensenet/src/components/repository-document-title.tsx +++ b/apps/sensenet/src/components/repository-document-title.tsx @@ -9,7 +9,7 @@ export function RepositoryDocumentTitle() { const { connections } = useRepositoryConnections() const repoUrl = normalizeRepositoryUrl(repository.configuration.repositoryUrl) const connection = connections.find((item) => item.repoUrl === repoUrl) - const title = getRepositoryConnectionName(connection || { repoUrl }) + const title = `Admin: ${getRepositoryConnectionName(connection || { repoUrl })}` useEffect(() => { const previousTitle = document.title diff --git a/apps/sensenet/test/repository-document-title.test.tsx b/apps/sensenet/test/repository-document-title.test.tsx index f2ee32043..909a8dce2 100644 --- a/apps/sensenet/test/repository-document-title.test.tsx +++ b/apps/sensenet/test/repository-document-title.test.tsx @@ -47,7 +47,7 @@ const mount = (repoUrl = first) => { it('uses the same URL-derived host, port and path as Recent for an unsaved repository', () => { mount(`${first}/?ignored=value#fragment`) - expect(document.title).toBe('first.example:8443/tenant') + expect(document.title).toBe('Admin: first.example:8443/tenant') }) it('uses the custom name of the active repository, independently of global selections in other tabs', () => { @@ -62,22 +62,22 @@ it('uses the custom name of the active repository, independently of global selec ) mount() - expect(document.title).toBe('Customer documents') + expect(document.title).toBe('Admin: Customer documents') }) it('updates after same-tab rename and falls back when the custom name is cleared or the entry removed', () => { rememberRepositoryConnection(first) mount() act(() => renameRepositoryConnection(first, 'Daily repository')) - expect(document.title).toBe('Daily repository') + expect(document.title).toBe('Admin: Daily repository') act(() => renameRepositoryConnection(first, '')) - expect(document.title).toBe('first.example:8443/tenant') + expect(document.title).toBe('Admin: first.example:8443/tenant') act(() => renameRepositoryConnection(first, 'Temporary name')) - expect(document.title).toBe('Temporary name') + expect(document.title).toBe('Admin: Temporary name') act(() => { removeRepositoryConnection(first) }) - expect(document.title).toBe('first.example:8443/tenant') + expect(document.title).toBe('Admin: first.example:8443/tenant') }) it('updates only the active repository name when another tab changes connection metadata', () => { @@ -91,14 +91,14 @@ it('updates only the active repository name when another tab changes connection act(() => { window.dispatchEvent(new StorageEvent('storage', { key: repositoryConnectionsStorageKey })) }) - expect(document.title).toBe('Renamed in another tab') + expect(document.title).toBe('Admin: Renamed in another tab') connections[1].name = 'Unrelated rename' localStorage.setItem(repositoryConnectionsStorageKey, JSON.stringify({ version: 1, connections })) act(() => { window.dispatchEvent(new StorageEvent('storage', { key: repositoryConnectionsStorageKey })) }) - expect(document.title).toBe('Renamed in another tab') + expect(document.title).toBe('Admin: Renamed in another tab') }) it('changes with the active repository context and restores the base title on leaving the repository', () => { @@ -107,9 +107,9 @@ it('changes with the active repository context and restores the base title on le rememberRepositoryConnection(second) renameRepositoryConnection(second, 'Second repository') mount() - expect(document.title).toBe('First repository') + expect(document.title).toBe('Admin: First repository') mount(second) - expect(document.title).toBe('Second repository') + expect(document.title).toBe('Admin: Second repository') act(() => { unmountComponentAtNode(element) }) @@ -120,6 +120,6 @@ it('keeps display names as literal title text', () => { rememberRepositoryConnection(first) renameRepositoryConnection(first, 'Customer & documents') mount() - expect(document.title).toBe('Customer & documents') + expect(document.title).toBe('Admin: Customer & documents') expect(document.head.querySelector('b')).toBeNull() })