diff --git a/client/src/components/Admin/storage/AdminStoragePanel.test.tsx b/client/src/components/Admin/storage/AdminStoragePanel.test.tsx index 81b65095f..ef6c17d54 100644 --- a/client/src/components/Admin/storage/AdminStoragePanel.test.tsx +++ b/client/src/components/Admin/storage/AdminStoragePanel.test.tsx @@ -74,7 +74,7 @@ describe('AdminStoragePanel', () => { const uploads = backendRow('uploads-local'); expect(within(uploads).getByText('Local')).toBeInTheDocument(); expect(within(uploads).getByText('Built-in')).toBeInTheDocument(); - expect(within(uploads).getByText(/Used by: files/)).toBeInTheDocument(); + expect(within(uploads).getByText(/Used by: Trip documents/)).toBeInTheDocument(); const env = backendRow('place-photos-local'); expect(within(env).getByText('Environment')).toBeInTheDocument(); expect(within(env).getByText(/read-only/)).toBeInTheDocument(); @@ -155,7 +155,7 @@ describe('AdminStoragePanel', () => { }), ); fireEvent.click(within(backendRow('off-box')).getByRole('button', { name: 'Remove' })); - expect(screen.getByText(/Still assigned to: covers/)).toBeInTheDocument(); + expect(screen.getByText(/Still assigned to: Cover images/)).toBeInTheDocument(); fireEvent.click(screen.getByRole('button', { name: 'Remove backend' })); fireEvent.click(screen.getByRole('button', { name: 'Save changes' })); await screen.findByText('Storage configuration saved'); @@ -219,7 +219,7 @@ describe('AdminStoragePanel', () => { expect(screen.queryByTestId('storage-backend-mirror')).not.toBeInTheDocument(); const primary = backendRow('backups-local'); expect(within(primary).getByText('Mirrored to: off-box')).toBeInTheDocument(); - expect(within(primary).getByText(/Used by: .*backups/)).toBeInTheDocument(); + expect(within(primary).getByText(/Used by: .*Backups/)).toBeInTheDocument(); const replica = backendRow('off-box'); expect(within(replica).getByText('Replica of: backups-local')).toBeInTheDocument(); }); @@ -323,4 +323,14 @@ describe('AdminStoragePanel', () => { expect(within(row).getByRole('button', { name: 'Remove' })).toBeInTheDocument(); expect(within(row).queryByRole('button', { name: 'Edit' })).not.toBeInTheDocument(); }); + + it('FE-ADMIN-STOR-017: category rows show the display name, the raw id badge, and the description; photos is gone', async () => { + await renderPanel(); + const files = categoryRow('files'); + expect(within(files).getByText('Trip documents')).toBeInTheDocument(); + expect(within(files).getByText('files')).toBeInTheDocument(); // the monospace id badge + expect(within(files).getByText(/tickets, PDFs, booking confirmations/)).toBeInTheDocument(); + expect(within(categoryRow('photos-google')).getByText(/re-fetchable, safe to lose/)).toBeInTheDocument(); + expect(screen.queryByTestId('storage-category-photos')).not.toBeInTheDocument(); + }); }); diff --git a/client/src/components/Admin/storage/AdminStoragePanel.tsx b/client/src/components/Admin/storage/AdminStoragePanel.tsx index efd23b7ce..28e7a2f05 100644 --- a/client/src/components/Admin/storage/AdminStoragePanel.tsx +++ b/client/src/components/Admin/storage/AdminStoragePanel.tsx @@ -24,6 +24,10 @@ import { } from './storageModel' import { useStorageAdmin } from './useStorageAdmin' +/** Display-name mapper for joined category lists — the raw id renders only in the badge. */ +const categoryNames = (t: (key: string) => string, ids: readonly string[]): string => + ids.map((id) => t(`storage.category.${id}`)).join(', ') + function TestResult({ result, failedLabel, okLabel }: { result: StorageTestResponse | undefined failedLabel: string @@ -106,7 +110,7 @@ export default function AdminStoragePanel(): React.ReactElement { const usedAsReplicaBy = isDegenerate ? [] : replicaOfPrimaries(draft, name) return [ t('storage.remove.body', { name }), - assigned.length > 0 ? t('storage.remove.stillAssigned', { categories: assigned.join(', ') }) : '', + assigned.length > 0 ? t('storage.remove.stillAssigned', { categories: categoryNames(t, assigned) }) : '', usedAsReplicaBy.length > 0 ? t('storage.remove.usedAsReplicaBy', { primaries: usedAsReplicaBy.join(', ') }) : '', ] .filter(Boolean) @@ -194,7 +198,7 @@ export default function AdminStoragePanel(): React.ReactElement {
{row.categories.length > 0 - ? t('storage.backends.usedBy', { categories: row.categories.join(', ') }) + ? t('storage.backends.usedBy', { categories: categoryNames(t, row.categories) }) : t('storage.backends.unused')}
{row.mirrorTargets.length > 0 && ( @@ -293,9 +297,13 @@ export default function AdminStoragePanel(): React.ReactElement { const viaMirror = effective[category] !== selectedPrimary return ({row.categories.length > 0 - ? t('storage.backends.usedBy', { categories: row.categories.join(', ') }) + ? t('storage.backends.usedBy', { categories: categoryNames(t, row.categories) }) : t('storage.backends.unused')}
{row.mirrorTargets.length > 0 && ( @@ -514,7 +518,18 @@ export default function MAdminStoragePanel(): React.ReactElement { const changed = selectedPrimary !== primaryNameOf(state, draft, stateEntry.backend) const viaMirror = effective[category] !== selectedPrimary return ( -