Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Canonicalize organization metadata badges
rcourtman131cc2702b82
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex adebb5db92..4dda3c982a 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -493,6 +493,11 @@ not a replacement status card, CTA band, or page-local nested card.copyable command/path/value rows must use `CopyableCodeRow` instead ofrecreating local copy icons, copied-state checks, disabled empty-valuehandling, or `font-mono` code-row shells.+ Read-only metadata chips belong to `MetadataBadge` and domain wrappers over+ it. Organization role and share-status chips must use+ `OrganizationRoleBadge` and `OrganizationShareStatusBadge`, so role/status+ tone mapping, pill shape, fit behavior, and whitespace handling do not drift+ across organization overview, access, and sharing surfaces.Inline detail content belongs to the shared detail-section primitive family.Feature surfaces may own the platform-specific rows, section labels, andsource model, but section row shaping, empty-row compaction, value tonediff --git a/docs/release-control/v6/internal/subsystems/organization-settings.md b/docs/release-control/v6/internal/subsystems/organization-settings.mdindex 72c3568f60..62cb489e03 100644--- a/docs/release-control/v6/internal/subsystems/organization-settings.md+++ b/docs/release-control/v6/internal/subsystems/organization-settings.md@@ -76,6 +76,12 @@ create, review, and approve cross-organization shares.come from `frontend-primitives` through `PulseDataGrid`/`Table`; do not addorganization-local `overflow-x-auto`, negative-margin, or side-bordercompensation around grids.+ Organization role and share-status badges follow the same primitive+ boundary: role/status semantics remain organization-owned, but visible badge+ shell, tone vocabulary, and label rendering must compose+ `OrganizationRoleBadge` / `OrganizationShareStatusBadge` over the shared+ `MetadataBadge` primitive instead of using `roleBadgeClass`,+ `statusBadgeClass`, or local pill span classes in each section.3. Route organization and RBAC frontend transport changes through `frontend-modern/src/api/orgs.ts` and `frontend-modern/src/api/rbac.ts`4. Keep backend organization management and lifecycle handlers aligned through `internal/api/org_handlers.go` and `internal/api/org_lifecycle_handlers.go`Organization resource shares may reference the canonical Docker / Podman@@ -94,7 +100,7 @@ create, review, and approve cross-organization shares.## Forbidden Paths-1. Duplicating organization role normalization or badge styling outside the canonical organization presentation helpers+1. Duplicating organization role normalization or badge styling outside the canonical organization presentation helpers and shared organization badge wrappers2. Reintroducing organization settings copy, validation, or empty-state strings directly inside feature panels instead of the shared organization presentation helpers3. Letting share-role, RBAC role-assignment, or membership semantics drift between `internal/models/organization.go` and the governed organization settings surfaces@@ -102,9 +108,10 @@ create, review, and approve cross-organization shares.1. Update the organization model, settings surfaces, and proof files together when role/share semantics move2. Keep organization settings copy and validation inside the canonical organization presentation helpers-3. Keep the shared organization and RBAC transport proof routes explicit in `registry.json`; default fallback proof routing is not allowed for this subsystem-4. Update this contract whenever a new organization settings, role-management, or organization-domain helper entry point becomes canonical runtime surface area-5. Keep RBAC feature-gate copy on the organization presentation owner. RBAC+3. Keep organization role and share-status badge rendering on `OrganizationRoleBadge` / `OrganizationShareStatusBadge` and the shared metadata-badge registry rules+4. Keep the shared organization and RBAC transport proof routes explicit in `registry.json`; default fallback proof routing is not allowed for this subsystem+5. Update this contract whenever a new organization settings, role-management, or organization-domain helper entry point becomes canonical runtime surface area+6. Keep RBAC feature-gate copy on the organization presentation owner. RBACmay describe capability availability on paid self-hosted and hosted plans,but must not use Pro-badge titles or local browser upgrade telemetry in`RBACFeatureGateSection.tsx` or `useRBACFeatureGateState.ts`.diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.jsonindex 660f60bdf7..405bf83096 100644--- a/docs/release-control/v6/internal/subsystems/registry.json+++ b/docs/release-control/v6/internal/subsystems/registry.json@@ -4019,6 +4019,7 @@"owned_files": ["frontend-modern/src/api/orgs.ts","frontend-modern/src/api/rbac.ts",+ "frontend-modern/src/components/Settings/OrganizationAccessInvitationsSection.tsx","frontend-modern/src/components/Settings/OrganizationAccessLoadingState.tsx","frontend-modern/src/components/Settings/OrganizationAccessManagementSection.tsx","frontend-modern/src/components/Settings/OrganizationAccessMembersSection.tsx",@@ -4118,6 +4119,7 @@"label": "organization settings surface proof","match_prefixes": [],"match_files": [+ "frontend-modern/src/components/Settings/OrganizationAccessInvitationsSection.tsx","frontend-modern/src/components/Settings/OrganizationAccessLoadingState.tsx","frontend-modern/src/components/Settings/OrganizationAccessManagementSection.tsx","frontend-modern/src/components/Settings/OrganizationAccessMembersSection.tsx",diff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.jsonindex 0f519ec09d..e3d17c3401 100644--- a/frontend-modern/scripts/shared-template-registry.json+++ b/frontend-modern/scripts/shared-template-registry.json@@ -551,6 +551,92 @@"scripts/shared-template-audit.mjs"]},+ {+ "id": "metadata-badge-shell",+ "category": "metadata-badge",+ "summary": "Read-only metadata chips must compose MetadataBadge so size, shape, tone vocabulary, fit behavior, and whitespace handling stay shared instead of being copied as page-local pill spans.",+ "canonical": {+ "path": "src/components/shared/MetadataBadge.tsx",+ "export": "MetadataBadge"+ },+ "requiredConsumers": [{ "path": "src/components/shared/OrganizationBadges.tsx" }],+ "proof": [+ "src/components/shared/SharedPrimitives.guardrails.test.ts",+ "src/components/shared/MetadataBadge.test.tsx",+ "scripts/shared-template-audit.mjs"+ ]+ },+ {+ "id": "organization-role-badge-shell",+ "category": "metadata-badge",+ "summary": "Organization role badges must compose OrganizationRoleBadge instead of each organization settings section mapping role tones and pill styling locally.",+ "canonical": {+ "path": "src/components/shared/OrganizationBadges.tsx",+ "export": "OrganizationRoleBadge"+ },+ "requiredConsumers": [+ { "path": "src/components/Settings/OrganizationAccessInvitationsSection.tsx" },+ { "path": "src/components/Settings/OrganizationAccessMembersSection.tsx" },+ { "path": "src/components/Settings/OrganizationIncomingSharesSection.tsx" },+ { "path": "src/components/Settings/OrganizationOutgoingSharesSection.tsx" },+ { "path": "src/components/Settings/OrganizationOverviewMembersSection.tsx" }+ ],+ "forbiddenPatterns": [+ {+ "path": "src/components/Settings/OrganizationAccessInvitationsSection.tsx",+ "patterns": ["roleBadgeClass"]+ },+ {+ "path": "src/components/Settings/OrganizationAccessMembersSection.tsx",+ "patterns": ["roleBadgeClass"]+ },+ {+ "path": "src/components/Settings/OrganizationIncomingSharesSection.tsx",+ "patterns": ["roleBadgeClass"]+ },+ {+ "path": "src/components/Settings/OrganizationOutgoingSharesSection.tsx",+ "patterns": ["roleBadgeClass"]+ },+ {+ "path": "src/components/Settings/OrganizationOverviewMembersSection.tsx",+ "patterns": ["roleBadgeClass"]+ }+ ],+ "proof": [+ "src/components/shared/SharedPrimitives.guardrails.test.ts",+ "src/components/shared/OrganizationBadges.test.tsx",+ "scripts/shared-template-audit.mjs"+ ]+ },+ {+ "id": "organization-share-status-badge-shell",+ "category": "metadata-badge",+ "summary": "Organization share status badges must compose OrganizationShareStatusBadge so pending/active labels and tones stay canonical across incoming and outgoing share tables.",+ "canonical": {+ "path": "src/components/shared/OrganizationBadges.tsx",+ "export": "OrganizationShareStatusBadge"+ },+ "requiredConsumers": [+ { "path": "src/components/Settings/OrganizationIncomingSharesSection.tsx" },+ { "path": "src/components/Settings/OrganizationOutgoingSharesSection.tsx" }+ ],+ "forbiddenPatterns": [+ {+ "path": "src/components/Settings/OrganizationIncomingSharesSection.tsx",+ "patterns": ["statusBadgeClass"]+ },+ {+ "path": "src/components/Settings/OrganizationOutgoingSharesSection.tsx",+ "patterns": ["statusBadgeClass"]+ }+ ],+ "proof": [+ "src/components/shared/SharedPrimitives.guardrails.test.ts",+ "src/components/shared/OrganizationBadges.test.tsx",+ "scripts/shared-template-audit.mjs"+ ]+ },{"id": "platform-table-loading-state","category": "platform-table-loading-state",@@ -1112,6 +1198,46 @@"scripts/shared-template-audit.mjs"]},+ {+ "id": "organization-role-badge-local-shell",+ "category": "metadata-badge",+ "summary": "Organization settings sections must not call roleBadgeClass directly; compose OrganizationRoleBadge so role tone mapping and badge shell stay canonical.",+ "canonical": {+ "path": "src/components/shared/OrganizationBadges.tsx",+ "export": "OrganizationRoleBadge"+ },+ "scopes": ["src/components/Settings"],+ "extensions": [".tsx"],+ "allPatterns": ["roleBadgeClass("],+ "legacyReason": "Retired migration debt. Organization role badges belong to OrganizationRoleBadge and MetadataBadge.",+ "allowedPaths": [],+ "ignoredPaths": ["src/components/shared/SharedPrimitives.guardrails.test.ts"],+ "proof": [+ "src/components/shared/SharedPrimitives.guardrails.test.ts",+ "src/components/shared/OrganizationBadges.test.tsx",+ "scripts/shared-template-audit.mjs"+ ]+ },+ {+ "id": "organization-share-status-badge-local-shell",+ "category": "metadata-badge",+ "summary": "Organization share tables must not recreate local statusBadgeClass helpers; compose OrganizationShareStatusBadge for canonical pending/active labels and tones.",+ "canonical": {+ "path": "src/components/shared/OrganizationBadges.tsx",+ "export": "OrganizationShareStatusBadge"+ },+ "scopes": ["src/components/Settings"],+ "extensions": [".tsx"],+ "allPatterns": ["statusBadgeClass("],+ "legacyReason": "Retired migration debt. Organization share status badges belong to OrganizationShareStatusBadge and MetadataBadge.",+ "allowedPaths": [],+ "ignoredPaths": ["src/components/shared/SharedPrimitives.guardrails.test.ts"],+ "proof": [+ "src/components/shared/SharedPrimitives.guardrails.test.ts",+ "src/components/shared/OrganizationBadges.test.tsx",+ "scripts/shared-template-audit.mjs"+ ]+ },{"id": "form-select-local-native-select","category": "form-control",diff --git a/frontend-modern/src/components/Settings/OrganizationAccessInvitationsSection.tsx b/frontend-modern/src/components/Settings/OrganizationAccessInvitationsSection.tsxindex 83a4b38265..7fc7fb99c3 100644--- a/frontend-modern/src/components/Settings/OrganizationAccessInvitationsSection.tsx+++ b/frontend-modern/src/components/Settings/OrganizationAccessInvitationsSection.tsx@@ -1,5 +1,6 @@import { Component, For, Show } from 'solid-js';-import { formatOrgDate, roleBadgeClass } from '@/utils/orgUtils';+import { OrganizationRoleBadge } from '@/components/shared/OrganizationBadges';+import { formatOrgDate } from '@/utils/orgUtils';import type { useOrganizationAccessPanelState } from './useOrganizationAccessPanelState';interface OrganizationAccessInvitationsSectionProps {@@ -30,11 +31,7 @@ export const OrganizationAccessInvitationsSection: Component<{formatOrgDate(invitation.invitedAt)}</div></div>- <span- class={`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${roleBadgeClass(invitation.role)}`}- >- {invitation.role}- </span>+ <OrganizationRoleBadge role={invitation.role} /></div><div class="mt-3 flex gap-2"><button@@ -79,11 +76,7 @@ export const OrganizationAccessInvitationsSection: Component<</div></div><div class="flex items-center gap-2">- <span- class={`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${roleBadgeClass(invitation.role)}`}- >- {invitation.role}- </span>+ <OrganizationRoleBadge role={invitation.role} /><buttontype="button"onClick={() => void props.state.revokeInvitation(invitation.userId)}diff --git a/frontend-modern/src/components/Settings/OrganizationAccessMembersSection.tsx b/frontend-modern/src/components/Settings/OrganizationAccessMembersSection.tsxindex b5d5db4626..1d5f68b62f 100644--- a/frontend-modern/src/components/Settings/OrganizationAccessMembersSection.tsx+++ b/frontend-modern/src/components/Settings/OrganizationAccessMembersSection.tsx@@ -1,8 +1,9 @@import { Component, For, Show } from 'solid-js';import { FormSelect } from '@/components/shared/FormSelect';+import { OrganizationRoleBadge } from '@/components/shared/OrganizationBadges';import { PulseDataGrid } from '@/components/shared/PulseDataGrid';import { ORGANIZATION_MEMBER_ROLE_OPTIONS } from '@/utils/organizationRolePresentation';-import { formatOrgDate, normalizeRole, roleBadgeClass } from '@/utils/orgUtils';+import { formatOrgDate, normalizeRole } from '@/utils/orgUtils';import { getOrganizationAccessEmptyState } from '@/utils/organizationSettingsPresentation';import Trash2 from 'lucide-solid/icons/trash-2';import type { OrganizationMember, OrganizationRole } from '@/api/orgs';@@ -36,13 +37,7 @@ export const OrganizationAccessMembersSection: Component<OrganizationAccessMembereturn (<Showwhen={props.state.canManageCurrentOrg()}- fallback={- <span- class={`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${roleBadgeClass(role)}`}- >- {role}- </span>- }+ fallback={<OrganizationRoleBadge role={role} />}><FormSelectlabel={`Role for ${member.userId}`}diff --git a/frontend-modern/src/components/Settings/OrganizationIncomingSharesSection.tsx b/frontend-modern/src/components/Settings/OrganizationIncomingSharesSection.tsxindex 03f62b76c7..6202fbeaba 100644--- a/frontend-modern/src/components/Settings/OrganizationIncomingSharesSection.tsx+++ b/frontend-modern/src/components/Settings/OrganizationIncomingSharesSection.tsx@@ -1,11 +1,14 @@import { Component, Show } from 'solid-js';+import {+ OrganizationRoleBadge,+ OrganizationShareStatusBadge,+} from '@/components/shared/OrganizationBadges';import { PulseDataGrid } from '@/components/shared/PulseDataGrid';import { normalizeOrganizationShareRole } from '@/utils/organizationRolePresentation';-import { formatOrgDate, roleBadgeClass } from '@/utils/orgUtils';+import { formatOrgDate } from '@/utils/orgUtils';import {getOrganizationIncomingSharesEmptyState,getOrganizationShareStatusDescription,- getOrganizationShareStatusLabel,} from '@/utils/organizationSettingsPresentation';import type { useOrganizationSharingPanelState } from './useOrganizationSharingPanelState';@@ -16,11 +19,6 @@ interface OrganizationIncomingSharesSectionProps {export const OrganizationIncomingSharesSection: Component<OrganizationIncomingSharesSectionProps> = (props) => {- const statusBadgeClass = (status: 'pending' | 'accepted') =>- status === 'pending'- ? 'bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200'- : 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-200';-return (<div class="space-y-2 p-4 sm:p-6"><h4 class="text-sm font-semibold text-base-content">Incoming Shares</h4>@@ -52,13 +50,7 @@ export const OrganizationIncomingSharesSection: Component<label: 'Access',render: (share) => {const role = normalizeOrganizationShareRole(share.accessRole);- return (- <span- class={`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${roleBadgeClass(role)}`}- >- {role}- </span>- );+ return <OrganizationRoleBadge role={role} />;},},{@@ -66,11 +58,7 @@ export const OrganizationIncomingSharesSection: Component<label: 'Status',render: (share) => (<div class="flex flex-col gap-1">- <span- class={`inline-flex w-fit rounded-full px-2 py-0.5 text-xs font-medium ${statusBadgeClass(share.status)}`}- >- {getOrganizationShareStatusLabel(share.status)}- </span>+ <OrganizationShareStatusBadge status={share.status} /><span class="text-xs text-muted">{getOrganizationShareStatusDescription(share.status,diff --git a/frontend-modern/src/components/Settings/OrganizationOutgoingSharesSection.tsx b/frontend-modern/src/components/Settings/OrganizationOutgoingSharesSection.tsxindex 106acd2bd5..e7b3fd0b87 100644--- a/frontend-modern/src/components/Settings/OrganizationOutgoingSharesSection.tsx+++ b/frontend-modern/src/components/Settings/OrganizationOutgoingSharesSection.tsx@@ -1,11 +1,14 @@import { Component, Show } from 'solid-js';+import {+ OrganizationRoleBadge,+ OrganizationShareStatusBadge,+} from '@/components/shared/OrganizationBadges';import { PulseDataGrid } from '@/components/shared/PulseDataGrid';import { normalizeOrganizationShareRole } from '@/utils/organizationRolePresentation';-import { formatOrgDate, roleBadgeClass } from '@/utils/orgUtils';+import { formatOrgDate } from '@/utils/orgUtils';import {getOrganizationOutgoingSharesEmptyState,getOrganizationShareStatusDescription,- getOrganizationShareStatusLabel,} from '@/utils/organizationSettingsPresentation';import Trash2 from 'lucide-solid/icons/trash-2';import type { useOrganizationSharingPanelState } from './useOrganizationSharingPanelState';@@ -17,11 +20,6 @@ interface OrganizationOutgoingSharesSectionProps {export const OrganizationOutgoingSharesSection: Component<OrganizationOutgoingSharesSectionProps> = (props) => {- const statusBadgeClass = (status: 'pending' | 'accepted') =>- status === 'pending'- ? 'bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200'- : 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-200';-return (<div class="space-y-2 p-4 sm:p-6"><h4 class="text-sm font-semibold text-base-content">Outgoing Shares</h4>@@ -55,13 +53,7 @@ export const OrganizationOutgoingSharesSection: Component<label: 'Access',render: (share) => {const role = normalizeOrganizationShareRole(share.accessRole);- return (- <span- class={`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${roleBadgeClass(role)}`}- >- {role}- </span>- );+ return <OrganizationRoleBadge role={role} />;},},{@@ -69,11 +61,7 @@ export const OrganizationOutgoingSharesSection: Component<label: 'Status',render: (share) => (<div class="flex flex-col gap-1">- <span- class={`inline-flex w-fit rounded-full px-2 py-0.5 text-xs font-medium ${statusBadgeClass(share.status)}`}- >- {getOrganizationShareStatusLabel(share.status)}- </span>+ <OrganizationShareStatusBadge status={share.status} /><span class="text-xs text-muted">{getOrganizationShareStatusDescription(share.status,diff --git a/frontend-modern/src/components/Settings/OrganizationOverviewMembersSection.tsx b/frontend-modern/src/components/Settings/OrganizationOverviewMembersSection.tsxindex 10f8fa2302..8533e92e02 100644--- a/frontend-modern/src/components/Settings/OrganizationOverviewMembersSection.tsx+++ b/frontend-modern/src/components/Settings/OrganizationOverviewMembersSection.tsx@@ -1,7 +1,8 @@import { Component } from 'solid-js';+import { OrganizationRoleBadge } from '@/components/shared/OrganizationBadges';import { PulseDataGrid } from '@/components/shared/PulseDataGrid';import { getOrganizationOverviewMembersEmptyState } from '@/utils/organizationSettingsPresentation';-import { formatOrgDate, normalizeRole, roleBadgeClass } from '@/utils/orgUtils';+import { formatOrgDate, normalizeRole } from '@/utils/orgUtils';import type { useOrganizationOverviewPanelState } from './useOrganizationOverviewPanelState';interface OrganizationOverviewMembersSectionProps {@@ -27,13 +28,7 @@ export const OrganizationOverviewMembersSection: Component<label: 'Role',render: (member) => {const role = normalizeRole(member.role);- return (- <span- class={`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${roleBadgeClass(role)}`}- >- {role}- </span>- );+ return <OrganizationRoleBadge role={role} />;},},{diff --git a/frontend-modern/src/components/shared/MetadataBadge.test.tsx b/frontend-modern/src/components/shared/MetadataBadge.test.tsxnew file mode 100644index 0000000000..55b3e5f5ac--- /dev/null+++ b/frontend-modern/src/components/shared/MetadataBadge.test.tsx@@ -0,0 +1,35 @@+import { cleanup, render, screen } from '@solidjs/testing-library';+import { afterEach, describe, expect, it } from 'vitest';+import { MetadataBadge, getMetadataBadgeClass } from '@/components/shared/MetadataBadge';++afterEach(cleanup);++describe('MetadataBadge', () => {+ it('renders the canonical read-only badge shell with typed tone, size, and shape', () => {+ render(() => (+ <MetadataBadge tone="warning" size="xs" shape="rounded" uppercase title="Pending review">+ pending+ </MetadataBadge>+ ));++ const badge = screen.getByText('pending');+ expect(badge).toHaveClass('inline-flex');+ expect(badge).toHaveClass('rounded');+ expect(badge).toHaveClass('text-[10px]');+ expect(badge).toHaveClass('uppercase');+ expect(badge).toHaveClass('bg-amber-100');+ expect(badge).toHaveAttribute('title', 'Pending review');+ });++ it('keeps class composition in the shared primitive model', () => {+ expect(getMetadataBadgeClass({ tone: 'success', fit: true, class: 'shrink-0' })).toContain(+ 'w-fit',+ );+ expect(getMetadataBadgeClass({ tone: 'success', fit: true, class: 'shrink-0' })).toContain(+ 'bg-emerald-100',+ );+ expect(getMetadataBadgeClass({ tone: 'success', fit: true, class: 'shrink-0' })).toContain(+ 'shrink-0',+ );+ });+});diff --git a/frontend-modern/src/components/shared/MetadataBadge.tsx b/frontend-modern/src/components/shared/MetadataBadge.tsxnew file mode 100644index 0000000000..bdb9bd6f16--- /dev/null+++ b/frontend-modern/src/components/shared/MetadataBadge.tsx@@ -0,0 +1,92 @@+import { splitProps, type Component, type JSX } from 'solid-js';++export type MetadataBadgeTone = 'neutral' | 'muted' | 'info' | 'success' | 'warning' | 'danger';+export type MetadataBadgeSize = 'xs' | 'sm' | 'md';+export type MetadataBadgeShape = 'pill' | 'rounded';++export interface MetadataBadgeProps extends Omit<JSX.HTMLAttributes<HTMLSpanElement>, 'class'> {+ tone?: MetadataBadgeTone;+ size?: MetadataBadgeSize;+ shape?: MetadataBadgeShape;+ fit?: boolean;+ uppercase?: boolean;+ class?: string;+ children?: JSX.Element;+}++const METADATA_BADGE_BASE_CLASS = 'inline-flex items-center gap-1 font-medium whitespace-nowrap';++const METADATA_BADGE_SIZE_CLASSES: Record<MetadataBadgeSize, string> = {+ xs: 'px-1.5 py-0.5 text-[10px]',+ sm: 'px-2 py-0.5 text-xs',+ md: 'px-2.5 py-1 text-xs',+};++const METADATA_BADGE_SHAPE_CLASSES: Record<MetadataBadgeShape, string> = {+ pill: 'rounded-full',+ rounded: 'rounded',+};++const METADATA_BADGE_TONE_CLASSES: Record<MetadataBadgeTone, string> = {+ neutral: 'bg-surface-alt text-base-content',+ muted: 'bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200',+ info: 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200',+ success: 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-200',+ warning: 'bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200',+ danger: 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200',+};++export function getMetadataBadgeClass(props: {+ tone?: MetadataBadgeTone;+ size?: MetadataBadgeSize;+ shape?: MetadataBadgeShape;+ fit?: boolean;+ uppercase?: boolean;+ class?: string;+}): string {+ const tone = props.tone ?? 'neutral';+ const size = props.size ?? 'sm';+ const shape = props.shape ?? 'pill';++ return [+ METADATA_BADGE_BASE_CLASS,+ METADATA_BADGE_SIZE_CLASSES[size],+ METADATA_BADGE_SHAPE_CLASSES[shape],+ METADATA_BADGE_TONE_CLASSES[tone],+ props.fit ? 'w-fit' : '',+ props.uppercase ? 'uppercase tracking-wide' : '',+ props.class ?? '',+ ]+ .filter(Boolean)+ .join(' ');+}++export const MetadataBadge: Component<MetadataBadgeProps> = (props) => {+ const [local, others] = splitProps(props, [+ 'tone',+ 'size',+ 'shape',+ 'fit',+ 'uppercase',+ 'class',+ 'children',+ ]);++ return (+ <span+ {...others}+ class={getMetadataBadgeClass({+ tone: local.tone,+ size: local.size,+ shape: local.shape,+ fit: local.fit,+ uppercase: local.uppercase,+ class: local.class,+ })}+ >+ {local.children}+ </span>+ );+};++export default MetadataBadge;diff --git a/frontend-modern/src/components/shared/OrganizationBadges.test.tsx b/frontend-modern/src/components/shared/OrganizationBadges.test.tsxnew file mode 100644index 0000000000..8e954d8c8b--- /dev/null+++ b/frontend-modern/src/components/shared/OrganizationBadges.test.tsx@@ -0,0 +1,38 @@+import { cleanup, render, screen } from '@solidjs/testing-library';+import { afterEach, describe, expect, it } from 'vitest';+import {+ getOrganizationRoleBadgeTone,+ getOrganizationShareStatusBadgeTone,+ OrganizationRoleBadge,+ OrganizationShareStatusBadge,+} from '@/components/shared/OrganizationBadges';++afterEach(cleanup);++describe('OrganizationBadges', () => {+ it('maps organization roles onto shared metadata badge tones', () => {+ expect(getOrganizationRoleBadgeTone('owner')).toBe('warning');+ expect(getOrganizationRoleBadgeTone('admin')).toBe('info');+ expect(getOrganizationRoleBadgeTone('editor')).toBe('success');+ expect(getOrganizationRoleBadgeTone('viewer')).toBe('muted');+ expect(getOrganizationRoleBadgeTone('unexpected')).toBe('muted');++ render(() => <OrganizationRoleBadge role="admin" />);++ const badge = screen.getByText('admin');+ expect(badge).toHaveClass('rounded-full');+ expect(badge).toHaveClass('bg-blue-100');+ });++ it('maps organization share status labels onto shared metadata badge tones', () => {+ expect(getOrganizationShareStatusBadgeTone('pending')).toBe('warning');+ expect(getOrganizationShareStatusBadgeTone('accepted')).toBe('success');++ render(() => <OrganizationShareStatusBadge status="accepted" />);++ const badge = screen.getByText('Active');+ expect(badge).toHaveClass('rounded-full');+ expect(badge).toHaveClass('w-fit');+ expect(badge).toHaveClass('bg-emerald-100');+ });+});diff --git a/frontend-modern/src/components/shared/OrganizationBadges.tsx b/frontend-modern/src/components/shared/OrganizationBadges.tsxnew file mode 100644index 0000000000..fc1beb0595--- /dev/null+++ b/frontend-modern/src/components/shared/OrganizationBadges.tsx@@ -0,0 +1,62 @@+import { splitProps, type Component } from 'solid-js';+import type { OrganizationRole, OrganizationShareStatus } from '@/api/orgs';+import {+ MetadataBadge,+ type MetadataBadgeProps,+ type MetadataBadgeTone,+} from '@/components/shared/MetadataBadge';+import { getOrganizationShareStatusLabel } from '@/utils/organizationSettingsPresentation';++type OrganizationBadgeProps = Omit<+ MetadataBadgeProps,+ 'children' | 'tone' | 'shape' | 'uppercase' | 'role'+>;++export function getOrganizationRoleBadgeTone(role: string): MetadataBadgeTone {+ switch (role) {+ case 'owner':+ return 'warning';+ case 'admin':+ return 'info';+ case 'editor':+ return 'success';+ case 'viewer':+ default:+ return 'muted';+ }+}++export function getOrganizationShareStatusBadgeTone(+ status: OrganizationShareStatus,+): MetadataBadgeTone {+ return status === 'pending' ? 'warning' : 'success';+}++export const OrganizationRoleBadge: Component<+ OrganizationBadgeProps & { role: OrganizationRole | string }+> = (props) => {+ const [local, badgeProps] = splitProps(props, ['role']);++ return (+ <MetadataBadge {...badgeProps} tone={getOrganizationRoleBadgeTone(local.role)} shape="pill">+ {local.role}+ </MetadataBadge>+ );+};++export const OrganizationShareStatusBadge: Component<+ OrganizationBadgeProps & { status: OrganizationShareStatus }+> = (props) => {+ const [local, badgeProps] = splitProps(props, ['status']);++ return (+ <MetadataBadge+ {...badgeProps}+ tone={getOrganizationShareStatusBadgeTone(local.status)}+ shape="pill"+ fit+ >+ {getOrganizationShareStatusLabel(local.status)}+ </MetadataBadge>+ );+};diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex 406a1622ef..86e2cdeb45 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -49,6 +49,8 @@ import statusDotSource from '@/components/shared/StatusDot.tsx?raw';import statusBadgeSource from '@/components/shared/StatusBadge.tsx?raw';import statusBadgeModelSource from '@/components/shared/statusBadgeModel.ts?raw';import statusIndicatorBadgeSource from '@/components/shared/StatusIndicatorBadge.tsx?raw';+import metadataBadgeSource from '@/components/shared/MetadataBadge.tsx?raw';+import organizationBadgesSource from '@/components/shared/OrganizationBadges.tsx?raw';import discoveryReadinessBadgeSource from '@/components/shared/DiscoveryReadinessBadge.tsx?raw';import subtabsSource from '@/components/shared/Subtabs.tsx?raw';import toggleSource from '@/components/shared/Toggle.tsx?raw';@@ -189,6 +191,7 @@ import dataHandlingPanelSource from '@/components/Settings/DataHandlingPanel.tsximport generalSettingsPanelSource from '@/components/Settings/GeneralSettingsPanel.tsx?raw';import infrastructureInstallerSectionSource from '@/components/Settings/InfrastructureInstallerSection.tsx?raw';import infrastructureWorkspaceSource from '@/components/Settings/InfrastructureWorkspace.tsx?raw';+import organizationAccessInvitationsSectionSource from '@/components/Settings/OrganizationAccessInvitationsSection.tsx?raw';import organizationAccessMembersSectionSource from '@/components/Settings/OrganizationAccessMembersSection.tsx?raw';import organizationIncomingSharesSectionSource from '@/components/Settings/OrganizationIncomingSharesSection.tsx?raw';import organizationOutgoingSharesSectionSource from '@/components/Settings/OrganizationOutgoingSharesSection.tsx?raw';@@ -1551,6 +1554,89 @@ describe('shared primitive guardrails', () => {expect(diagnosticsResultsPanelSource).not.toContain('getStatusIndicatorBadgeToneClasses');});+ it('keeps organization metadata badges on shared badge wrappers', () => {+ const registry = JSON.parse(sharedTemplateRegistrySource) as {+ rules?: Array<{+ id: string;+ canonical?: { path?: string; export?: string };+ requiredConsumers?: Array<{ path?: string }>;+ }>;+ patternGuards?: Array<{+ id: string;+ canonical?: { path?: string; export?: string };+ allPatterns?: string[];+ scopes?: string[];+ allowedPaths?: string[];+ ignoredPaths?: string[];+ }>;+ };+ const metadataRule = registry.rules?.find((rule) => rule.id === 'metadata-badge-shell');+ const roleRule = registry.rules?.find((rule) => rule.id === 'organization-role-badge-shell');+ const shareStatusRule = registry.rules?.find(+ (rule) => rule.id === 'organization-share-status-badge-shell',+ );+ const localRoleGuard = registry.patternGuards?.find(+ (guard) => guard.id === 'organization-role-badge-local-shell',+ );+ const localShareStatusGuard = registry.patternGuards?.find(+ (guard) => guard.id === 'organization-share-status-badge-local-shell',+ );++ expect(metadataRule?.canonical?.path).toBe('src/components/shared/MetadataBadge.tsx');+ expect(metadataRule?.canonical?.export).toBe('MetadataBadge');+ expect(metadataRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual([+ 'src/components/shared/OrganizationBadges.tsx',+ ]);+ expect(roleRule?.canonical?.path).toBe('src/components/shared/OrganizationBadges.tsx');+ expect(roleRule?.canonical?.export).toBe('OrganizationRoleBadge');+ expect(roleRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual([+ 'src/components/Settings/OrganizationAccessInvitationsSection.tsx',+ 'src/components/Settings/OrganizationAccessMembersSection.tsx',+ 'src/components/Settings/OrganizationIncomingSharesSection.tsx',+ 'src/components/Settings/OrganizationOutgoingSharesSection.tsx',+ 'src/components/Settings/OrganizationOverviewMembersSection.tsx',+ ]);+ expect(shareStatusRule?.canonical?.path).toBe('src/components/shared/OrganizationBadges.tsx');+ expect(shareStatusRule?.canonical?.export).toBe('OrganizationShareStatusBadge');+ expect(shareStatusRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual([+ 'src/components/Settings/OrganizationIncomingSharesSection.tsx',+ 'src/components/Settings/OrganizationOutgoingSharesSection.tsx',+ ]);+ expect(localRoleGuard?.allPatterns).toEqual(['roleBadgeClass(']);+ expect(localRoleGuard?.scopes).toEqual(['src/components/Settings']);+ expect(localShareStatusGuard?.allPatterns).toEqual(['statusBadgeClass(']);+ expect(localShareStatusGuard?.scopes).toEqual(['src/components/Settings']);++ expect(metadataBadgeSource).toContain('METADATA_BADGE_TONE_CLASSES');+ expect(metadataBadgeSource).toContain('getMetadataBadgeClass');+ expect(organizationBadgesSource).toContain('MetadataBadge');+ expect(organizationBadgesSource).toContain('getOrganizationRoleBadgeTone');+ expect(organizationBadgesSource).toContain('getOrganizationShareStatusBadgeTone');++ for (const source of [+ organizationAccessInvitationsSectionSource,+ organizationAccessMembersSectionSource,+ organizationIncomingSharesSectionSource,+ organizationOutgoingSharesSectionSource,+ organizationOverviewMembersSectionSource,+ ]) {+ expect(source).toContain('OrganizationRoleBadge');+ expect(source).not.toContain('roleBadgeClass');+ expect(source).not.toContain('inline-flex rounded-full px-2 py-0.5 text-xs font-medium');+ }++ for (const source of [+ organizationIncomingSharesSectionSource,+ organizationOutgoingSharesSectionSource,+ ]) {+ expect(source).toContain('OrganizationShareStatusBadge');+ expect(source).not.toContain('statusBadgeClass');+ expect(source).not.toContain(+ 'inline-flex w-fit rounded-full px-2 py-0.5 text-xs font-medium',+ );+ }+ });+it('keeps resource status dots on the shared StatusDot primitive', () => {const registry = JSON.parse(sharedTemplateRegistrySource) as {rules?: Array<{diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.pyindex 23529ae327..a8103c1a77 100644--- a/scripts/release_control/subsystem_lookup_test.py+++ b/scripts/release_control/subsystem_lookup_test.py@@ -2823,7 +2823,7 @@ class SubsystemLookupTest(unittest.TestCase):{"heading": "## Extension Points","path": "frontend-modern/src/api/orgs.ts",- "line": 79,+ "line": 85,"heading_line": 70,},],@@ -2899,7 +2899,7 @@ class SubsystemLookupTest(unittest.TestCase):{"heading": "## Extension Points","path": "internal/api/access_control_handlers.go",- "line": 93,+ "line": 99,"heading_line": 70,},],