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
Split organization sharing runtime owners
rcourtman7252902cddc2
diff --git a/docs/release-control/v6/internal/subsystems/organization-settings.md b/docs/release-control/v6/internal/subsystems/organization-settings.mdindex 01484046ee..40992effff 100644--- a/docs/release-control/v6/internal/subsystems/organization-settings.md+++ b/docs/release-control/v6/internal/subsystems/organization-settings.md@@ -27,17 +27,22 @@ create cross-organization shares.2. `frontend-modern/src/components/Settings/OrganizationAccessPanel.tsx`3. `frontend-modern/src/components/Settings/OrganizationOverviewPanel.tsx`4. `frontend-modern/src/components/Settings/OrganizationSharingPanel.tsx`-5. `frontend-modern/src/components/Settings/RolesPanel.tsx`-6. `frontend-modern/src/components/Settings/RBACFeatureGateSection.tsx`-7. `frontend-modern/src/components/Settings/RolesEditorDialog.tsx`-8. `frontend-modern/src/components/Settings/useRBACFeatureGateState.ts`-9. `frontend-modern/src/components/Settings/useRolesPanelState.ts`-10. `frontend-modern/src/components/Settings/UserAssignmentsPanel.tsx`-11. `frontend-modern/src/components/Settings/UserAssignmentsDialog.tsx`-12. `frontend-modern/src/components/Settings/useUserAssignmentsPanelState.ts`-13. `frontend-modern/src/utils/orgUtils.ts`-14. `frontend-modern/src/utils/organizationRolePresentation.ts`-15. `frontend-modern/src/utils/organizationSettingsPresentation.ts`+5. `frontend-modern/src/components/Settings/OrganizationSharingCreateSection.tsx`+6. `frontend-modern/src/components/Settings/OrganizationSharingLoadingState.tsx`+7. `frontend-modern/src/components/Settings/OrganizationOutgoingSharesSection.tsx`+8. `frontend-modern/src/components/Settings/OrganizationIncomingSharesSection.tsx`+9. `frontend-modern/src/components/Settings/useOrganizationSharingPanelState.ts`+10. `frontend-modern/src/components/Settings/RolesPanel.tsx`+11. `frontend-modern/src/components/Settings/RBACFeatureGateSection.tsx`+12. `frontend-modern/src/components/Settings/RolesEditorDialog.tsx`+13. `frontend-modern/src/components/Settings/useRBACFeatureGateState.ts`+14. `frontend-modern/src/components/Settings/useRolesPanelState.ts`+15. `frontend-modern/src/components/Settings/UserAssignmentsPanel.tsx`+16. `frontend-modern/src/components/Settings/UserAssignmentsDialog.tsx`+17. `frontend-modern/src/components/Settings/useUserAssignmentsPanelState.ts`+18. `frontend-modern/src/utils/orgUtils.ts`+19. `frontend-modern/src/utils/organizationRolePresentation.ts`+20. `frontend-modern/src/utils/organizationSettingsPresentation.ts`## Shared Boundaries@@ -46,7 +51,7 @@ create cross-organization shares.## Extension Points1. Add or change organization role and share semantics through `internal/models/organization.go`-2. Add or change organization access, overview, sharing, RBAC feature-gating, role-management, or user-assignment presentation through `frontend-modern/src/components/Settings/OrganizationAccessPanel.tsx`, `frontend-modern/src/components/Settings/OrganizationOverviewPanel.tsx`, `frontend-modern/src/components/Settings/OrganizationSharingPanel.tsx`, `frontend-modern/src/components/Settings/RBACFeatureGateSection.tsx`, `frontend-modern/src/components/Settings/RolesPanel.tsx`, `frontend-modern/src/components/Settings/RolesEditorDialog.tsx`, `frontend-modern/src/components/Settings/useRBACFeatureGateState.ts`, `frontend-modern/src/components/Settings/useRolesPanelState.ts`, `frontend-modern/src/components/Settings/UserAssignmentsPanel.tsx`, `frontend-modern/src/components/Settings/UserAssignmentsDialog.tsx`, and `frontend-modern/src/components/Settings/useUserAssignmentsPanelState.ts`+2. Add or change organization access, overview, sharing, RBAC feature-gating, role-management, or user-assignment presentation through `frontend-modern/src/components/Settings/OrganizationAccessPanel.tsx`, `frontend-modern/src/components/Settings/OrganizationOverviewPanel.tsx`, `frontend-modern/src/components/Settings/OrganizationSharingPanel.tsx`, `frontend-modern/src/components/Settings/OrganizationSharingCreateSection.tsx`, `frontend-modern/src/components/Settings/OrganizationSharingLoadingState.tsx`, `frontend-modern/src/components/Settings/OrganizationOutgoingSharesSection.tsx`, `frontend-modern/src/components/Settings/OrganizationIncomingSharesSection.tsx`, `frontend-modern/src/components/Settings/useOrganizationSharingPanelState.ts`, `frontend-modern/src/components/Settings/RBACFeatureGateSection.tsx`, `frontend-modern/src/components/Settings/RolesPanel.tsx`, `frontend-modern/src/components/Settings/RolesEditorDialog.tsx`, `frontend-modern/src/components/Settings/useRBACFeatureGateState.ts`, `frontend-modern/src/components/Settings/useRolesPanelState.ts`, `frontend-modern/src/components/Settings/UserAssignmentsPanel.tsx`, `frontend-modern/src/components/Settings/UserAssignmentsDialog.tsx`, and `frontend-modern/src/components/Settings/useUserAssignmentsPanelState.ts`3. Route organization transport changes through `frontend-modern/src/api/orgs.ts` and `frontend-modern/src/api/rbac.ts`4. Keep backend organization and RBAC handler changes aligned through `internal/api/org_handlers.go`, `internal/api/org_lifecycle_handlers.go`, and `internal/api/enterprise_extension_rbac_admin.go`@@ -111,6 +116,10 @@ sharing views stay aligned with the shared multi-tenant org context contract.The organization sharing surface now also sources resource quick-pick labelsfrom the shared preferred resource display helper, so governed resources donot fall back to raw names inside share creation.+That sharing surface now also follows the extracted-owner pattern: the panel is+the shell, `useOrganizationSharingPanelState.ts` owns the API-backed runtime,+and the loading, create, outgoing, and incoming views each live in dedicated+section owners instead of staying collapsed into one file.The RBAC settings area now follows the same extracted-owner pattern as theother modernized settings surfaces: `RBACFeatureGateSection.tsx` owns theshared paywall CTA rendering, `useRBACFeatureGateState.ts` owns the shareddiff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.jsonindex 32210393d7..e63806ca7b 100644--- a/docs/release-control/v6/internal/subsystems/registry.json+++ b/docs/release-control/v6/internal/subsystems/registry.json@@ -2114,11 +2114,16 @@"owned_prefixes": [],"owned_files": ["frontend-modern/src/components/Settings/OrganizationAccessPanel.tsx",+ "frontend-modern/src/components/Settings/OrganizationIncomingSharesSection.tsx",+ "frontend-modern/src/components/Settings/OrganizationOutgoingSharesSection.tsx","frontend-modern/src/components/Settings/OrganizationOverviewPanel.tsx",+ "frontend-modern/src/components/Settings/OrganizationSharingCreateSection.tsx",+ "frontend-modern/src/components/Settings/OrganizationSharingLoadingState.tsx","frontend-modern/src/components/Settings/OrganizationSharingPanel.tsx","frontend-modern/src/components/Settings/RBACFeatureGateSection.tsx","frontend-modern/src/components/Settings/RolesEditorDialog.tsx","frontend-modern/src/components/Settings/RolesPanel.tsx",+ "frontend-modern/src/components/Settings/useOrganizationSharingPanelState.ts","frontend-modern/src/components/Settings/UserAssignmentsDialog.tsx","frontend-modern/src/components/Settings/UserAssignmentsPanel.tsx","frontend-modern/src/components/Settings/useRBACFeatureGateState.ts",@@ -2161,11 +2166,16 @@"match_prefixes": [],"match_files": ["frontend-modern/src/components/Settings/OrganizationAccessPanel.tsx",+ "frontend-modern/src/components/Settings/OrganizationIncomingSharesSection.tsx",+ "frontend-modern/src/components/Settings/OrganizationOutgoingSharesSection.tsx","frontend-modern/src/components/Settings/OrganizationOverviewPanel.tsx",+ "frontend-modern/src/components/Settings/OrganizationSharingCreateSection.tsx",+ "frontend-modern/src/components/Settings/OrganizationSharingLoadingState.tsx","frontend-modern/src/components/Settings/OrganizationSharingPanel.tsx","frontend-modern/src/components/Settings/RBACFeatureGateSection.tsx","frontend-modern/src/components/Settings/RolesEditorDialog.tsx","frontend-modern/src/components/Settings/RolesPanel.tsx",+ "frontend-modern/src/components/Settings/useOrganizationSharingPanelState.ts","frontend-modern/src/components/Settings/UserAssignmentsDialog.tsx","frontend-modern/src/components/Settings/UserAssignmentsPanel.tsx","frontend-modern/src/components/Settings/useRBACFeatureGateState.ts",diff --git a/frontend-modern/src/components/Settings/OrganizationIncomingSharesSection.tsx b/frontend-modern/src/components/Settings/OrganizationIncomingSharesSection.tsxnew file mode 100644index 0000000000..5e69a03be1--- /dev/null+++ b/frontend-modern/src/components/Settings/OrganizationIncomingSharesSection.tsx@@ -0,0 +1,67 @@+import { Component } from 'solid-js';+import { PulseDataGrid } from '@/components/shared/PulseDataGrid';+import { normalizeOrganizationShareRole } from '@/utils/organizationRolePresentation';+import { formatOrgDate, roleBadgeClass } from '@/utils/orgUtils';+import { getOrganizationIncomingSharesEmptyState } from '@/utils/organizationSettingsPresentation';+import type { useOrganizationSharingPanelState } from './useOrganizationSharingPanelState';++interface OrganizationIncomingSharesSectionProps {+ state: ReturnType<typeof useOrganizationSharingPanelState>;+}++export const OrganizationIncomingSharesSection: Component<+ OrganizationIncomingSharesSectionProps+> = (props) => (+ <div class="space-y-2 p-4 sm:p-6">+ <h4 class="text-sm font-semibold text-base-content">Incoming Shares</h4>+ <div class="mt-4 -mx-4 sm:mx-0 overflow-x-auto w-full">+ <PulseDataGrid+ data={props.state.incomingShares()}+ columns={[+ {+ key: 'sourceOrg',+ label: 'Source Org',+ render: (share) => (+ <span class="text-base-content">{share.sourceOrgName || share.sourceOrgId}</span>+ ),+ },+ {+ key: 'resource',+ label: 'Resource',+ render: (share) => (+ <div class="flex flex-col">+ <span class="text-base-content">{share.resourceName || share.resourceId}</span>+ <span class="text-xs text-muted">+ {share.resourceType}:{share.resourceId}+ </span>+ </div>+ ),+ },+ {+ key: 'accessRole',+ 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>+ );+ },+ },+ {+ key: 'createdAt',+ label: 'Shared',+ render: (share) => <span class="text-muted">{formatOrgDate(share.createdAt)}</span>,+ },+ ]}+ keyExtractor={(share) => share.id}+ emptyState={getOrganizationIncomingSharesEmptyState()}+ desktopMinWidth="620px"+ class="border-x-0 sm:border-x sm:border-t sm:border-b sm:rounded-md border-y border-border"+ />+ </div>+ </div>+);diff --git a/frontend-modern/src/components/Settings/OrganizationOutgoingSharesSection.tsx b/frontend-modern/src/components/Settings/OrganizationOutgoingSharesSection.tsxnew file mode 100644index 0000000000..0a3e525df7--- /dev/null+++ b/frontend-modern/src/components/Settings/OrganizationOutgoingSharesSection.tsx@@ -0,0 +1,90 @@+import { Component, Show } from 'solid-js';+import { PulseDataGrid } from '@/components/shared/PulseDataGrid';+import { normalizeOrganizationShareRole } from '@/utils/organizationRolePresentation';+import { formatOrgDate, roleBadgeClass } from '@/utils/orgUtils';+import { getOrganizationOutgoingSharesEmptyState } from '@/utils/organizationSettingsPresentation';+import Trash2 from 'lucide-solid/icons/trash-2';+import type { useOrganizationSharingPanelState } from './useOrganizationSharingPanelState';++interface OrganizationOutgoingSharesSectionProps {+ state: ReturnType<typeof useOrganizationSharingPanelState>;+}++export const OrganizationOutgoingSharesSection: Component<+ OrganizationOutgoingSharesSectionProps+> = (props) => (+ <div class="space-y-2 p-4 sm:p-6">+ <h4 class="text-sm font-semibold text-base-content">Outgoing Shares</h4>+ <div class="mt-4 -mx-4 sm:mx-0 overflow-x-auto w-full">+ <PulseDataGrid+ data={props.state.outgoingShares()}+ columns={[+ {+ key: 'resourceName',+ label: 'Resource',+ render: (share) => (+ <div class="flex flex-col">+ <span class="text-base-content">{share.resourceName || share.resourceId}</span>+ <span class="text-xs text-muted">+ {share.resourceType}:{share.resourceId}+ </span>+ </div>+ ),+ },+ {+ key: 'targetOrgId',+ label: 'Target Org',+ render: (share) => (+ <span class="text-base-content">+ {props.state.orgNameById().get(share.targetOrgId) || share.targetOrgId}+ </span>+ ),+ },+ {+ key: 'accessRole',+ 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>+ );+ },+ },+ {+ key: 'createdAt',+ label: 'Created',+ render: (share) => <span class="text-muted">{formatOrgDate(share.createdAt)}</span>,+ },+ {+ key: 'actions',+ label: 'Actions',+ align: 'right',+ render: (share) => (+ <Show when={props.state.canManageCurrentOrg()}>+ <button+ type="button"+ onClick={() => {+ void props.state.deleteShare(share);+ }}+ disabled={props.state.saving()}+ class="inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-red-600 hover:bg-red-50 dark:text-red-300 dark:hover:bg-red-900 disabled:cursor-not-allowed disabled:opacity-60"+ >+ <Trash2 class="w-3.5 h-3.5" />+ Remove+ </button>+ </Show>+ ),+ },+ ]}+ keyExtractor={(share) => share.id}+ emptyState={getOrganizationOutgoingSharesEmptyState()}+ desktopMinWidth="760px"+ class="border-x-0 sm:border-x sm:border-t sm:border-b sm:rounded-md border-y border-border"+ />+ </div>+ </div>+);diff --git a/frontend-modern/src/components/Settings/OrganizationSharingCreateSection.tsx b/frontend-modern/src/components/Settings/OrganizationSharingCreateSection.tsxnew file mode 100644index 0000000000..695b01df34--- /dev/null+++ b/frontend-modern/src/components/Settings/OrganizationSharingCreateSection.tsx@@ -0,0 +1,180 @@+import { Component, For, Show } from 'solid-js';+import { CANONICAL_RESOURCE_TYPES } from '@/utils/canonicalResourceTypes';+import {+ ORGANIZATION_SHARE_ROLE_OPTIONS,+ type ShareAccessRole,+} from '@/utils/organizationRolePresentation';+import type { useOrganizationSharingPanelState } from './useOrganizationSharingPanelState';++interface OrganizationSharingCreateSectionProps {+ state: ReturnType<typeof useOrganizationSharingPanelState>;+}++export const OrganizationSharingCreateSection: Component<OrganizationSharingCreateSectionProps> = (+ props,+) => (+ <>+ <Show when={props.state.canManageCurrentOrg()}>+ <div class="p-4 sm:p-6">+ <div class="rounded-md border border-border p-4 space-y-3">+ <h4 class="text-sm font-semibold text-base-content">Create Share</h4>++ <div class="grid gap-3 lg:grid-cols-2">+ <label class="space-y-1">+ <span class="text-xs font-medium uppercase tracking-wide text-muted">+ Target Organization+ </span>+ <select+ value={props.state.targetOrgId()}+ onChange={(event) => props.state.updateTargetOrg(event.currentTarget.value)}+ class={`w-full rounded-md border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 ${props.state.targetOrgError() ? 'border-red-400 dark:border-red-500' : 'border-border'}`}+ >+ <option value="">Select organization</option>+ <For each={props.state.targetOrgOptions()}>+ {(target) => <option value={target.id}>{target.displayName || target.id}</option>}+ </For>+ </select>+ <Show when={props.state.targetOrgError() !== ''}>+ <p class="text-xs text-red-600 dark:text-red-400">+ {props.state.targetOrgError()}+ </p>+ </Show>+ </label>++ <label class="space-y-1">+ <span class="text-xs font-medium uppercase tracking-wide text-muted">+ Access Role+ </span>+ <select+ value={props.state.accessRole()}+ onChange={(event) =>+ props.state.setAccessRole(event.currentTarget.value as ShareAccessRole)+ }+ class="w-full rounded-md border border-border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"+ >+ <For each={ORGANIZATION_SHARE_ROLE_OPTIONS}>+ {(option) => <option value={option.value}>{option.label}</option>}+ </For>+ </select>+ </label>+ </div>++ <Show when={props.state.unifiedResourceOptions().length > 0}>+ <div class="rounded-md border border-blue-200 bg-blue-50 p-3 space-y-2 dark:border-blue-900 dark:bg-blue-900">+ <label class="space-y-1 block">+ <span class="text-xs font-medium uppercase tracking-wide text-blue-700 dark:text-blue-300">+ Quick Pick Resource+ </span>+ <select+ value={props.state.selectedQuickPick()}+ onChange={(event) => props.state.applyResourceQuickPick(event.currentTarget.value)}+ class="w-full rounded-md border border-blue-300 bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:border-blue-700"+ >+ <option value="">Select resource</option>+ <For each={props.state.unifiedResourceOptions()}>+ {(resource) => (+ <option value={`${resource.type}::${resource.id}`}>+ {resource.name} ({resource.type})+ </option>+ )}+ </For>+ </select>+ </label>+ <div class="flex flex-col items-start gap-2 sm:flex-row sm:items-center sm:justify-between">+ <p class="text-xs text-blue-700 dark:text-blue-300">+ Choose a discovered resource, or switch to manual entry.+ </p>+ <button+ type="button"+ onClick={props.state.toggleManualEntry}+ class="text-xs font-medium text-blue-700 hover:text-blue-800 dark:text-blue-300 dark:hover:text-blue-200"+ >+ {props.state.manualEntryExpanded() ? 'Hide manual entry' : 'Enter manually'}+ </button>+ </div>+ </div>+ </Show>++ <Show+ when={+ props.state.unifiedResourceOptions().length === 0 || props.state.manualEntryExpanded()+ }+ fallback={+ <p class="text-xs text-muted">Manual entry is hidden while quick pick is active.</p>+ }+ >+ <div class="grid gap-3 lg:grid-cols-3">+ <label class="space-y-1">+ <span class="text-xs font-medium uppercase tracking-wide text-muted">+ Resource Type+ </span>+ <input+ type="text"+ value={props.state.resourceType()}+ onInput={(event) => props.state.updateResourceType(event.currentTarget.value)}+ placeholder={CANONICAL_RESOURCE_TYPES.join(' | ')}+ class={`w-full rounded-md border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 ${props.state.resourceTypeError() ? 'border-red-400 dark:border-red-500' : 'border-border'}`}+ />+ <Show when={props.state.resourceTypeError() !== ''}>+ <p class="text-xs text-red-600 dark:text-red-400">+ {props.state.resourceTypeError()}+ </p>+ </Show>+ </label>++ <label class="space-y-1">+ <span class="text-xs font-medium uppercase tracking-wide text-muted">+ Resource ID+ </span>+ <input+ type="text"+ value={props.state.resourceId()}+ onInput={(event) => props.state.updateResourceId(event.currentTarget.value)}+ placeholder="resource identifier"+ class={`w-full rounded-md border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 ${props.state.resourceIdError() ? 'border-red-400 dark:border-red-500' : 'border-border'}`}+ />+ <Show when={props.state.resourceIdError() !== ''}>+ <p class="text-xs text-red-600 dark:text-red-400">+ {props.state.resourceIdError()}+ </p>+ </Show>+ </label>++ <label class="space-y-1">+ <span class="text-xs font-medium uppercase tracking-wide text-muted">+ Resource Name+ </span>+ <input+ type="text"+ value={props.state.resourceName()}+ onInput={(event) => props.state.updateResourceName(event.currentTarget.value)}+ placeholder="optional display name"+ class="w-full rounded-md border border-border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"+ />+ </label>+ </div>+ </Show>++ <div class="flex justify-end">+ <button+ type="button"+ onClick={props.state.createShare}+ disabled={!props.state.canCreateShare()}+ class="inline-flex w-full sm:w-auto items-center justify-center rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60"+ >+ {props.state.saving() ? 'Saving...' : 'Create Share'}+ </button>+ </div>+ </div>+ </div>+ </Show>++ <Show when={!props.state.canManageCurrentOrg()}>+ <div class="p-4 sm:p-6">+ <div class="rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800 dark:border-amber-800 dark:bg-amber-900 dark:text-amber-300">+ Admin or owner role required to create or remove organization shares.+ </div>+ </div>+ </Show>+ </>+);diff --git a/frontend-modern/src/components/Settings/OrganizationSharingLoadingState.tsx b/frontend-modern/src/components/Settings/OrganizationSharingLoadingState.tsxnew file mode 100644index 0000000000..c86b30a16d--- /dev/null+++ b/frontend-modern/src/components/Settings/OrganizationSharingLoadingState.tsx@@ -0,0 +1,78 @@+import { Component, For } from 'solid-js';++export const OrganizationSharingLoadingState: Component = () => (+ <div class="space-y-5 p-4 sm:p-6">+ <div class="rounded-md border border-border p-4 space-y-3">+ <div class="h-4 w-24 animate-pulse rounded bg-surface-hover" />++ <div class="grid gap-3 lg:grid-cols-2">+ <div class="space-y-2">+ <div class="h-3 w-28 animate-pulse rounded bg-surface-hover" />+ <div class="h-10 w-full animate-pulse rounded bg-surface-hover" />+ </div>+ <div class="space-y-2">+ <div class="h-3 w-20 animate-pulse rounded bg-surface-hover" />+ <div class="h-10 w-full animate-pulse rounded bg-surface-hover" />+ </div>+ </div>++ <div class="rounded-md border border-border p-3 space-y-2">+ <div class="h-3 w-32 animate-pulse rounded bg-surface-hover" />+ <div class="h-10 w-full animate-pulse rounded bg-surface-hover" />+ </div>++ <div class="grid gap-3 lg:grid-cols-3">+ <For each={Array.from({ length: 3 })}>+ {() => (+ <div class="space-y-2">+ <div class="h-3 w-24 animate-pulse rounded bg-surface-hover" />+ <div class="h-10 w-full animate-pulse rounded bg-surface-hover" />+ </div>+ )}+ </For>+ </div>++ <div class="flex justify-end">+ <div class="h-10 w-28 animate-pulse rounded bg-surface-hover" />+ </div>+ </div>++ <div class="space-y-2">+ <div class="h-4 w-28 animate-pulse rounded bg-surface-hover" />+ <div class="overflow-hidden rounded-md border border-border">+ <div class="h-10 w-full animate-pulse bg-surface-alt" />+ <For each={Array.from({ length: 3 })}>+ {() => (+ <div class="border-t border-border-subtle px-3 py-3">+ <div class="flex items-center gap-3">+ <div class="h-4 w-40 animate-pulse rounded bg-surface-hover" />+ <div class="h-4 w-24 animate-pulse rounded bg-surface-hover" />+ <div class="h-4 w-14 animate-pulse rounded-full bg-surface-hover" />+ <div class="h-4 w-24 animate-pulse rounded bg-surface-hover" />+ </div>+ </div>+ )}+ </For>+ </div>+ </div>++ <div class="space-y-2">+ <div class="h-4 w-28 animate-pulse rounded bg-surface-hover" />+ <div class="overflow-hidden rounded-md border border-border">+ <div class="h-10 w-full animate-pulse bg-surface-alt" />+ <For each={Array.from({ length: 3 })}>+ {() => (+ <div class="border-t border-border-subtle px-3 py-3">+ <div class="flex items-center gap-3">+ <div class="h-4 w-24 animate-pulse rounded bg-surface-hover" />+ <div class="h-4 w-40 animate-pulse rounded bg-surface-hover" />+ <div class="h-4 w-14 animate-pulse rounded-full bg-surface-hover" />+ <div class="h-4 w-24 animate-pulse rounded bg-surface-hover" />+ </div>+ </div>+ )}+ </For>+ </div>+ </div>+ </div>+);diff --git a/frontend-modern/src/components/Settings/OrganizationSharingPanel.tsx b/frontend-modern/src/components/Settings/OrganizationSharingPanel.tsxindex bc1a65307c..0198220726 100644--- a/frontend-modern/src/components/Settings/OrganizationSharingPanel.tsx+++ b/frontend-modern/src/components/Settings/OrganizationSharingPanel.tsx@@ -1,320 +1,23 @@-import {- Component,- For,- Show,- createEffect,- createMemo,- createSignal,- onCleanup,- onMount,-} from 'solid-js';+import { Component, Show } from 'solid-js';import SettingsPanel from '@/components/shared/SettingsPanel';-import {- OrgsAPI,- type IncomingOrganizationShare,- type Organization,- type OrganizationShare,-} from '@/api/orgs';-import { getOrgID } from '@/utils/apiClient';-import { normalizeOrgScope } from '@/utils/orgScope';-import { canManageOrg, formatOrgDate, roleBadgeClass } from '@/utils/orgUtils';import { isMultiTenantEnabled } from '@/stores/license';-import { eventBus } from '@/stores/events';-import { notificationStore } from '@/stores/notifications';-import { logger } from '@/utils/logger';-import {- CANONICAL_RESOURCE_TYPES,- INVALID_RESOURCE_TYPE_ERROR,- isCanonicalResourceType,- normalizeCanonicalResourceTypeInput,-} from '@/utils/canonicalResourceTypes';-import {- normalizeOrganizationShareRole,- ORGANIZATION_SHARE_ROLE_OPTIONS,- type ShareAccessRole,-} from '@/utils/organizationRolePresentation';import {- getOrganizationShareCreateErrorMessage,- getOrganizationShareCreateSuccessMessage,- getOrganizationShareDeleteErrorMessage,- getOrganizationShareDeleteSuccessMessage,- getOrganizationShareInvalidResourceMessage,- getOrganizationShareResourceIdRequiredMessage,- getOrganizationShareTargetOrgDifferentMessage,- getOrganizationShareTargetOrgRequiredMessage,- getOrganizationIncomingSharesEmptyState,- getOrganizationOutgoingSharesEmptyState,- getOrganizationSettingsLoadErrorMessage,ORGANIZATION_SETTINGS_UNAVAILABLE_CLASS,ORGANIZATION_SETTINGS_UNAVAILABLE_MESSAGE,} from '@/utils/organizationSettingsPresentation';-import { useResources } from '@/hooks/useResources';-import { getPreferredResourceDisplayName } from '@/utils/resourceIdentity';import Share2 from 'lucide-solid/icons/share-2';-import Trash2 from 'lucide-solid/icons/trash-2';-import { PulseDataGrid } from '@/components/shared/PulseDataGrid';+import { OrganizationIncomingSharesSection } from './OrganizationIncomingSharesSection';+import { OrganizationOutgoingSharesSection } from './OrganizationOutgoingSharesSection';+import { OrganizationSharingCreateSection } from './OrganizationSharingCreateSection';+import { OrganizationSharingLoadingState } from './OrganizationSharingLoadingState';+import { useOrganizationSharingPanelState } from './useOrganizationSharingPanelState';-interface OrganizationSharingPanelProps {+export interface OrganizationSharingPanelProps {currentUser?: string;}-type ResourceOption = {- id: string;- type: string;- name: string;-};-export const OrganizationSharingPanel: Component<OrganizationSharingPanelProps> = (props) => {- const [loading, setLoading] = createSignal(true);- const [saving, setSaving] = createSignal(false);- const [org, setOrg] = createSignal<Organization | null>(null);- const [orgs, setOrgs] = createSignal<Organization[]>([]);- const [outgoingShares, setOutgoingShares] = createSignal<OrganizationShare[]>([]);- const [incomingShares, setIncomingShares] = createSignal<IncomingOrganizationShare[]>([]);-- const [targetOrgId, setTargetOrgId] = createSignal('');- const [resourceType, setResourceType] = createSignal('');- const [resourceId, setResourceId] = createSignal('');- const [resourceName, setResourceName] = createSignal('');- const [accessRole, setAccessRole] = createSignal<ShareAccessRole>('viewer');- const [selectedQuickPick, setSelectedQuickPick] = createSignal('');- const [manualEntryExpanded, setManualEntryExpanded] = createSignal(false);-- const [targetOrgError, setTargetOrgError] = createSignal('');- const [resourceTypeError, setResourceTypeError] = createSignal('');- const [resourceIdError, setResourceIdError] = createSignal('');-- const activeOrgId = () => normalizeOrgScope(getOrgID());- const { resources } = useResources();-- const targetOrgOptions = createMemo(() =>- orgs()- .filter((candidate) => candidate.id !== activeOrgId())- .sort((left, right) =>- (left.displayName || left.id).localeCompare(right.displayName || right.id),- ),- );- const unifiedResourceOptions = createMemo<ResourceOption[]>(() => {- return resources()- .filter((resource) => resource.id && resource.type)- .map((resource) => ({- id: resource.id,- type: resource.type,- name: (getPreferredResourceDisplayName(resource) || resource.id).trim(),- }))- .sort((left, right) => left.name.localeCompare(right.name));- });-- const normalizedResourceType = createMemo(() =>- normalizeCanonicalResourceTypeInput(resourceType()),- );- const normalizedResourceId = createMemo(() => resourceId().trim());- const hasTargetOrg = createMemo(() => targetOrgId().trim() !== '');- const hasQuickPickSelection = createMemo(() => selectedQuickPick().trim() !== '');- const manualEntryValid = createMemo(- () => isCanonicalResourceType(normalizedResourceType()) && normalizedResourceId() !== '',- );- const canCreateShare = createMemo(- () => !saving() && hasTargetOrg() && (hasQuickPickSelection() || manualEntryValid()),- );-- const orgNameById = createMemo(() => {- const map = new Map<string, string>();- for (const organization of orgs()) {- map.set(organization.id, organization.displayName || organization.id);- }- return map;- });-- createEffect(() => {- if (unifiedResourceOptions().length > 0) return;- setManualEntryExpanded(true);- setSelectedQuickPick('');- });-- const loadShares = async (orgId: string) => {- const [outgoing, incoming] = await Promise.all([- OrgsAPI.listShares(orgId),- OrgsAPI.listIncomingShares(orgId),- ]);- setOutgoingShares(outgoing);- setIncomingShares(incoming);- };-- const loadSharingData = async () => {- setLoading(true);- try {- const orgId = activeOrgId();-- const [orgData, memberData, allOrgs] = await Promise.all([- OrgsAPI.get(orgId),- OrgsAPI.listMembers(orgId),- OrgsAPI.list(),- ]);-- setOrg({ ...orgData, members: memberData });- setOrgs(allOrgs);- if (unifiedResourceOptions().length === 0) {- setManualEntryExpanded(true);- setSelectedQuickPick('');- }-- await loadShares(orgId);-- const firstTarget =- targetOrgId().trim() || allOrgs.find((candidate) => candidate.id !== orgId)?.id || '';- setTargetOrgId(firstTarget);- setTargetOrgError(firstTarget === '' ? getOrganizationShareTargetOrgRequiredMessage() : '');- } catch (error) {- logger.error('Failed to load organization sharing data', error);- const msg = error instanceof Error ? error.message : '';- notificationStore.error(getOrganizationSettingsLoadErrorMessage(msg, 'sharing'));- } finally {- setLoading(false);- }- };-- const applyResourceQuickPick = (value: string) => {- setSelectedQuickPick(value);- setResourceTypeError('');- setResourceIdError('');- if (!value) return;-- const [nextType, nextID] = value.split('::');- const match = unifiedResourceOptions().find(- (resource) => resource.id === (nextID ?? '') && resource.type === (nextType ?? ''),- );- if (!match) return;- setResourceType(normalizeCanonicalResourceTypeInput(match.type));- setResourceId(match.id);- setResourceName(match.name);- };-- const toggleManualEntry = () => {- const expanding = !manualEntryExpanded();- setManualEntryExpanded(expanding);- setResourceTypeError('');- setResourceIdError('');- if (expanding) {- setSelectedQuickPick('');- }- };-- const updateTargetOrg = (value: string) => {- setTargetOrgId(value);- setTargetOrgError(value.trim() === '' ? getOrganizationShareTargetOrgRequiredMessage() : '');- };-- const updateResourceType = (value: string) => {- setSelectedQuickPick('');- setResourceType(value);- const normalized = normalizeCanonicalResourceTypeInput(value);- setResourceTypeError(- normalized === '' || isCanonicalResourceType(normalized) ? '' : INVALID_RESOURCE_TYPE_ERROR,- );- };-- const updateResourceId = (value: string) => {- setSelectedQuickPick('');- setResourceId(value);- setResourceIdError(value.trim() === '' ? getOrganizationShareResourceIdRequiredMessage() : '');- };-- const updateResourceName = (value: string) => {- setSelectedQuickPick('');- setResourceName(value);- };-- const createShare = async () => {- const currentOrg = org();- if (!currentOrg) return;-- const nextTargetOrgId = targetOrgId().trim();- const nextResourceType = normalizedResourceType();- const nextResourceId = normalizedResourceId();- const nextResourceName = resourceName().trim();- const hasQuickPick = hasQuickPickSelection();- const hasValidManualType = isCanonicalResourceType(nextResourceType);- const hasValidManualResourceId = nextResourceId !== '';-- setTargetOrgError(- nextTargetOrgId === '' ? getOrganizationShareTargetOrgRequiredMessage() : '',- );- if (hasQuickPick) {- setResourceTypeError('');- setResourceIdError('');- } else {- setResourceTypeError(hasValidManualType ? '' : INVALID_RESOURCE_TYPE_ERROR);- setResourceIdError(- hasValidManualResourceId ? '' : getOrganizationShareResourceIdRequiredMessage(),- );- }-- if (!nextTargetOrgId) {- notificationStore.error(getOrganizationShareTargetOrgRequiredMessage());- return;- }- if (nextTargetOrgId === currentOrg.id) {- notificationStore.error(getOrganizationShareTargetOrgDifferentMessage());- return;- }- if (!hasQuickPick && (!hasValidManualType || !hasValidManualResourceId)) {- notificationStore.error(getOrganizationShareInvalidResourceMessage());- return;- }-- setSaving(true);- try {- await OrgsAPI.createShare(currentOrg.id, {- targetOrgId: nextTargetOrgId,- resourceType: nextResourceType,- resourceId: nextResourceId,- resourceName: nextResourceName,- accessRole: accessRole(),- });- notificationStore.success(getOrganizationShareCreateSuccessMessage());- await loadShares(currentOrg.id);- } catch (error) {- logger.error('Failed to create organization share', error);- notificationStore.error(- getOrganizationShareCreateErrorMessage(error instanceof Error ? error.message : undefined),- );- } finally {- setSaving(false);- }- };-- const deleteShare = async (share: OrganizationShare) => {- const currentOrg = org();- if (!currentOrg) return;- if (!confirm(`Remove share for ${share.resourceType}:${share.resourceId}?`)) {- return;- }-- setSaving(true);- try {- await OrgsAPI.deleteShare(currentOrg.id, share.id);- notificationStore.success(getOrganizationShareDeleteSuccessMessage());- await loadShares(currentOrg.id);- } catch (error) {- logger.error('Failed to delete organization share', error);- notificationStore.error(- getOrganizationShareDeleteErrorMessage(error instanceof Error ? error.message : undefined),- );- } finally {- setSaving(false);- }- };-- onMount(() => {- if (!isMultiTenantEnabled()) return;- void loadSharingData();-- const unsubscribe = eventBus.on('org_switched', () => {- void loadSharingData();- });- onCleanup(unsubscribe);- });+ const state = useOrganizationSharingPanelState(props);return (<Show@@ -333,377 +36,10 @@ export const OrganizationSharingPanel: Component<OrganizationSharingPanelProps>noPaddingbodyClass="divide-y divide-border">- <Show- when={!loading()}- fallback={- <div class="space-y-5 p-4 sm:p-6">- <div class="rounded-md border border-border p-4 space-y-3">- <div class="h-4 w-24 animate-pulse rounded bg-surface-hover" />-- <div class="grid gap-3 lg:grid-cols-2">- <div class="space-y-2">- <div class="h-3 w-28 animate-pulse rounded bg-surface-hover" />- <div class="h-10 w-full animate-pulse rounded bg-surface-hover" />- </div>- <div class="space-y-2">- <div class="h-3 w-20 animate-pulse rounded bg-surface-hover" />- <div class="h-10 w-full animate-pulse rounded bg-surface-hover" />- </div>- </div>-- <div class="rounded-md border border-border p-3 space-y-2">- <div class="h-3 w-32 animate-pulse rounded bg-surface-hover" />- <div class="h-10 w-full animate-pulse rounded bg-surface-hover" />- </div>-- <div class="grid gap-3 lg:grid-cols-3">- {Array.from({ length: 3 }).map(() => (- <div class="space-y-2">- <div class="h-3 w-24 animate-pulse rounded bg-surface-hover" />- <div class="h-10 w-full animate-pulse rounded bg-surface-hover" />- </div>- ))}- </div>-- <div class="flex justify-end">- <div class="h-10 w-28 animate-pulse rounded bg-surface-hover" />- </div>- </div>-- <div class="space-y-2">- <div class="h-4 w-28 animate-pulse rounded bg-surface-hover" />- <div class="overflow-hidden rounded-md border border-border">- <div class="h-10 w-full animate-pulse bg-surface-alt" />- {Array.from({ length: 3 }).map(() => (- <div class="border-t border-border-subtle px-3 py-3">- <div class="flex items-center gap-3">- <div class="h-4 w-40 animate-pulse rounded bg-surface-hover" />- <div class="h-4 w-24 animate-pulse rounded bg-surface-hover" />- <div class="h-4 w-14 animate-pulse rounded-full bg-surface-hover" />- <div class="h-4 w-24 animate-pulse rounded bg-surface-hover" />- </div>- </div>- ))}- </div>- </div>-- <div class="space-y-2">- <div class="h-4 w-28 animate-pulse rounded bg-surface-hover" />- <div class="overflow-hidden rounded-md border border-border">- <div class="h-10 w-full animate-pulse bg-surface-alt" />- {Array.from({ length: 3 }).map(() => (- <div class="border-t border-border-subtle px-3 py-3">- <div class="flex items-center gap-3">- <div class="h-4 w-24 animate-pulse rounded bg-surface-hover" />- <div class="h-4 w-40 animate-pulse rounded bg-surface-hover" />- <div class="h-4 w-14 animate-pulse rounded-full bg-surface-hover" />- <div class="h-4 w-24 animate-pulse rounded bg-surface-hover" />- </div>- </div>- ))}- </div>- </div>- </div>- }- >- <Show when={canManageOrg(org(), props.currentUser)}>- <div class="p-4 sm:p-6">- <div class="rounded-md border border-border p-4 space-y-3">- <h4 class="text-sm font-semibold text-base-content">Create Share</h4>-- <div class="grid gap-3 lg:grid-cols-2">- <label class="space-y-1">- <span class="text-xs font-medium uppercase tracking-wide text-muted">- Target Organization- </span>- <select- value={targetOrgId()}- onChange={(event) => updateTargetOrg(event.currentTarget.value)}- class={`w-full rounded-md border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 ${targetOrgError() ? 'border-red-400 dark:border-red-500' : 'border-border'}`}- >- <option value="">Select organization</option>- <For each={targetOrgOptions()}>- {(target) => (- <option value={target.id}>{target.displayName || target.id}</option>- )}- </For>- </select>- <Show when={targetOrgError() !== ''}>- <p class="text-xs text-red-600 dark:text-red-400">{targetOrgError()}</p>- </Show>- </label>-- <label class="space-y-1">- <span class="text-xs font-medium uppercase tracking-wide text-muted">- Access Role- </span>- <select- value={accessRole()}- onChange={(event) =>- setAccessRole(event.currentTarget.value as ShareAccessRole)- }- class="w-full rounded-md border border-border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"- >- <For each={ORGANIZATION_SHARE_ROLE_OPTIONS}>- {(option) => <option value={option.value}>{option.label}</option>}- </For>- </select>- </label>- </div>-- <Show when={unifiedResourceOptions().length > 0}>- <div class="rounded-md border border-blue-200 bg-blue-50 p-3 space-y-2 dark:border-blue-900 dark:bg-blue-900">- <label class="space-y-1 block">- <span class="text-xs font-medium uppercase tracking-wide text-blue-700 dark:text-blue-300">- Quick Pick Resource- </span>- <select- value={selectedQuickPick()}- onChange={(event) => applyResourceQuickPick(event.currentTarget.value)}- class="w-full rounded-md border border-blue-300 bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:border-blue-700"- >- <option value="">Select resource</option>- <For each={unifiedResourceOptions()}>- {(resource) => (- <option value={`${resource.type}::${resource.id}`}>- {resource.name} ({resource.type})- </option>- )}- </For>- </select>- </label>- <div class="flex flex-col items-start gap-2 sm:flex-row sm:items-center sm:justify-between">- <p class="text-xs text-blue-700 dark:text-blue-300">- Choose a discovered resource, or switch to manual entry.- </p>- <button- type="button"- onClick={toggleManualEntry}- class="text-xs font-medium text-blue-700 hover:text-blue-800 dark:text-blue-300 dark:hover:text-blue-200"- >- {manualEntryExpanded() ? 'Hide manual entry' : 'Enter manually'}- </button>- </div>- </div>- </Show>-- <Show- when={unifiedResourceOptions().length === 0 || manualEntryExpanded()}- fallback={- <p class="text-xs text-muted">- Manual entry is hidden while quick pick is active.- </p>- }- >- <div class="grid gap-3 lg:grid-cols-3">- <label class="space-y-1">- <span class="text-xs font-medium uppercase tracking-wide text-muted">- Resource Type- </span>- <input- type="text"- value={resourceType()}- onInput={(event) => updateResourceType(event.currentTarget.value)}- placeholder={CANONICAL_RESOURCE_TYPES.join(' | ')}- class={`w-full rounded-md border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 ${resourceTypeError() ? 'border-red-400 dark:border-red-500' : 'border-border'}`}- />- <Show when={resourceTypeError() !== ''}>- <p class="text-xs text-red-600 dark:text-red-400">- {resourceTypeError()}- </p>- </Show>- </label>-- <label class="space-y-1">- <span class="text-xs font-medium uppercase tracking-wide text-muted">- Resource ID- </span>- <input- type="text"- value={resourceId()}- onInput={(event) => updateResourceId(event.currentTarget.value)}- placeholder="resource identifier"- class={`w-full rounded-md border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 ${resourceIdError() ? 'border-red-400 dark:border-red-500' : 'border-border'}`}- />- <Show when={resourceIdError() !== ''}>- <p class="text-xs text-red-600 dark:text-red-400">{resourceIdError()}</p>- </Show>- </label>-- <label class="space-y-1">- <span class="text-xs font-medium uppercase tracking-wide text-muted">- Resource Name- </span>- <input- type="text"- value={resourceName()}- onInput={(event) => updateResourceName(event.currentTarget.value)}- placeholder="optional display name"- class="w-full rounded-md border border-border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"- />- </label>- </div>- </Show>-- <div class="flex justify-end">- <button- type="button"- onClick={createShare}- disabled={!canCreateShare()}- class="inline-flex w-full sm:w-auto items-center justify-center rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60"- >- {saving() ? 'Saving...' : 'Create Share'}- </button>- </div>- </div>- </div>- </Show>-- <Show when={!canManageOrg(org(), props.currentUser)}>- <div class="p-4 sm:p-6">- <div class="rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800 dark:border-amber-800 dark:bg-amber-900 dark:text-amber-300">- Admin or owner role required to create or remove organization shares.- </div>- </div>- </Show>-- <div class="space-y-2 p-4 sm:p-6">- <h4 class="text-sm font-semibold text-base-content">Outgoing Shares</h4>- <div class="mt-4 -mx-4 sm:mx-0 overflow-x-auto w-full">- <PulseDataGrid- data={outgoingShares()}- columns={[- {- key: 'resourceName',- label: 'Resource',- render: (share) => (- <div class="flex flex-col">- <span class="text-base-content">- {share.resourceName || share.resourceId}- </span>- <span class="text-xs text-muted">- {share.resourceType}:{share.resourceId}- </span>- </div>- ),- },- {- key: 'targetOrgId',- label: 'Target Org',- render: (share) => (- <span class="text-base-content">- {orgNameById().get(share.targetOrgId) || share.targetOrgId}- </span>- ),- },- {- key: 'accessRole',- 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>- );- },- },- {- key: 'createdAt',- label: 'Created',- render: (share) => (- <span class="text-muted">{formatOrgDate(share.createdAt)}</span>- ),- },- {- key: 'actions',- label: 'Actions',- align: 'right',- render: (share) => (- <Show when={canManageOrg(org(), props.currentUser)}>- <button- type="button"- onClick={() => {- void deleteShare(share);- }}- disabled={saving()}- class="inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-red-600 hover:bg-red-50 dark:text-red-300 dark:hover:bg-red-900 disabled:cursor-not-allowed disabled:opacity-60"- >- <Trash2 class="w-3.5 h-3.5" />- Remove- </button>- </Show>- ),- },- ]}- keyExtractor={(share) => share.id}- emptyState={getOrganizationOutgoingSharesEmptyState()}- desktopMinWidth="760px"- class="border-x-0 sm:border-x sm:border-t sm:border-b sm:rounded-md border-y border-border"- />- </div>- </div>-- <div class="space-y-2 p-4 sm:p-6">- <h4 class="text-sm font-semibold text-base-content">Incoming Shares</h4>- <div class="mt-4 -mx-4 sm:mx-0 overflow-x-auto w-full">- <PulseDataGrid- data={incomingShares()}- columns={[- {- key: 'sourceOrg',- label: 'Source Org',- render: (share) => (- <span class="text-base-content">- {share.sourceOrgName || share.sourceOrgId}- </span>- ),- },- {- key: 'resource',- label: 'Resource',- render: (share) => (- <div class="flex flex-col">- <span class="text-base-content">- {share.resourceName || share.resourceId}- </span>- <span class="text-xs text-muted">- {share.resourceType}:{share.resourceId}- </span>- </div>- ),- },- {- key: 'accessRole',- 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>- );- },- },- {- key: 'createdAt',- label: 'Shared',- render: (share) => (- <span class="text-muted">{formatOrgDate(share.createdAt)}</span>- ),- },- ]}- keyExtractor={(share) => share.id}- emptyState={getOrganizationIncomingSharesEmptyState()}- desktopMinWidth="620px"- class="border-x-0 sm:border-x sm:border-t sm:border-b sm:rounded-md border-y border-border"- />- </div>- </div>+ <Show when={!state.loading()} fallback={<OrganizationSharingLoadingState />}>+ <OrganizationSharingCreateSection state={state} />+ <OrganizationOutgoingSharesSection state={state} />+ <OrganizationIncomingSharesSection state={state} /></Show></SettingsPanel></div>diff --git a/frontend-modern/src/components/Settings/__tests__/OrganizationSharingPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/OrganizationSharingPanel.test.tsxindex 134e9fadd8..8720fe6581 100644--- a/frontend-modern/src/components/Settings/__tests__/OrganizationSharingPanel.test.tsx+++ b/frontend-modern/src/components/Settings/__tests__/OrganizationSharingPanel.test.tsx@@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-library';import type { Resource } from '@/types/resource';import { OrganizationSharingPanel } from '../OrganizationSharingPanel';-import organizationSharingPanelSource from '../OrganizationSharingPanel.tsx?raw';+import organizationSharingStateSource from '../useOrganizationSharingPanelState.ts?raw';let mockResources: Resource[] = [];@@ -305,7 +305,7 @@ describe('OrganizationSharingPanel', () => {});it('normalizes org scope through the shared helper', () => {- expect(organizationSharingPanelSource).toContain('normalizeOrgScope(getOrgID())');- expect(organizationSharingPanelSource).not.toContain("getOrgID() || 'default'");+ expect(organizationSharingStateSource).toContain('normalizeOrgScope(getOrgID())');+ expect(organizationSharingStateSource).not.toContain("getOrgID() || 'default'");});});diff --git a/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts b/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.tsindex b2120b64ea..a1988f0ed6 100644--- a/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts+++ b/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts@@ -72,6 +72,11 @@ import commandPaletteSource from '@/components/shared/CommandPaletteModal.tsx?raimport organizationAccessPanelSource from '../OrganizationAccessPanel.tsx?raw';import organizationOverviewPanelSource from '../OrganizationOverviewPanel.tsx?raw';import organizationSharingPanelSource from '../OrganizationSharingPanel.tsx?raw';+import organizationSharingCreateSectionSource from '../OrganizationSharingCreateSection.tsx?raw';+import organizationSharingLoadingStateSource from '../OrganizationSharingLoadingState.tsx?raw';+import organizationOutgoingSharesSectionSource from '../OrganizationOutgoingSharesSection.tsx?raw';+import organizationIncomingSharesSectionSource from '../OrganizationIncomingSharesSection.tsx?raw';+import organizationSharingStateSource from '../useOrganizationSharingPanelState.ts?raw';import canonicalResourceTypesSource from '@/utils/canonicalResourceTypes.ts?raw';import organizationRolePresentationSource from '@/utils/organizationRolePresentation.ts?raw';import organizationSettingsPresentationSource from '@/utils/organizationSettingsPresentation.ts?raw';@@ -589,7 +594,7 @@ describe('monitored-system model guardrails', () => {expect(apiTypesSource).not.toContain("'qemu'");expect(apiTypesSource).not.toContain("'lxc'");expect(commandPaletteSource).not.toContain("'lxc'");- expect(organizationSharingPanelSource).toContain('@/utils/canonicalResourceTypes');+ expect(organizationSharingCreateSectionSource).toContain('@/utils/canonicalResourceTypes');expect(canonicalResourceTypesSource).toContain('export const CANONICAL_RESOURCE_TYPES =');expect(canonicalResourceTypesSource).toContain("'system-container'");expect(canonicalResourceTypesSource).toContain("'app-container'");@@ -617,29 +622,35 @@ describe('monitored-system model guardrails', () => {expect(organizationOverviewPanelSource).not.toContain("error instanceof Error ? error.message : 'Failed to update organization name'",);- expect(organizationSharingPanelSource).toContain('@/utils/organizationRolePresentation');- expect(organizationSharingPanelSource).toContain('@/utils/organizationSettingsPresentation');- expect(organizationSharingPanelSource).toContain('ORGANIZATION_SHARE_ROLE_OPTIONS');- expect(organizationSharingPanelSource).toContain('normalizeOrganizationShareRole');- expect(organizationSharingPanelSource).not.toContain(+ expect(organizationSharingCreateSectionSource).toContain('@/utils/organizationRolePresentation');+ expect(organizationSharingStateSource).toContain('@/utils/organizationSettingsPresentation');+ expect(organizationSharingCreateSectionSource).toContain('ORGANIZATION_SHARE_ROLE_OPTIONS');+ expect(organizationOutgoingSharesSectionSource).toContain('normalizeOrganizationShareRole');+ expect(organizationIncomingSharesSectionSource).toContain('normalizeOrganizationShareRole');+ expect(organizationSharingCreateSectionSource).not.toContain('const accessRoleOptions: Array<{ value: ShareAccessRole; label: string }> = [',);- expect(organizationSharingPanelSource).not.toContain('const normalizeShareRole =');- expect(organizationSharingPanelSource).not.toContain(+ expect(organizationOutgoingSharesSectionSource).not.toContain('const normalizeShareRole =');+ expect(organizationSharingStateSource).not.toContain("notificationStore.error('Target organization is required')",);- expect(organizationSharingPanelSource).not.toContain(+ expect(organizationSharingStateSource).not.toContain("notificationStore.error('Target organization must differ from the current organization')",);- expect(organizationSharingPanelSource).not.toContain(+ expect(organizationSharingStateSource).not.toContain("notificationStore.error('Valid resource type and resource ID are required')",);- expect(organizationSharingPanelSource).not.toContain(+ expect(organizationSharingStateSource).not.toContain("notificationStore.success('Resource shared successfully')",);- expect(organizationSharingPanelSource).not.toContain(+ expect(organizationSharingStateSource).not.toContain("notificationStore.success('Share removed')",);+ expect(organizationSharingPanelSource).toContain('./OrganizationSharingLoadingState');+ expect(organizationSharingPanelSource).toContain('./OrganizationSharingCreateSection');+ expect(organizationSharingPanelSource).toContain('./OrganizationOutgoingSharesSection');+ expect(organizationSharingPanelSource).toContain('./OrganizationIncomingSharesSection');+ expect(organizationSharingLoadingStateSource).toContain('animate-pulse');expect(organizationRolePresentationSource).toContain('export const ORGANIZATION_MEMBER_ROLE_OPTIONS',);diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.tsindex 8e73dd3d1d..3ab31f0e92 100644--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts@@ -49,6 +49,11 @@ import commercialBillingModelSource from '@/utils/commercialBillingModel.ts?raw'import organizationOverviewPanelSource from '../OrganizationOverviewPanel.tsx?raw';import organizationAccessPanelSource from '../OrganizationAccessPanel.tsx?raw';import organizationSharingPanelSource from '../OrganizationSharingPanel.tsx?raw';+import organizationSharingCreateSectionSource from '../OrganizationSharingCreateSection.tsx?raw';+import organizationSharingLoadingStateSource from '../OrganizationSharingLoadingState.tsx?raw';+import organizationOutgoingSharesSectionSource from '../OrganizationOutgoingSharesSection.tsx?raw';+import organizationIncomingSharesSectionSource from '../OrganizationIncomingSharesSection.tsx?raw';+import organizationSharingStateSource from '../useOrganizationSharingPanelState.ts?raw';import organizationBillingPanelSource from '../OrganizationBillingPanel.tsx?raw';import proxmoxDeleteNodeDialogSource from '../ProxmoxDeleteNodeDialog.tsx?raw';import proxmoxConfiguredNodesTableSource from '../ProxmoxConfiguredNodesTable.tsx?raw';@@ -114,6 +119,11 @@ const extractedModules = ['../UpdateInstallGuide.tsx','../ReportingPanel.tsx','../reportingPanelModel.ts',+ '../OrganizationSharingCreateSection.tsx',+ '../OrganizationSharingLoadingState.tsx',+ '../OrganizationOutgoingSharesSection.tsx',+ '../OrganizationIncomingSharesSection.tsx',+ '../useOrganizationSharingPanelState.ts','../RBACFeatureGateSection.tsx','../RolesEditorDialog.tsx','../useRBACFeatureGateState.ts',@@ -370,6 +380,28 @@ describe('Settings architecture guardrails', () => {expect(proxmoxSettingsPanelStateSource).toContain("notificationStore.info('Refreshing discovery...'");});+ it('keeps organization sharing split into shell, state, and section owners', () => {+ expect(organizationSharingPanelSource).toContain('./useOrganizationSharingPanelState');+ expect(organizationSharingPanelSource).toContain('./OrganizationSharingLoadingState');+ expect(organizationSharingPanelSource).toContain('./OrganizationSharingCreateSection');+ expect(organizationSharingPanelSource).toContain('./OrganizationOutgoingSharesSection');+ expect(organizationSharingPanelSource).toContain('./OrganizationIncomingSharesSection');+ expect(organizationSharingPanelSource).not.toContain('const loadSharingData = async');+ expect(organizationSharingPanelSource).not.toContain('const createShare = async');+ expect(organizationSharingStateSource).toContain('OrgsAPI.createShare');+ expect(organizationSharingStateSource).toContain('OrgsAPI.deleteShare');+ expect(organizationSharingStateSource).toContain('normalizeOrgScope(getOrgID())');+ expect(organizationSharingCreateSectionSource).toContain('CANONICAL_RESOURCE_TYPES');+ expect(organizationSharingCreateSectionSource).toContain('ORGANIZATION_SHARE_ROLE_OPTIONS');+ expect(organizationOutgoingSharesSectionSource).toContain(+ 'getOrganizationOutgoingSharesEmptyState',+ );+ expect(organizationIncomingSharesSectionSource).toContain(+ 'getOrganizationIncomingSharesEmptyState',+ );+ expect(organizationSharingLoadingStateSource).toContain('animate-pulse');+ });+it('keeps RBAC settings panels split into gate, state, and dialog owners', () => {expect(rolesPanelSource).toContain('./RBACFeatureGateSection');expect(rolesPanelSource).toContain('./RolesEditorDialog');diff --git a/frontend-modern/src/components/Settings/useOrganizationSharingPanelState.ts b/frontend-modern/src/components/Settings/useOrganizationSharingPanelState.tsnew file mode 100644index 0000000000..ac67d26186--- /dev/null+++ b/frontend-modern/src/components/Settings/useOrganizationSharingPanelState.ts@@ -0,0 +1,324 @@+import { createEffect, createMemo, createSignal, onCleanup, onMount } from 'solid-js';+import {+ OrgsAPI,+ type IncomingOrganizationShare,+ type Organization,+ type OrganizationShare,+} from '@/api/orgs';+import { useResources } from '@/hooks/useResources';+import { eventBus } from '@/stores/events';+import { isMultiTenantEnabled } from '@/stores/license';+import { notificationStore } from '@/stores/notifications';+import { getOrgID } from '@/utils/apiClient';+import {+ INVALID_RESOURCE_TYPE_ERROR,+ isCanonicalResourceType,+ normalizeCanonicalResourceTypeInput,+} from '@/utils/canonicalResourceTypes';+import { logger } from '@/utils/logger';+import { normalizeOrgScope } from '@/utils/orgScope';+import { getPreferredResourceDisplayName } from '@/utils/resourceIdentity';+import type { ShareAccessRole } from '@/utils/organizationRolePresentation';+import {+ getOrganizationShareCreateErrorMessage,+ getOrganizationShareCreateSuccessMessage,+ getOrganizationShareDeleteErrorMessage,+ getOrganizationShareDeleteSuccessMessage,+ getOrganizationShareInvalidResourceMessage,+ getOrganizationShareResourceIdRequiredMessage,+ getOrganizationShareTargetOrgDifferentMessage,+ getOrganizationShareTargetOrgRequiredMessage,+ getOrganizationSettingsLoadErrorMessage,+} from '@/utils/organizationSettingsPresentation';+import { canManageOrg } from '@/utils/orgUtils';++interface OrganizationSharingPanelProps {+ currentUser?: string;+}++export type ResourceOption = {+ id: string;+ type: string;+ name: string;+};++export function useOrganizationSharingPanelState(props: OrganizationSharingPanelProps) {+ const [loading, setLoading] = createSignal(true);+ const [saving, setSaving] = createSignal(false);+ const [org, setOrg] = createSignal<Organization | null>(null);+ const [orgs, setOrgs] = createSignal<Organization[]>([]);+ const [outgoingShares, setOutgoingShares] = createSignal<OrganizationShare[]>([]);+ const [incomingShares, setIncomingShares] = createSignal<IncomingOrganizationShare[]>([]);+ const [targetOrgId, setTargetOrgId] = createSignal('');+ const [resourceType, setResourceType] = createSignal('');+ const [resourceId, setResourceId] = createSignal('');+ const [resourceName, setResourceName] = createSignal('');+ const [accessRole, setAccessRole] = createSignal<ShareAccessRole>('viewer');+ const [selectedQuickPick, setSelectedQuickPick] = createSignal('');+ const [manualEntryExpanded, setManualEntryExpanded] = createSignal(false);+ const [targetOrgError, setTargetOrgError] = createSignal('');+ const [resourceTypeError, setResourceTypeError] = createSignal('');+ const [resourceIdError, setResourceIdError] = createSignal('');++ const activeOrgId = () => normalizeOrgScope(getOrgID());+ const { resources } = useResources();++ const targetOrgOptions = createMemo(() =>+ orgs()+ .filter((candidate) => candidate.id !== activeOrgId())+ .sort((left, right) =>+ (left.displayName || left.id).localeCompare(right.displayName || right.id),+ ),+ );++ const unifiedResourceOptions = createMemo<ResourceOption[]>(() =>+ resources()+ .filter((resource) => resource.id && resource.type)+ .map((resource) => ({+ id: resource.id,+ type: resource.type,+ name: (getPreferredResourceDisplayName(resource) || resource.id).trim(),+ }))+ .sort((left, right) => left.name.localeCompare(right.name)),+ );++ const normalizedResourceType = createMemo(() =>+ normalizeCanonicalResourceTypeInput(resourceType()),+ );+ const normalizedResourceId = createMemo(() => resourceId().trim());+ const hasTargetOrg = createMemo(() => targetOrgId().trim() !== '');+ const hasQuickPickSelection = createMemo(() => selectedQuickPick().trim() !== '');+ const manualEntryValid = createMemo(+ () => isCanonicalResourceType(normalizedResourceType()) && normalizedResourceId() !== '',+ );+ const canCreateShare = createMemo(+ () => !saving() && hasTargetOrg() && (hasQuickPickSelection() || manualEntryValid()),+ );+ const canManageCurrentOrg = createMemo(() => canManageOrg(org(), props.currentUser));++ const orgNameById = createMemo(() => {+ const map = new Map<string, string>();+ for (const organization of orgs()) {+ map.set(organization.id, organization.displayName || organization.id);+ }+ return map;+ });++ createEffect(() => {+ if (unifiedResourceOptions().length > 0) return;+ setManualEntryExpanded(true);+ setSelectedQuickPick('');+ });++ const loadShares = async (orgId: string) => {+ const [outgoing, incoming] = await Promise.all([+ OrgsAPI.listShares(orgId),+ OrgsAPI.listIncomingShares(orgId),+ ]);+ setOutgoingShares(outgoing);+ setIncomingShares(incoming);+ };++ const loadSharingData = async () => {+ setLoading(true);+ try {+ const orgId = activeOrgId();+ const [orgData, memberData, allOrgs] = await Promise.all([+ OrgsAPI.get(orgId),+ OrgsAPI.listMembers(orgId),+ OrgsAPI.list(),+ ]);++ setOrg({ ...orgData, members: memberData });+ setOrgs(allOrgs);+ if (unifiedResourceOptions().length === 0) {+ setManualEntryExpanded(true);+ setSelectedQuickPick('');+ }++ await loadShares(orgId);++ const firstTarget =+ targetOrgId().trim() || allOrgs.find((candidate) => candidate.id !== orgId)?.id || '';+ setTargetOrgId(firstTarget);+ setTargetOrgError(firstTarget === '' ? getOrganizationShareTargetOrgRequiredMessage() : '');+ } catch (error) {+ logger.error('Failed to load organization sharing data', error);+ const message = error instanceof Error ? error.message : '';+ notificationStore.error(getOrganizationSettingsLoadErrorMessage(message, 'sharing'));+ } finally {+ setLoading(false);+ }+ };++ const applyResourceQuickPick = (value: string) => {+ setSelectedQuickPick(value);+ setResourceTypeError('');+ setResourceIdError('');+ if (!value) return;++ const [nextType, nextID] = value.split('::');+ const match = unifiedResourceOptions().find(+ (resource) => resource.id === (nextID ?? '') && resource.type === (nextType ?? ''),+ );+ if (!match) return;+ setResourceType(normalizeCanonicalResourceTypeInput(match.type));+ setResourceId(match.id);+ setResourceName(match.name);+ };++ const toggleManualEntry = () => {+ const expanding = !manualEntryExpanded();+ setManualEntryExpanded(expanding);+ setResourceTypeError('');+ setResourceIdError('');+ if (expanding) {+ setSelectedQuickPick('');+ }+ };++ const updateTargetOrg = (value: string) => {+ setTargetOrgId(value);+ setTargetOrgError(value.trim() === '' ? getOrganizationShareTargetOrgRequiredMessage() : '');+ };++ const updateResourceType = (value: string) => {+ setSelectedQuickPick('');+ setResourceType(value);+ const normalized = normalizeCanonicalResourceTypeInput(value);+ setResourceTypeError(+ normalized === '' || isCanonicalResourceType(normalized) ? '' : INVALID_RESOURCE_TYPE_ERROR,+ );+ };++ const updateResourceId = (value: string) => {+ setSelectedQuickPick('');+ setResourceId(value);+ setResourceIdError(value.trim() === '' ? getOrganizationShareResourceIdRequiredMessage() : '');+ };++ const updateResourceName = (value: string) => {+ setSelectedQuickPick('');+ setResourceName(value);+ };++ const createShare = async () => {+ const currentOrg = org();+ if (!currentOrg) return;++ const nextTargetOrgId = targetOrgId().trim();+ const nextResourceType = normalizedResourceType();+ const nextResourceId = normalizedResourceId();+ const nextResourceName = resourceName().trim();+ const hasQuickPick = hasQuickPickSelection();+ const hasValidManualType = isCanonicalResourceType(nextResourceType);+ const hasValidManualResourceId = nextResourceId !== '';++ setTargetOrgError(+ nextTargetOrgId === '' ? getOrganizationShareTargetOrgRequiredMessage() : '',+ );+ if (hasQuickPick) {+ setResourceTypeError('');+ setResourceIdError('');+ } else {+ setResourceTypeError(hasValidManualType ? '' : INVALID_RESOURCE_TYPE_ERROR);+ setResourceIdError(+ hasValidManualResourceId ? '' : getOrganizationShareResourceIdRequiredMessage(),+ );+ }++ if (!nextTargetOrgId) {+ notificationStore.error(getOrganizationShareTargetOrgRequiredMessage());+ return;+ }+ if (nextTargetOrgId === currentOrg.id) {+ notificationStore.error(getOrganizationShareTargetOrgDifferentMessage());+ return;+ }+ if (!hasQuickPick && (!hasValidManualType || !hasValidManualResourceId)) {+ notificationStore.error(getOrganizationShareInvalidResourceMessage());+ return;+ }++ setSaving(true);+ try {+ await OrgsAPI.createShare(currentOrg.id, {+ targetOrgId: nextTargetOrgId,+ resourceType: nextResourceType,+ resourceId: nextResourceId,+ resourceName: nextResourceName,+ accessRole: accessRole(),+ });+ notificationStore.success(getOrganizationShareCreateSuccessMessage());+ await loadShares(currentOrg.id);+ } catch (error) {+ logger.error('Failed to create organization share', error);+ notificationStore.error(+ getOrganizationShareCreateErrorMessage(error instanceof Error ? error.message : undefined),+ );+ } finally {+ setSaving(false);+ }+ };++ const deleteShare = async (share: OrganizationShare) => {+ const currentOrg = org();+ if (!currentOrg) return;+ if (!confirm(`Remove share for ${share.resourceType}:${share.resourceId}?`)) return;++ setSaving(true);+ try {+ await OrgsAPI.deleteShare(currentOrg.id, share.id);+ notificationStore.success(getOrganizationShareDeleteSuccessMessage());+ await loadShares(currentOrg.id);+ } catch (error) {+ logger.error('Failed to delete organization share', error);+ notificationStore.error(+ getOrganizationShareDeleteErrorMessage(error instanceof Error ? error.message : undefined),+ );+ } finally {+ setSaving(false);+ }+ };++ onMount(() => {+ if (!isMultiTenantEnabled()) return;+ void loadSharingData();++ const unsubscribe = eventBus.on('org_switched', () => {+ void loadSharingData();+ });+ onCleanup(unsubscribe);+ });++ return {+ accessRole,+ applyResourceQuickPick,+ canCreateShare,+ canManageCurrentOrg,+ createShare,+ deleteShare,+ incomingShares,+ loading,+ manualEntryExpanded,+ orgNameById,+ outgoingShares,+ resourceId,+ resourceIdError,+ resourceName,+ resourceType,+ resourceTypeError,+ saving,+ selectedQuickPick,+ setAccessRole,+ targetOrgError,+ targetOrgId,+ targetOrgOptions,+ toggleManualEntry,+ unifiedResourceOptions,+ updateResourceId,+ updateResourceName,+ updateResourceType,+ updateTargetOrg,+ };+}diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.tsindex 1a1f9ff700..ff8c83eda9 100644--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts@@ -285,7 +285,10 @@ import organizationAccessPanelSource from '@/components/Settings/OrganizationAccimport billingAdminPanelSource from '@/components/Settings/BillingAdminPanel.tsx?raw';import organizationBillingPanelSource from '@/components/Settings/OrganizationBillingPanel.tsx?raw';import organizationOverviewPanelSource from '@/components/Settings/OrganizationOverviewPanel.tsx?raw';-import organizationSharingPanelSource from '@/components/Settings/OrganizationSharingPanel.tsx?raw';+import organizationSharingCreateSectionSource from '@/components/Settings/OrganizationSharingCreateSection.tsx?raw';+import organizationOutgoingSharesSectionSource from '@/components/Settings/OrganizationOutgoingSharesSection.tsx?raw';+import organizationIncomingSharesSectionSource from '@/components/Settings/OrganizationIncomingSharesSection.tsx?raw';+import organizationSharingStateSource from '@/components/Settings/useOrganizationSharingPanelState.ts?raw';import organizationRolePresentationSource from '@/utils/organizationRolePresentation.ts?raw';import organizationSettingsPresentationSource from '@/utils/organizationSettingsPresentation.ts?raw';import rbacFeatureGateSectionSource from '@/components/Settings/RBACFeatureGateSection.tsx?raw';@@ -836,13 +839,14 @@ describe('frontend resource type boundaries', () => {expect(organizationAccessPanelSource).not.toContain('const roleOptions: Array<{ value: OrganizationRole; label: string }> = [',);- expect(organizationSharingPanelSource).toContain('@/utils/organizationRolePresentation');- expect(organizationSharingPanelSource).toContain('ORGANIZATION_SHARE_ROLE_OPTIONS');- expect(organizationSharingPanelSource).toContain('normalizeOrganizationShareRole');- expect(organizationSharingPanelSource).not.toContain(+ expect(organizationSharingCreateSectionSource).toContain('@/utils/organizationRolePresentation');+ expect(organizationSharingCreateSectionSource).toContain('ORGANIZATION_SHARE_ROLE_OPTIONS');+ expect(organizationOutgoingSharesSectionSource).toContain('normalizeOrganizationShareRole');+ expect(organizationIncomingSharesSectionSource).toContain('normalizeOrganizationShareRole');+ expect(organizationSharingCreateSectionSource).not.toContain('const accessRoleOptions: Array<{ value: ShareAccessRole; label: string }> = [',);- expect(organizationSharingPanelSource).not.toContain('const normalizeShareRole =');+ expect(organizationOutgoingSharesSectionSource).not.toContain('const normalizeShareRole =');expect(organizationRolePresentationSource).toContain('export const ORGANIZATION_MEMBER_ROLE_OPTIONS',);@@ -854,13 +858,13 @@ describe('frontend resource type boundaries', () => {);expect(organizationAccessPanelSource).toContain('normalizeOrgScope(getOrgID())');expect(organizationOverviewPanelSource).toContain('normalizeOrgScope(getOrgID())');- expect(organizationSharingPanelSource).toContain('normalizeOrgScope(getOrgID())');+ expect(organizationSharingStateSource).toContain('normalizeOrgScope(getOrgID())');expect(organizationBillingPanelSource).toContain('normalizeOrgScope(getOrgID())');expect(organizationAccessPanelSource).toContain('@/utils/organizationSettingsPresentation');expect(billingAdminPanelSource).toContain('@/utils/organizationSettingsPresentation');expect(billingAdminPanelSource).toContain('@/utils/licensePresentation');expect(organizationOverviewPanelSource).toContain('@/utils/organizationSettingsPresentation');- expect(organizationSharingPanelSource).toContain('@/utils/organizationSettingsPresentation');+ expect(organizationSharingStateSource).toContain('@/utils/organizationSettingsPresentation');expect(organizationBillingPanelSource).toContain('@/utils/organizationSettingsPresentation');expect(organizationBillingPanelSource).toContain('@/utils/licensePresentation');expect(organizationBillingPanelSource).not.toContain('Grace Period');@@ -871,30 +875,34 @@ describe('frontend resource type boundaries', () => {expect(organizationOverviewPanelSource).not.toContain('Multi-tenant is not enabled on this server',);- expect(organizationSharingPanelSource).not.toContain(+ expect(organizationSharingStateSource).not.toContain('Failed to load organization sharing details',);expect(organizationAccessPanelSource).toContain('getOrganizationAccessEmptyState');expect(organizationOverviewPanelSource).toContain('getOrganizationOverviewMembersEmptyState');- expect(organizationSharingPanelSource).toContain('getOrganizationOutgoingSharesEmptyState');- expect(organizationSharingPanelSource).toContain('getOrganizationIncomingSharesEmptyState');- expect(organizationSharingPanelSource).toContain(+ expect(organizationOutgoingSharesSectionSource).toContain(+ 'getOrganizationOutgoingSharesEmptyState',+ );+ expect(organizationIncomingSharesSectionSource).toContain(+ 'getOrganizationIncomingSharesEmptyState',+ );+ expect(organizationSharingStateSource).toContain('getOrganizationShareTargetOrgRequiredMessage',);- expect(organizationSharingPanelSource).toContain('getOrganizationShareCreateSuccessMessage');+ expect(organizationSharingStateSource).toContain('getOrganizationShareCreateSuccessMessage');expect(organizationAccessPanelSource).not.toContain('No organization members found.');expect(organizationOverviewPanelSource).not.toContain('No members found.');- expect(organizationSharingPanelSource).not.toContain('No outgoing shares configured.');- expect(organizationSharingPanelSource).not.toContain(+ expect(organizationOutgoingSharesSectionSource).not.toContain('No outgoing shares configured.');+ expect(organizationIncomingSharesSectionSource).not.toContain('No incoming shares from other organizations.',);- expect(organizationSharingPanelSource).not.toContain(+ expect(organizationSharingStateSource).not.toContain("notificationStore.error('Target organization is required')",);- expect(organizationSharingPanelSource).not.toContain(+ expect(organizationSharingStateSource).not.toContain("notificationStore.success('Resource shared successfully')",);- expect(organizationSharingPanelSource).not.toContain(+ expect(organizationSharingStateSource).not.toContain("notificationStore.success('Share removed')",);expect(organizationBillingPanelSource).not.toContain('This feature is not available.');diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.pyindex 7c9a7499d8..7b7c6a410c 100644--- a/scripts/release_control/subsystem_lookup_test.py+++ b/scripts/release_control/subsystem_lookup_test.py@@ -1839,6 +1839,60 @@ class SubsystemLookupTest(unittest.TestCase):],)+ def test_lookup_paths_assigns_organization_sharing_state_to_organization_settings(self) -> None:+ result = lookup_paths(+ ["frontend-modern/src/components/Settings/useOrganizationSharingPanelState.ts"]+ )+ self.assertEqual(result["unowned_runtime_files"], [])+ self.assertEqual(+ {item["subsystem"] for item in result["impacted_subsystems"]},+ {"organization-settings"},+ )+ file_entry = result["files"][0]+ self.assertEqual(file_entry["classification"], "runtime")+ self.assertEqual(+ {match["subsystem"] for match in file_entry["matches"]},+ {"organization-settings"},+ )+ match = file_entry["matches"][0]+ self.assertEqual(+ match["contract"],+ "docs/release-control/v6/internal/subsystems/organization-settings.md",+ )+ self.assertEqual(match["lane_context"]["lane_id"], "L14")+ self.assertEqual(+ match["verification_requirement"]["id"],+ "organization-settings-surface",+ )++ def test_lookup_paths_assigns_organization_outgoing_shares_section_to_organization_settings(+ self,+ ) -> None:+ result = lookup_paths(+ ["frontend-modern/src/components/Settings/OrganizationOutgoingSharesSection.tsx"]+ )+ self.assertEqual(result["unowned_runtime_files"], [])+ self.assertEqual(+ {item["subsystem"] for item in result["impacted_subsystems"]},+ {"organization-settings"},+ )+ file_entry = result["files"][0]+ self.assertEqual(file_entry["classification"], "runtime")+ self.assertEqual(+ {match["subsystem"] for match in file_entry["matches"]},+ {"organization-settings"},+ )+ match = file_entry["matches"][0]+ self.assertEqual(+ match["contract"],+ "docs/release-control/v6/internal/subsystems/organization-settings.md",+ )+ self.assertEqual(match["lane_context"]["lane_id"], "L14")+ self.assertEqual(+ match["verification_requirement"]["id"],+ "organization-settings-surface",+ )+def test_lookup_paths_assigns_roles_panel_to_organization_settings(self) -> None:result = lookup_paths(["frontend-modern/src/components/Settings/RolesPanel.tsx"])self.assertEqual(result["unowned_runtime_files"], [])