diff --git a/apps/device-manager/src/DeviceControlViews.tsx b/apps/device-manager/src/DeviceControlViews.tsx index 433576f..2e65272 100644 --- a/apps/device-manager/src/DeviceControlViews.tsx +++ b/apps/device-manager/src/DeviceControlViews.tsx @@ -1,4 +1,5 @@ import { Children, isValidElement, useEffect, useMemo, useRef, useState, type FormEvent, type ReactNode } from "react"; +import { auditEventLabel, capabilityLabel, projectRoleLabel } from './presentationLabels'; import { Button, ConfirmationModal, @@ -1056,7 +1057,6 @@ function CommandsView({ workspace, canDispatch, onRefresh, onError }: { ? "Выберите устройство и введите его шестизначный код." : "Для этого подключения отправка команд ещё не настроена."}

- {workspace.policies.commandTransport} {enabled ? (
@@ -1119,10 +1119,10 @@ function AuditView({ workspace }: { workspace: ProjectWorkspace }) { {workspace.auditEvents.map((event) => ( ))} @@ -1146,9 +1146,9 @@ function AccessView({ workspace, canManage, onCreate }: { )[grant.principalKind] || grant.principalKind} · ${projectRoleLabel(grant.projectRole)}`} status={grant.lifecycleState} - trailing={grant.capabilityDeny.length ? `deny: ${grant.capabilityDeny.join(", ")}` : "Права роли"} + trailing={grant.capabilityDeny.length ? `Исключения: ${grant.capabilityDeny.map(capabilityLabel).join(", ")}` : "Права роли"} /> ))} @@ -1727,7 +1727,7 @@ function ResourceList({ children, empty }: { children: ReactNode; empty: string function ResourceRow({ title, description, status, trailing }: { title: string; description: string; status: string; trailing: ReactNode }) { return } statusPlacement="leading" + status={} statusPlacement="leading" metadata={[statusLabel(status), typeof trailing === "string" ? trailing : null].filter(Boolean).join(" · ")} actions={typeof trailing === "string" ? undefined : trailing} />; } diff --git a/apps/device-manager/src/DeviceManagerApp.tsx b/apps/device-manager/src/DeviceManagerApp.tsx index 7045caa..1583785 100644 --- a/apps/device-manager/src/DeviceManagerApp.tsx +++ b/apps/device-manager/src/DeviceManagerApp.tsx @@ -58,6 +58,8 @@ import type { ProjectWorkspace, } from "./types"; import { EnvironmentMediaPlaylistEditor } from "./EnvironmentMediaPlaylistEditor"; +import { useB2Inventory } from "./b2/useB2Inventory"; +import { capabilityLabel, projectRoleLabel } from "./presentationLabels"; import { DeviceControlView, type ControlViewId, @@ -779,14 +781,6 @@ function EnvironmentBackdrop({ ); } -function Metric({ label, value, detail, tone = "neutral" }: { label: string; value: number; detail: string; tone?: "neutral" | "success" | "warning" }) { - return ( - - } /> - - ); -} - function ProjectView({ selectedHostRef, onSelectHost, view, workspace, canManageCollections, canClaim, canConfigure, canManageProject, inventoryDetail, session, onRefresh, onPoll, onError, onCreateCollection, onClaim, onInventoryDetailChange }: { selectedHostRef: string | null; onSelectHost: (hostRef: string | null) => void; @@ -849,16 +843,28 @@ function ProjectView({ selectedHostRef, onSelectHost, view, workspace, canManage />
); + return ; +} + +function ProjectOverview({ workspace }: { workspace: ProjectWorkspace }) { + const b2 = useB2Inventory(workspace.project.projectRef, workspace); + const [showPermissions, setShowPermissions] = useState(false); + const incomplete = !b2.data || b2.data.hosts.some((host) => !host.reachable); + const deviceCount = incomplete ? null : workspace.devices.filter((device) => !['suspended', 'retired'].includes(device.lifecycleState)).length + b2.data!.items.length; + const deviceDetail = !incomplete ? 'В реестре' : (b2.error || b2.data) ? 'Данные VPS недоступны' : 'Загрузка…'; + const metrics = [ + { label: 'Устройства', value: deviceCount, detail: deviceDetail }, + { label: 'Ожидают проверки', value: workspace.discoveries.filter((item) => item.lifecycleState === 'quarantine').length, detail: 'Обнаружены' }, + { label: 'Коллекции', value: workspace.collections.length, detail: 'Группы устройств' }, + ]; return (
- - item.lifecycleState === "quarantine").length} detail="Обнаружены" /> - - -
- {workspace.project.access.capabilities.map((capability) => {capability})} -
-
+ {metrics.map((metric) =>
  • {metric.value ?? '—'}} />
  • )}
    + setShowPermissions(!showPermissions)}>} /> + {showPermissions ?
    + {workspace.project.access.capabilities.map((capability) =>
  • )} +
    : null}
    ); } @@ -1460,11 +1466,11 @@ function viewTitle(view: ViewId) { collections: "Коллекции", catalog: "Модели и адаптеры", hosts: "VPS и хосты", - infrastructure: "Edges и маршруты", - sessions: "Gateway sessions", - bindings: "Data bindings", - commands: "Command ledger", - audit: "Immutable audit", + infrastructure: "Узлы и маршруты", + sessions: "Подключения устройств", + bindings: "Связи с Foundry", + commands: "Команды", + audit: "Аудит", access: "Доступ к проекту", settings: "Настройки и конфигурации", })[view]; diff --git a/apps/device-manager/src/b2/B2HostSettings.tsx b/apps/device-manager/src/b2/B2HostSettings.tsx index 8697f88..507dd33 100644 --- a/apps/device-manager/src/b2/B2HostSettings.tsx +++ b/apps/device-manager/src/b2/B2HostSettings.tsx @@ -116,7 +116,7 @@ export function B2HostSettings({ host, workspace, onClose, onChanged, onError }: {apps.map(applicationRow)} {!apps.length && creating !== item.projectRef ?

    Ключи приложений ещё не выданы

    : null} {creating === item.projectRef ?
    - setName(event.target.value)} /> + setName(event.target.value)} />