From b8d240a0a0d270af0c4700e6dd9b1a39e41b7c55 Mon Sep 17 00:00:00 2001 From: DCCONSTRUCTIONS Date: Wed, 30 Sep 2026 20:53:19 +0300 Subject: [PATCH] feat(device-manager): align functional UI with Mission Core interaction patterns --- .../device-manager-presentation.test.mjs | 2 +- .../device-manager/src/DeviceControlViews.tsx | 118 ++++++------ .../src/DeviceInventoryView.tsx | 120 +++--------- apps/device-manager/src/DeviceManagerApp.tsx | 44 ++--- apps/device-manager/src/b2/B2HostSettings.tsx | 173 +++++++++--------- apps/device-manager/src/b2/api.ts | 4 +- apps/device-manager/src/b2/b2.css | 3 + apps/device-manager/src/styles.css | 68 +------ docs/DEVICE_CORE_UI_CONTRACT.md | 40 ++++ infra/ci/sources.lock.json | 2 +- .../src/b2/infrastructure.mjs | 31 +++- .../test/b2-infrastructure.test.mjs | 41 ++++- 12 files changed, 309 insertions(+), 337 deletions(-) create mode 100644 docs/DEVICE_CORE_UI_CONTRACT.md diff --git a/apps/device-manager/server/device-manager-presentation.test.mjs b/apps/device-manager/server/device-manager-presentation.test.mjs index fc9e9f9..ab43803 100644 --- a/apps/device-manager/server/device-manager-presentation.test.mjs +++ b/apps/device-manager/server/device-manager-presentation.test.mjs @@ -122,7 +122,6 @@ test("host hardware monitoring retains the established geometry", async () => { ".infrastructure-host-relations {", "grid-template-columns: repeat(3, minmax(0, 1fr));", "grid-template-columns: repeat(4, minmax(0, 1fr));", - "background: var(--infrastructure-panel-soft);", ".host-monitoring-series polyline {", "stroke: var(--nodedc-text-primary);", ".host-monitoring-hardware-facts {", @@ -134,6 +133,7 @@ test("host hardware monitoring retains the established geometry", async () => { assert.ok(!infrastructureSource.includes('title="Deployments и endpoints"')); assert.ok(!infrastructureSource.includes("ceiling={100}")); assert.ok(!infrastructureSource.includes("Канонический ontology catalog")); + assert.ok(!styles.includes("background: var(--infrastructure-panel-soft);"), "Functional panels must not add nested black surfaces"); assert.ok(!styles.includes(".host-telemetry-metric,")); assert.ok(!styles.includes(".host-telemetry-facts")); }); diff --git a/apps/device-manager/src/DeviceControlViews.tsx b/apps/device-manager/src/DeviceControlViews.tsx index 3f1cee4..150e481 100644 --- a/apps/device-manager/src/DeviceControlViews.tsx +++ b/apps/device-manager/src/DeviceControlViews.tsx @@ -4,7 +4,6 @@ import { ConfirmationModal, ResourceList as CanonicalResourceList, ResourceRow as CanonicalResourceRow, - GlassSurface, Icon, IconButton, Select, @@ -365,15 +364,15 @@ function CatalogView({ workspace, canManage, onCreatePackage, onCreateVersion, o return ( : null} /> - - + + {workspace.modelProfiles.map((profile) => ( - + {workspace.adapterVersions.map((version) => ( - - + + {workspace.adapterPackages.map((adapterPackage) => ( - {canManageCatalog ? : null} + {canManageCatalog ? : null} {canManageRoutes ? : null} } /> - + {workspace.routes.map((route) => ( - - + + {workspace.edges.map((edge) => ( - +
Данные о дисках ещё не поступили.
: null} -
+
{networkInterfaces.map((item, index) => ( - +
{item.interface ?? "Интерфейс"}{formatPackets(item.packetsReceived, item.packetsSent)}
Получено
{formatMetricBytes(item.bytesReceived)}
@@ -701,7 +700,7 @@ function HostTelemetryWorkspace({
Ошибки RX / TX
{formatNullable(item.errorsReceived)} / {formatNullable(item.errorsSent)}
Потери RX / TX
{formatNullable(item.droppedReceived)} / {formatNullable(item.droppedSent)}
- +
))} ) :
Сетевые счётчики ещё не поступили.
} @@ -718,7 +717,7 @@ function HostTelemetryWorkspace({ {runtimeServices.length ? (
{runtimeServices.map((service, index) => ( - +
SYSTEMD UNIT

{service.name ?? "systemd unit"}

{service.subState ?? "—"}
{service.activeState ?? "unknown"} @@ -729,7 +728,7 @@ function HostTelemetryWorkspace({
Перезапуски
{formatNullable(service.restarts)}
PID
{formatNullable(service.pid)}
- +
))}
) :
Состояние сервисов ещё не поступило.
} @@ -964,8 +963,8 @@ function formatPackets(received: number | null | undefined, sent: number | null function SessionsView({ workspace }: { workspace: ProjectWorkspace }) { return ( - - + + {workspace.sessions.map((session) => ( Новый binding : null} + copy="Передача данных в приложения" + actions={canManage ? : null} /> - + {workspace.bindings.map((binding) => ( - +
{enabled ? "Типизированный командный канал активен" : "Command transport выключен"} @@ -1058,9 +1057,9 @@ function CommandsView({ workspace, canDispatch, onRefresh, onError }: { : "Ни UI, ни BFF не имеют raw command builder. acknowledged означает подтверждение протокола, verified — отдельное доказательство состояния."}

{workspace.policies.commandTransport} - +
{enabled ? ( - +
({ value: item.deviceRef, label: item.displayName, description: item.modelProfileRef }))} /> + ({ value: item.assetRef, label: item.displayName, description: item.assetTypeRef }))} /> ({ value: item.deviceRef, label: item.displayName, description: item.modelProfileRef }))} /> - setConfiguration(event.target.value)} required /> - setSummary(event.target.value)} /> -

Secret-like keys и значения будут отклонены Core. Сохранение desired не выставляет applied.

+ ({ - value: section.id, - label: section.label, - }))} - onChange={(sectionId) => onDetailChange({ ...detail, sectionId })} - placement="bottom-end" - minMenuWidth={320} - menuWidth="anchor" - variant="split" - /> - onDetailChange({ - ...detail, - editing: !detail.editing, - })} - > - - -
- ); -} - export function DeviceInventoryView({ workspace, canClaim, @@ -155,27 +109,14 @@ export function DeviceInventoryView({ return () => window.clearInterval(timer); }, [detail?.deviceRef, onError, onPoll]); - if (selectedDevice && detail) { - return ( - onDetailChange(null)} - /> - ); - } const remoteRows = (b2.data?.items || []).filter(() => !['pending', 'archived', 'active', 'inactive'].includes(statusFilter)) .sort((a, b) => a.name.localeCompare(b.name, 'ru')); const count = workspace.devices.filter((device) => !['suspended', 'retired'].includes(device.lifecycleState)).length + (b2.data?.items.length || 0); return (
+ {selectedDevice && detail ? onDetailChange(null)} /> : null} { if (!archiving) setArchiveTarget(null); }} onConfirm={async () => { if (!archiveTarget || archiving) return; setArchiving(true); @@ -225,10 +166,10 @@ export function DeviceInventoryView({ icon={} title={device.displayName} metadata={`${profileLabel(workspace, device)} · ${deviceIdentifierDisplayValue(device) || 'IMEI не назначен'}`} description={lastSeenAt ? formatDate(lastSeenAt) : undefined} status={{device.lifecycleState === 'suspended' ? 'В архиве' : online ? 'Онлайн' : 'Не в сети'}} - actions={<> onDetailChange({ deviceRef: device.deviceRef, sectionId: getDeviceProfileCatalog(device.modelProfileRef).sections[0]?.id ?? 'passport', editing: false })}> + actions={<> onDetailChange({ deviceRef: device.deviceRef, sectionId: getDeviceProfileCatalog(device.modelProfileRef).sections[0]?.id ?? 'passport', editing: false })}> {canManageProject && !online ? : null}} />)} : null} - {statusFilter !== 'pending' && !deviceRows.length && !remoteRows.length ?

{!b2.data && !b2.error ? 'Загрузка устройств…' : b2.error || b2.data?.hosts.some((host) => !host.reachable) ? 'Реестр VPS недоступен' : statusFilter === 'archived' ? 'Архив пуст' : count ? 'Нет устройств с таким состоянием' : 'В проекте пока нет устройств'}

: null} + {statusFilter !== 'pending' && !deviceRows.length && !remoteRows.length ?

{!b2.data && !b2.error ? 'Загрузка устройств…' : b2.error || b2.data?.hosts.some((host) => !host.reachable) ? 'Реестр VPS недоступен' : statusFilter === 'archived' ? 'Архив пуст' : count ? 'Нет устройств с таким состоянием' : 'В проекте пока нет устройств'}

: null} {(statusFilter === "pending" || statusFilter === "all" && pendingEnrollments.length > 0) ? (
@@ -254,9 +195,9 @@ export function DeviceInventoryView({

После первого пакета устройство можно принять в реестр. Исходный идентификатор в интерфейсе не раскрывается.

)) : ( - +
Нет ожидающих подключений. - +
)}
) : null} @@ -407,35 +348,21 @@ function DeviceDetailView({ }; return ( -
-
- - - -
- {catalog.vendor} · {catalog.model} -

{device.displayName}

-

{identifierDisplayValue || "Идентификатор не назначен"} · {device.modelProfileRef}

-
- - {session?.lifecycleState === "online" ? "Онлайн" : session?.lifecycleState || device.lifecycleState} - -
- -
- - - -
- - + ({ id: section.id, label: section.label }))} + activeSection={activeSection.id} onSectionChange={(sectionId) => onDetailChange({ ...detail, sectionId })} onClose={onBack} + headerActions={<> void onSaved().catch(onError)}> + {(canConfigure || canManageProject) ? onDetailChange({ ...detail, editing: !detail.editing })}> : null}}> +
+
Состояние связи{session?.lifecycleState || device.session?.state || "Нет сессии"}
Маршрут{session?.routeName || "Не определён"}
Протокол{session?.protocol || profile?.protocol || "Нет данных"}
Последняя активность{formatDate(session?.lastSeenAt || device.session?.lastSeenAt)}
Пакеты{session?.frameCount ?? 0}
Подключено{formatDate(session?.connectedAt)}
- +
@@ -465,7 +392,7 @@ function DeviceDetailView({ ? draftValues[item.path] : readPath(context, item.path); return ( - +
{editable && item.valueKind === "boolean" ? ( {item.description} : null} )} - +
); })}
@@ -524,14 +451,15 @@ function DeviceDetailView({ ) : null}
- Desired + Запрошенная конфигурация {configurationState?.desiredConfigurationRevisionRef || "Не задано"} - Applied + Подтверждена устройством {configurationState?.appliedConfigurationRevisionRef || "Не подтверждено"}
+ ); } @@ -604,12 +532,12 @@ function AccessNotice({ commandTransport: ProjectWorkspace["policies"]["commandTransport"]; }) { if (access === "read-only") { - return Этот блок отражает фактическое состояние устройства и не редактируется.; + return
Этот блок отражает фактическое состояние устройства и не редактируется.
; } if (access === "protected") { - return Операция требует отдельного подтверждения. Обновление прошивки пилотного B2 запрещено.; + return
Операция требует отдельного подтверждения. Обновление прошивки пилотного B2 запрещено.
; } - return {commandTransport === "typed-service-ping-v1" ? "Изменение создаёт новую desired-ревизию. Статус Applied появится только после подтверждения устройством." : "Настройка поддерживается моделью, но запись включится только после запуска двустороннего командного канала."}; + return
{commandTransport === "typed-service-ping-v1" ? "Изменение создаёт новую desired-ревизию. Статус Applied появится только после подтверждения устройством." : "Настройка поддерживается моделью, но запись включится только после запуска двустороннего командного канала."}
; } function latestSession(workspace: ProjectWorkspace, device: DeviceView): SessionView | null { diff --git a/apps/device-manager/src/DeviceManagerApp.tsx b/apps/device-manager/src/DeviceManagerApp.tsx index 489f878..c0f97ec 100644 --- a/apps/device-manager/src/DeviceManagerApp.tsx +++ b/apps/device-manager/src/DeviceManagerApp.tsx @@ -9,6 +9,8 @@ import { Dropdown, FeatureSettingsWindow, GlassSurface, + ResourceList, + ResourceRow, HeaderNavigation, HeaderProfile, HeaderWorkspace, @@ -61,7 +63,6 @@ import { type ControlViewId, } from "./DeviceControlViews"; import { - DeviceDetailHeaderTools, DeviceInventoryView, type DeviceInventoryDetailState, } from "./DeviceInventoryView"; @@ -348,9 +349,6 @@ export function DeviceManagerApp() { } const activeView = visibleNavigationItems.some((item) => item.id === shell.activeView) ? shell.activeView : null; - const selectedInventoryDevice = inventoryDetail - ? workspace?.devices.find((device) => device.deviceRef === inventoryDetail.deviceRef) ?? null - : null; return ( <> - ) : undefined} utilityActions={[...(activeView === "hosts" && selectedHostRef ? [{ label: "Вернуться к VPS и хостам", icon: "chevron-left" as const, onClick: () => setSelectedHostRef(null), }] : []), { @@ -791,11 +781,9 @@ function EnvironmentBackdrop({ function Metric({ label, value, detail, tone = "neutral" }: { label: string; value: number; detail: string; tone?: "neutral" | "success" | "warning" }) { return ( - - {label} - {value} - {detail} - + + } /> + ); } @@ -846,7 +834,7 @@ function ProjectView({ selectedHostRef, onSelectHost, view, workspace, canManage if (view === "collections") return (
-

Коллекции группируют устройства для последующих bindings и задач.

+

Группы устройств проекта.

- - item.lifecycleState === "quarantine").length} detail="safe projection" /> - + + item.lifecycleState === "quarantine").length} detail="Обнаружены" /> +
{workspace.project.access.capabilities.map((capability) => {capability})} @@ -1253,13 +1241,9 @@ function EnvironmentSettingsDialog({ open, presentation, onClose, onSaved, onErr function EntityList({ items, empty }: { items: Array<{ id: string; title: string; subtitle: string; status: string; tone: "neutral" | "success" | "warning" }>; empty: string }) { if (!items.length) return
{empty}
; - return
{items.map((item) => ( - - - {item.title}{item.subtitle} - {item.status} - - ))}
; + return {items.map((item) =>
  • } title={item.title} description={item.subtitle} + status={{item.status}} />
  • )}
    ; } function ProjectDialog({ open, ownerScopes, initialOwnerRef, onClose, onCreated, onError }: { @@ -1299,7 +1283,7 @@ function ProjectDialog({ open, ownerScopes, initialOwnerRef, onClose, onCreated, await onCreated(); } catch (reason) { onError(reason); } finally { setPending(false); } }; - return }> @@ -1373,7 +1357,6 @@ function ClaimDialog({ enrollment, project, onClose, onClaimed, onError }: { setName(event.target.value)} required maxLength={160} /> setKey(event.target.value.toLowerCase())} required pattern="[a-z][a-z0-9-]{1,62}" /> -

    Claim использует только ссылки на enrollment и discovery. Исходный идентификатор не запрашивается повторно.

    ; } @@ -1452,7 +1435,6 @@ function EnrollmentDialog({ open, workspace, onClose, onCreated, onError }: { setKey(event.target.value.toLowerCase())} required pattern="[a-z][a-z0-9-]{1,62}" /> setImei(event.target.value.replace(/\D/g, "").slice(0, 15))} required pattern="[0-9]{15}" inputMode="numeric" autoComplete="off" /> setExpiresAt(event.target.value)} description="Опционально. Время будет сохранено в UTC." /> -

    IMEI передаётся один раз по HTTPS в Device Control Core. В базе, audit и ответе останутся только HMAC и маска.

    ; } diff --git a/apps/device-manager/src/b2/B2HostSettings.tsx b/apps/device-manager/src/b2/B2HostSettings.tsx index eef6da5..8697f88 100644 --- a/apps/device-manager/src/b2/B2HostSettings.tsx +++ b/apps/device-manager/src/b2/B2HostSettings.tsx @@ -1,12 +1,11 @@ import { useEffect, useRef, useState } from 'react'; -import { Button, FeatureSettingsWindow, Icon, IconButton, Select, SettingsCard, StatusBadge, TextField, TextAreaField, WindowFooterActions, ConfirmationModal, ResourceList, ResourceRow } from '@nodedc/ui-react'; +import { Button, FeatureSettingsWindow, Icon, IconButton, Select, SettingsCard, StatusBadge, TextField, TextAreaField, ConfirmationModal, ResourceList, ResourceRow } from '@nodedc/ui-react'; import { loadProjects } from '../api'; import type { InfrastructureHostView, ProjectSummary, ProjectWorkspace } from '../types'; -import { b2Request, type B2Status } from './api'; +import { b2Request, type B2Status, type B2Application } from './api'; import './b2.css'; type Section = 'connection' | 'contours'; -type Form = 'contour' | 'application' | 'project' | null; export function B2HostSettings({ host, workspace, onClose, onChanged, onError }: { host: InfrastructureHostView; workspace: ProjectWorkspace; onClose: () => void; onChanged: () => Promise; onError: (error: unknown) => void; @@ -15,117 +14,119 @@ export function B2HostSettings({ host, workspace, onClose, onChanged, onError }: const [section, setSection] = useState
    ('contours'); const [status, setStatus] = useState(null); const [pending, setPending] = useState('load'); - const [connection, setConnection] = useState(''); + const [connection, setConnection] = useState(''), [importOpen, setImportOpen] = useState(false); const connectionFile = useRef(null); - const [key, setKey] = useState(''), [name, setName] = useState(''); - const [contourId, setContourId] = useState(''), [applicationId, setApplicationId] = useState(''); - const [form, setForm] = useState
    (null); - const [showHistory, setShowHistory] = useState(false), [showInactive, setShowInactive] = useState(false); - const [targetProject, setTargetProject] = useState(project.projectRef); const [projects, setProjects] = useState([]); - const [issued, setIssued] = useState(''); + const [expanded, setExpanded] = useState([]), [keyRows, setKeyRows] = useState([]); + const [creating, setCreating] = useState(''), [name, setName] = useState(''); + const [creationIntent, setCreationIntent] = useState<{ id: string; name: string } | null>(null); + const [history, setHistory] = useState([]); + const [issued, setIssued] = useState<{ application: string; value: string } | null>(null); const [confirm, setConfirm] = useState<{ action: string; fields: Record; text: string } | null>(null); - const request = (action: string, data: Record = {}) => b2Request(project.projectRef, host.hostRef, action, data); + const request = (action: string, data: Record = {}, requestId?: string) => b2Request(project.projectRef, host.hostRef, action, data, requestId); const refresh = () => request('status').then(setStatus); useEffect(() => { let active = true; Promise.all([request('status'), loadProjects()]).then(([value, available]) => { if (!active) return; - setStatus(value); if (!value.connected) setSection('connection'); + setStatus(value); if (!value.connected) { setSection('connection'); setImportOpen(true); } setProjects(available.filter((item) => item.ownerScope.ownerScopeRef === project.ownerScope.ownerScopeRef)); }).catch((error) => { if (active) onError(error); }).finally(() => { if (active) setPending(''); }); return () => { active = false; }; }, [host.hostRef, project.projectRef]); - async function run(action: string, data: Record = {}) { + async function run(action: string, data: Record = {}, requestId?: string) { setPending(action); try { - const result = await request<{ connection?: unknown; id?: string }>(action, data); - if (result.connection) setIssued(JSON.stringify(result.connection, null, 2)); - if (action === 'connect') { setConnection(''); setSection('contours'); } - if (action === 'contour-create' && result.id) { setContourId(result.id); setApplicationId(''); } - if (action === 'application-create' && result.id) setApplicationId(result.id); - setForm(null); setName(''); setKey(''); - // A successful mutation must not be presented as failed if a subsequent read fails. + const result = await request<{ connection?: unknown; id?: string }>(action, data, requestId); + if (result.connection) setIssued({ application: String(data.name || name || 'Приложение'), value: JSON.stringify(result.connection, null, 2) }); + if (action === 'connect') { setConnection(''); setImportOpen(false); setSection('contours'); } + setCreating(''); setName(''); setCreationIntent(null); try { await refresh(); await onChanged(); } catch (error) { onError(error); } return true; - } catch (error) { onError(error); return false; } finally { setPending(''); } + } catch (error) { onError(error); await refresh().catch(() => undefined); return false; } finally { setPending(''); } } - const contours = status?.contours || [], selected = contours.find((item) => item.id === contourId); - const linkedProject = status?.links?.find((item) => item.contourId === contourId)?.projectRef; - const applications = (status?.applications || []).filter((app) => app.authority !== 'host' && app.key !== 'legacy-mission-core' && app.grants[contourId]); - const application = applications.find((app) => app.id === applicationId); - const inactive = (app: typeof applications[number]) => app.credentials.length > 0 && !app.credentials.some((item) => item.enabled); const busy = Boolean(pending), canManage = status?.authority === 'host'; - const begin = (value: Form) => { setForm(value); setName(''); setKey(''); setTargetProject(project.projectRef); }; - const back = () => { - setIssued(''); setShowHistory(false); - if (form) setForm(null); else if (applicationId) setApplicationId(''); else { setContourId(''); setShowInactive(false); } - }; + const toggle = (items: string[], id: string) => items.includes(id) ? items.filter((value) => value !== id) : [...items, id]; function downloadIssuedKey() { - const url = URL.createObjectURL(new Blob([issued + '\n'], { type: 'application/json' })); + if (!issued) return; + const url = URL.createObjectURL(new Blob([issued.value + '\n'], { type: 'application/json' })); const link = document.createElement('a'); link.href = url; link.download = 'arnavi-application-key.json'; document.body.append(link); link.click(); link.remove(); window.setTimeout(() => URL.revokeObjectURL(url), 1000); } + function applicationRow(app: B2Application) { + const legacy = app.key === 'legacy-mission-core'; + const open = keyRows.includes(app.id), active = app.credentials.some((item) => item.enabled); + return
  • + setKeyRows(toggle(keyRows, app.id))}> : undefined} /> + {open && !legacy ?
    + {app.credentials.filter((item) => item.enabled || history.includes(app.id)).map((item) =>
  • {item.client_id}} metadata="ID ключа" + status={{item.enabled ? 'Действует' : 'Отозван'}} + actions={item.enabled && canManage ? : undefined} />
  • )} +
    + {app.credentials.some((item) => !item.enabled) ? : null} + {canManage ? : null} +
    +
    : null} + ; + } return <> { setSection(value); setForm(null); setIssued(''); }} onClose={onClose} - footer={ - {section === 'contours' && (selected || form) ? : null} - { - setPending('refresh'); try { await refresh(); } catch (error) { onError(error); } finally { setPending(''); } - }}> - }> + sections={[{ id: 'connection', label: 'Сервер', icon: 'network' }, { id: 'contours', label: 'Контуры', icon: 'layers', disabled: !status?.connected }]} + activeSection={section} onSectionChange={setSection} onClose={onClose} + headerActions={ { + setPending('refresh'); try { await refresh(); } catch (error) { onError(error); } finally { setPending(''); } + }}>}>
    + {issued ?
    + +
    +
    : null} {section === 'connection' ? <> - {status?.connected ? 'Подключён' : pending === 'load' ? 'Подключение…' : 'Не подключён'}} /> - -
    - - { - const file = event.currentTarget.files?.[0]; event.currentTarget.value = ''; if (!file) return; setPending('file'); - try { if (file.size > 16384) throw new Error(); const text = await file.text(); JSON.parse(text); setConnection(text); } - catch { onError(new Error('Не удалось прочитать файл ключа VPS.')); } finally { setPending(''); } - }} /> - setConnection(event.target.value)} rows={4} /> - -
    -
    - : null} - {section === 'contours' ? <> -
    {[host.displayName, selected?.name, application?.name].filter(Boolean).join(' / ')}
    - {form === 'contour' || form === 'application' ? -
    - {form === 'application' ? : null} - setName(e.target.value)} /> - setKey(e.target.value.toLowerCase())} /> -
    -
    -
    : form === 'project' ?
    - { + const file = event.currentTarget.files?.[0]; event.currentTarget.value = ''; if (!file) return; setPending('file'); + try { if (file.size > 16384) throw new Error(); const text = await file.text(); JSON.parse(text); setConnection(text); } + catch { onError(new Error('Не удалось прочитать файл доступа.')); } finally { setPending(''); } + }} /> + setConnection(event.target.value)} rows={4} /> +
    +
    : null} : null} + {section === 'contours' ? {projects.map((item) => { + const links = (status?.links || []).filter((link) => link.projectRef === item.projectRef); + const linked = links.length > 0, open = expanded.includes(item.projectRef); + const apps = (status?.applications || []).filter((app) => app.authority !== 'host' && links.some((link) => app.grants[link.contourId])); + const available = (status?.contours || []).filter((contour) => !status?.links?.some((link) => link.contourId === contour.id)); + return
  • + setExpanded(toggle(expanded, item.projectRef))}>} /> + {open ?
    + {!linked ? <> + {canManage ? : null} + {available.length ?