The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(client): hide the new identity action on a managed install
Maurice44add5710932
diff --git a/client/src/components/Admin/ServiceIdentityPanel.test.tsx b/client/src/components/Admin/ServiceIdentityPanel.test.tsxindex 3079a123e..2e29816a9 100644--- a/client/src/components/Admin/ServiceIdentityPanel.test.tsx+++ b/client/src/components/Admin/ServiceIdentityPanel.test.tsx@@ -1,4 +1,4 @@-// FE-ADMIN-SVCID-001 to FE-ADMIN-SVCID-007+// FE-ADMIN-SVCID-001 to FE-ADMIN-SVCID-008import userEvent from '@testing-library/user-event';import type { ServiceIdentityStatus } from '@trek/shared';import { http, HttpResponse } from 'msw';@@ -103,4 +103,11 @@ describe('ServiceIdentityPanel', () => {await waitFor(() => expect(regenerated).toBe(1));expect(await screen.findByText('admin.trekApi.quota.hint.registering')).toBeInTheDocument();});++ it('FE-ADMIN-SVCID-008: a managed install leaves the identity to its operator', async () => {+ serve({ state: 'revoked', tier: 'std', keySource: 'registered', quota: null, lastSeenAt: null });+ render(<ServiceIdentityPanel managed />);+ expect(await screen.findByText('admin.trekApi.quota.hint.revoked')).toBeInTheDocument();+ expect(screen.queryByRole('button', { name: 'admin.trekApi.quota.regenerate' })).toBeNull();+ });});diff --git a/client/src/components/Admin/ServiceIdentityPanel.tsx b/client/src/components/Admin/ServiceIdentityPanel.tsxindex 61dd36eb0..cdc4fd929 100644--- a/client/src/components/Admin/ServiceIdentityPanel.tsx+++ b/client/src/components/Admin/ServiceIdentityPanel.tsx@@ -81,8 +81,9 @@ function stateHint(t: TranslationFn, status: ServiceIdentityStatus | null, faile* How this installation stands with the TREK services: whether it has its key,* today's allowance against what is used, and when the count starts again.* Read when the card is in view and refreshed every 30 seconds while it stays.+ * A managed install leaves the identity to its operator, so it offers no new one.*/-export default function ServiceIdentityPanel() {+export default function ServiceIdentityPanel({ managed = false }: { managed?: boolean }) {const { t } = useTranslation();const toast = useToast();const panel = useRef<HTMLElement>(null);@@ -100,7 +101,7 @@ export default function ServiceIdentityPanel() {};const hint = stateHint(t, status, failed);- const canRegenerate = status !== null && status.keySource !== 'env' && status.state !== 'off';+ const canRegenerate = !managed && status !== null && status.keySource !== 'env' && status.state !== 'off';return (<sectiondiff --git a/client/src/pages/admin/AdminSettingsTab.tsx b/client/src/pages/admin/AdminSettingsTab.tsxindex 9f08eeefb..c30f57fc4 100644--- a/client/src/pages/admin/AdminSettingsTab.tsx+++ b/client/src/pages/admin/AdminSettingsTab.tsx@@ -387,7 +387,7 @@ export default function AdminSettingsTab({ admin, t }: AdminSettingsTabProps): R{/* Three comparable blocks, in the order we would have people choosethem. Weather moved out entirely: it needs no key and had nothingto configure, so it had no business in a card about keys. */}- <TrekApiCard t={t} />+ <TrekApiCard t={t} managed={managed} />{!managed && (<><ProviderBlock title={t('admin.mapsKey')}>diff --git a/client/src/pages/admin/TrekApiCard.tsx b/client/src/pages/admin/TrekApiCard.tsxindex 52eecc23b..e55570948 100644--- a/client/src/pages/admin/TrekApiCard.tsx+++ b/client/src/pages/admin/TrekApiCard.tsx@@ -10,6 +10,7 @@ import { TREK_API_SOURCES as SOURCES, trekApiFacts, trekApiFields } from '../../interface TrekApiCardProps {t: TranslationFn+ managed?: boolean}/**@@ -41,7 +42,7 @@ function FactGroup({ icon, title, note, children }: { icon: React.ReactNode; tit)}-export default function TrekApiCard({ t }: TrekApiCardProps): React.ReactElement {+export default function TrekApiCard({ t, managed = false }: TrekApiCardProps): React.ReactElement {const fields = trekApiFields(t)const facts = trekApiFacts(t)@@ -73,7 +74,7 @@ export default function TrekApiCard({ t }: TrekApiCardProps): React.ReactElement))}</ul>- <ServiceIdentityPanel />+ <ServiceIdentityPanel managed={managed} /></div><details className="group border-t border-edge-faint">