refactor(ui): unify registry lists and functional form labels
Device Core qualification / qualify (push) Successful in 8m18s

This commit is contained in:
DCCONSTRUCTIONS
2026-09-30 20:59:12 +03:00
parent b8d240a0a0
commit b3b0f900c5
4 changed files with 80 additions and 89 deletions
+3 -1
View File
@@ -58,7 +58,9 @@ platform runner registry is validated separately in `NODEDC_PLATFORM`.
The accepted Device Core policy is automatic deployment after a push to `main` The accepted Device Core policy is automatic deployment after a push to `main`
passes its checks. See [Continuous deployment](docs/CONTINUOUS_DEPLOYMENT.md) passes its checks. See [Continuous deployment](docs/CONTINUOUS_DEPLOYMENT.md)
for the pinned source qualification workflow, Synology setup and activation for the pinned source qualification workflow, Synology setup and activation
status. Automatic production installation is not enabled yet. status. Automatic production installation is active: the Synology controller fetches
qualified releases over outbound HTTPS and invokes the canonical runner.
No operator Mac or new inbound port is required.
Artifact builders in `infra/deploy-runner` emit data-only tarballs. They never Artifact builders in `infra/deploy-runner` emit data-only tarballs. They never
orchestrate Docker or mutate a live host. Promotion remains the established orchestrate Docker or mutate a live host. Promotion remains the established
+74 -83
View File
@@ -1,4 +1,4 @@
import { useEffect, useMemo, useRef, useState, type FormEvent, type ReactNode } from "react"; import { Children, isValidElement, useEffect, useMemo, useRef, useState, type FormEvent, type ReactNode } from "react";
import { import {
Button, Button,
ConfirmationModal, ConfirmationModal,
@@ -567,7 +567,7 @@ function HostsView({
actions={<> actions={<>
{canManageInfrastructure && (isB2(host) || (!host.managementCredentialConfigured && !topology.serviceInstances.some((item) => item.hostRef === host.hostRef))) ? <IconButton label={`Настройки ${host.displayName}`} onClick={() => setSettingsHost(host)}><Icon name="settings" /></IconButton> : null} {canManageInfrastructure && (isB2(host) || (!host.managementCredentialConfigured && !topology.serviceInstances.some((item) => item.hostRef === host.hostRef))) ? <IconButton label={`Настройки ${host.displayName}`} onClick={() => setSettingsHost(host)}><Icon name="settings" /></IconButton> : null}
<Button size="compact" onClick={() => onSelectHost(host.hostRef)}>Мониторинг</Button> <Button size="compact" onClick={() => onSelectHost(host.hostRef)}>Мониторинг</Button>
<IconButton label={`Сведения ${host.displayName}`} aria-expanded={expanded} onClick={() => setExpandedHost(expanded ? null : host.hostRef)}><Icon name="chevron-down" /></IconButton> <IconButton label={`Сведения ${host.displayName}`} aria-expanded={expanded} onClick={() => setExpandedHost(expanded ? null : host.hostRef)}><Icon name={expanded ? "chevron-up" : "chevron-down"} /></IconButton>
</>} /> </>} />
{expanded ? <SettingsCard title="Сведения о хосте"> {expanded ? <SettingsCard title="Сведения о хосте">
<CanonicalResourceList> <CanonicalResourceList>
@@ -1051,10 +1051,10 @@ function CommandsView({ workspace, canDispatch, onRefresh, onError }: {
<div className="device-control-command-policy"> <div className="device-control-command-policy">
<Icon name={enabled ? "check" : "lock"} /> <Icon name={enabled ? "check" : "lock"} />
<div> <div>
<strong>{enabled ? "Типизированный командный канал активен" : "Command transport выключен"}</strong> <strong>{enabled ? "Проверка сервиса устройства" : "Команды для этого канала недоступны"}</strong>
<p>{enabled <p>{enabled
? "Доступна только безопасная проверка сервиса. Произвольные команды, прошивка, очистка памяти и перезагрузка отсутствуют. Код устройства существует только в памяти Core до отправки или истечения TTL." ? "Выберите устройство и введите его шестизначный код."
: "Ни UI, ни BFF не имеют raw command builder. acknowledged означает подтверждение протокола, verified — отдельное доказательство состояния."}</p> : "Для этого подключения отправка команд ещё не настроена."}</p>
</div> </div>
<StatusBadge tone={enabled ? "success" : "warning"}>{workspace.policies.commandTransport}</StatusBadge> <StatusBadge tone={enabled ? "success" : "warning"}>{workspace.policies.commandTransport}</StatusBadge>
</div> </div>
@@ -1096,12 +1096,12 @@ function CommandsView({ workspace, canDispatch, onRefresh, onError }: {
</form> </form>
</div> </div>
) : null} ) : null}
<ResourceList empty="Command intents отсутствуют. Это не означает, что транспорт доступен."> <ResourceList empty="Команд пока нет">
{workspace.commands.map((command) => ( {workspace.commands.map((command) => (
<ResourceRow <ResourceRow
key={command.commandRef} key={command.commandRef}
title={`${command.commandType} · ${command.deviceName}`} title={`${command.commandType} · ${command.deviceName}`}
description={`${command.riskClass} · expires ${formatDate(command.expiresAt)}`} description={`${command.riskClass} · до ${formatDate(command.expiresAt)}`}
status={command.lifecycleState} status={command.lifecycleState}
trailing={command.terminalReasonCode || command.commandKey} trailing={command.terminalReasonCode || command.commandKey}
/> />
@@ -1163,11 +1163,6 @@ function SettingsView({ workspace, canConfigure, onCreateConfiguration }: {
}) { }) {
return ( return (
<ControlStack> <ControlStack>
<div className="device-control-policy-grid">
<PolicyCard label="Identifiers" value={workspace.policies.identifierProjection} />
<PolicyCard label="Audit payload" value={workspace.policies.auditPayloadProjection} />
<PolicyCard label="Command API" value={workspace.policies.commandPlanningApi} />
</div>
<ControlToolbar <ControlToolbar
copy="Настройки устройств" copy="Настройки устройств"
actions={canConfigure ? <Button variant="primary" onClick={onCreateConfiguration} disabled={!workspace.devices.length}>Новая версия настроек</Button> : null} actions={canConfigure ? <Button variant="primary" onClick={onCreateConfiguration} disabled={!workspace.devices.length}>Новая версия настроек</Button> : null}
@@ -1204,12 +1199,12 @@ function AdapterPackageDialog(props: DialogBaseProps) {
const [packageKey, setPackageKey] = useState(""); const [packageKey, setPackageKey] = useState("");
const [displayName, setDisplayName] = useState(""); const [displayName, setDisplayName] = useState("");
const [publisherRef, setPublisherRef] = useState(""); const [publisherRef, setPublisherRef] = useState("");
return <FormWindow {...props} id="adapter-package-form" title="Adapter package" submit={async () => { return <FormWindow {...props} id="adapter-package-form" title="Адаптер" submit={async () => {
await ensureAdapterPackage({ packageKey, displayName, publisherRef, lifecycleState: "active" }); await ensureAdapterPackage({ packageKey, displayName, publisherRef, lifecycleState: "active" });
}}> }}>
<KeyField label="Ключ пакета" value={packageKey} onChange={setPackageKey} /> <KeyField label="Ключ пакета" value={packageKey} onChange={setPackageKey} />
<TextField label="Название" value={displayName} onChange={(event) => setDisplayName(event.target.value)} required /> <TextField label="Название" value={displayName} onChange={(event) => setDisplayName(event.target.value)} required />
<TextField label="Publisher ref" value={publisherRef} onChange={(event) => setPublisherRef(event.target.value)} required /> <TextField label="Издатель" value={publisherRef} onChange={(event) => setPublisherRef(event.target.value)} required />
</FormWindow>; </FormWindow>;
} }
@@ -1236,12 +1231,12 @@ function AdapterVersionDialog({ packages, ...props }: DialogBaseProps & { packag
lifecycleState: "draft", lifecycleState: "draft",
}); });
}}> }}>
<Select label="Adapter package" value={packageRef} onChange={setPackageRef} options={packages.map((item) => ({ value: item.adapterPackageRef, label: item.displayName }))} /> <Select label="Адаптер" value={packageRef} onChange={setPackageRef} options={packages.map((item) => ({ value: item.adapterPackageRef, label: item.displayName }))} />
<TextField label="SemVer" value={version} onChange={(event) => setVersion(event.target.value)} required placeholder="1.0.0" /> <TextField label="SemVer" value={version} onChange={(event) => setVersion(event.target.value)} required placeholder="1.0.0" />
<TextField label="Runtime artifact ref" value={runtimeRef} onChange={(event) => setRuntimeRef(event.target.value)} required /> <TextField label="Файл адаптера" value={runtimeRef} onChange={(event) => setRuntimeRef(event.target.value)} required />
<TextField label="Content digest" value={digest} onChange={(event) => setDigest(event.target.value)} required placeholder="sha256:…" /> <TextField label="Контрольная сумма" value={digest} onChange={(event) => setDigest(event.target.value)} required placeholder="sha256:…" />
<TextField label="Contract version" value={contractVersion} onChange={(event) => setContractVersion(event.target.value)} required /> <TextField label="Версия контракта" value={contractVersion} onChange={(event) => setContractVersion(event.target.value)} required />
<TextField label="Capabilities" value={capabilities} onChange={(event) => setCapabilities(event.target.value)} description="Через запятую" /> <TextField label="Возможности" value={capabilities} onChange={(event) => setCapabilities(event.target.value)} description="Через запятую" />
</FormWindow>; </FormWindow>;
} }
@@ -1261,7 +1256,7 @@ function ModelProfileDialog({ versions, ...props }: DialogBaseProps & { versions
setVersionRef(versions[0]?.adapterVersionRef ?? ""); setVersionRef(versions[0]?.adapterVersionRef ?? "");
} }
}, [versionRef, versions]); }, [versionRef, versions]);
return <FormWindow {...props} id="model-profile-form" title="Model profile" disabled={!versionRef} submit={async () => { return <FormWindow {...props} id="model-profile-form" title="Профиль модели" disabled={!versionRef} submit={async () => {
await registerModelProfile({ await registerModelProfile({
adapterVersionRef: versionRef, adapterVersionRef: versionRef,
profileRef, profileRef,
@@ -1276,16 +1271,16 @@ function ModelProfileDialog({ versions, ...props }: DialogBaseProps & { versions
lifecycleState: "draft", lifecycleState: "draft",
}); });
}}> }}>
<Select label="Adapter version" value={versionRef} onChange={setVersionRef} options={versions.map((item) => ({ value: item.adapterVersionRef, label: item.version, description: item.runtimePackageRef }))} /> <Select label="Версия адаптера" value={versionRef} onChange={setVersionRef} options={versions.map((item) => ({ value: item.adapterVersionRef, label: item.version, description: item.runtimePackageRef }))} />
<TextField label="Profile ref" value={profileRef} onChange={(event) => setProfileRef(event.target.value)} required /> <TextField label="Идентификатор профиля" value={profileRef} onChange={(event) => setProfileRef(event.target.value)} required />
<TextField label="Schema version" value={schemaVersion} onChange={(event) => setSchemaVersion(event.target.value)} required /> <TextField label="Версия схемы" value={schemaVersion} onChange={(event) => setSchemaVersion(event.target.value)} required />
<TextField label="Vendor" value={vendor} onChange={(event) => setVendor(event.target.value)} required /> <TextField label="Производитель" value={vendor} onChange={(event) => setVendor(event.target.value)} required />
<TextField label="Model" value={model} onChange={(event) => setModel(event.target.value)} required /> <TextField label="Модель" value={model} onChange={(event) => setModel(event.target.value)} required />
<KeyField label="Device type" value={deviceType} onChange={setDeviceType} /> <KeyField label="Тип устройства" value={deviceType} onChange={setDeviceType} />
<TextField label="Protocol" value={protocol} onChange={(event) => setProtocol(event.target.value)} required /> <TextField label="Протокол" value={protocol} onChange={(event) => setProtocol(event.target.value)} required />
<TextField label="Schema artifact ref" value={schemaRef} onChange={(event) => setSchemaRef(event.target.value)} required /> <TextField label="Файл схемы" value={schemaRef} onChange={(event) => setSchemaRef(event.target.value)} required />
<TextField label="Profile digest" value={digest} onChange={(event) => setDigest(event.target.value)} required placeholder="sha256:…" /> <TextField label="Контрольная сумма профиля" value={digest} onChange={(event) => setDigest(event.target.value)} required placeholder="sha256:…" />
<TextField label="Capabilities" value={capabilities} onChange={(event) => setCapabilities(event.target.value)} /> <TextField label="Возможности" value={capabilities} onChange={(event) => setCapabilities(event.target.value)} />
</FormWindow>; </FormWindow>;
} }
@@ -1293,7 +1288,7 @@ function AssetDialog({ projectRef, ...props }: DialogBaseProps & { projectRef: s
const [assetKey, setAssetKey] = useState(""); const [assetKey, setAssetKey] = useState("");
const [displayName, setDisplayName] = useState(""); const [displayName, setDisplayName] = useState("");
const [assetTypeRef, setAssetTypeRef] = useState("asset-type:delivery-trike"); const [assetTypeRef, setAssetTypeRef] = useState("asset-type:delivery-trike");
return <FormWindow {...props} id="asset-form" title="Новый Asset" submit={async () => { return <FormWindow {...props} id="asset-form" title="Новый объект" submit={async () => {
await ensureAsset({ await ensureAsset({
projectRef, projectRef,
assetKey, assetKey,
@@ -1302,9 +1297,9 @@ function AssetDialog({ projectRef, ...props }: DialogBaseProps & { projectRef: s
lifecycleState: "active", lifecycleState: "active",
}); });
}}> }}>
<KeyField label="Asset key" value={assetKey} onChange={setAssetKey} /> <KeyField label="Код объекта" value={assetKey} onChange={setAssetKey} />
<TextField label="Название" value={displayName} onChange={(event) => setDisplayName(event.target.value)} required /> <TextField label="Название" value={displayName} onChange={(event) => setDisplayName(event.target.value)} required />
<TextField label="Asset type ref" value={assetTypeRef} onChange={(event) => setAssetTypeRef(event.target.value)} required description="Канонический тип или стабильная ссылка на тип, не модель трекера." /> <TextField label="Тип объекта" value={assetTypeRef} onChange={(event) => setAssetTypeRef(event.target.value)} required description="Канонический тип или стабильная ссылка на тип, не модель трекера." />
</FormWindow>; </FormWindow>;
} }
@@ -1322,7 +1317,7 @@ function AssetBindingDialog({ workspace, ...props }: DialogBaseProps & { workspa
setAssetRef(workspace.ontology.assets[0]?.assetRef ?? ""); setAssetRef(workspace.ontology.assets[0]?.assetRef ?? "");
} }
}, [assetRef, deviceRef, workspace]); }, [assetRef, deviceRef, workspace]);
return <FormWindow {...props} id="asset-binding-form" title="Привязать Device к Asset" disabled={!deviceRef || !assetRef} submit={async () => { return <FormWindow {...props} id="asset-binding-form" title="Привязать устройство к объекту" disabled={!deviceRef || !assetRef} submit={async () => {
await ensureAssetBinding({ await ensureAssetBinding({
projectRef: workspace.project.projectRef, projectRef: workspace.project.projectRef,
bindingKey, bindingKey,
@@ -1334,14 +1329,14 @@ function AssetBindingDialog({ workspace, ...props }: DialogBaseProps & { workspa
}); });
}}> }}>
<Select label="Устройство" value={deviceRef} onChange={setDeviceRef} options={workspace.devices.map((item) => ({ value: item.deviceRef, label: item.displayName, description: item.modelProfileRef }))} /> <Select label="Устройство" value={deviceRef} onChange={setDeviceRef} options={workspace.devices.map((item) => ({ value: item.deviceRef, label: item.displayName, description: item.modelProfileRef }))} />
<Select label="Asset" value={assetRef} onChange={setAssetRef} options={workspace.ontology.assets.map((item) => ({ value: item.assetRef, label: item.displayName, description: item.assetTypeRef }))} /> <Select label="Объект" value={assetRef} onChange={setAssetRef} options={workspace.ontology.assets.map((item) => ({ value: item.assetRef, label: item.displayName, description: item.assetTypeRef }))} />
<KeyField label="Binding key" value={bindingKey} onChange={setBindingKey} /> <KeyField label="Код связи" value={bindingKey} onChange={setBindingKey} />
<Select label="Relation" value={bindingKind} onChange={setBindingKind} options={[ <Select label="Тип связи" value={bindingKind} onChange={setBindingKind} options={[
{ value: "tracking", label: "Tracking" }, { value: "tracking", label: "Tracking" },
{ value: "installed", label: "Installed" }, { value: "installed", label: "Installed" },
{ value: "assigned", label: "Assigned" }, { value: "assigned", label: "Assigned" },
]} /> ]} />
<TextField label="Provenance ref" value={provenanceRef} onChange={(event) => setProvenanceRef(event.target.value)} required /> <TextField label="Источник сведений" value={provenanceRef} onChange={(event) => setProvenanceRef(event.target.value)} required />
</FormWindow>; </FormWindow>;
} }
@@ -1400,7 +1395,7 @@ function EndpointDialog({ workspace, initialHostRef, ...props }: DialogBaseProps
{ value: "monitoring", label: "Monitoring" }, { value: "monitoring", label: "Monitoring" },
{ value: "service", label: "Service" }, { value: "service", label: "Service" },
]} /> ]} />
<TextField label="Адрес" value={endpointUri} onChange={(event) => setEndpointUri(event.target.value)} required placeholder="ssh://203.0.113.10:22/" description="HTTPS, SSH или TCP. URI с userinfo, query или fragment будет отклонён." /> <TextField label="Адрес" value={endpointUri} onChange={(event) => setEndpointUri(event.target.value)} required placeholder="ssh://203.0.113.10:22/" description="HTTPS, SSH или TCP, без паролей и параметров запроса." />
</FormWindow>; </FormWindow>;
} }
@@ -1426,10 +1421,10 @@ function DeploymentDialog({ workspace, initialHostRef, ...props }: DialogBasePro
}); });
}}> }}>
<Select label="VPS" value={hostRef} onChange={setHostRef} options={hosts.map((item) => ({ value: item.hostRef, label: item.displayName }))} /> <Select label="VPS" value={hostRef} onChange={setHostRef} options={hosts.map((item) => ({ value: item.hostRef, label: item.displayName }))} />
<KeyField label="Deployment key" value={deploymentKey} onChange={setDeploymentKey} /> <KeyField label="Код развёртывания" value={deploymentKey} onChange={setDeploymentKey} />
<TextField label="Название" value={displayName} onChange={(event) => setDisplayName(event.target.value)} required /> <TextField label="Название" value={displayName} onChange={(event) => setDisplayName(event.target.value)} required />
<TextField label="Artifact ref" value={artifactRef} onChange={(event) => setArtifactRef(event.target.value)} required placeholder="artifact:device-edge/1.0.0" /> <TextField label="Файл сборки" value={artifactRef} onChange={(event) => setArtifactRef(event.target.value)} required placeholder="artifact:device-edge/1.0.0" />
<TextField label="Artifact digest" value={artifactDigest} onChange={(event) => setArtifactDigest(event.target.value)} required placeholder="sha256:…" /> <TextField label="Контрольная сумма сборки" value={artifactDigest} onChange={(event) => setArtifactDigest(event.target.value)} required placeholder="sha256:…" />
</FormWindow>; </FormWindow>;
} }
@@ -1461,21 +1456,21 @@ function ServiceInstanceDialog({ workspace, initialHostRef, ...props }: DialogBa
}); });
}}> }}>
<Select label="VPS" value={hostRef} onChange={setHostRef} options={hosts.map((item) => ({ value: item.hostRef, label: item.displayName }))} /> <Select label="VPS" value={hostRef} onChange={setHostRef} options={hosts.map((item) => ({ value: item.hostRef, label: item.displayName }))} />
<Select label="Deployment" value={deploymentRef} onChange={setDeploymentRef} options={matchingDeployments.map((item) => ({ value: item.deploymentRef, label: item.displayName }))} /> <Select label="Развёртывание" value={deploymentRef} onChange={setDeploymentRef} options={matchingDeployments.map((item) => ({ value: item.deploymentRef, label: item.displayName }))} />
<Select label="Edge role" value={edgeRef} onChange={setEdgeRef} options={[ <Select label="Узел приёма данных" value={edgeRef} onChange={setEdgeRef} options={[
{ value: "", label: "Без Edge registration" }, { value: "", label: "Без привязки к узлу" },
...workspace.edges.map((item) => ({ value: item.edgeRef, label: item.displayName, description: item.channel.runtimeState })), ...workspace.edges.map((item) => ({ value: item.edgeRef, label: item.displayName, description: item.channel.runtimeState })),
]} /> ]} />
<KeyField label="Service key" value={serviceKey} onChange={setServiceKey} /> <KeyField label="Код сервиса" value={serviceKey} onChange={setServiceKey} />
<TextField label="Название" value={displayName} onChange={(event) => setDisplayName(event.target.value)} required /> <TextField label="Название" value={displayName} onChange={(event) => setDisplayName(event.target.value)} required />
<TextField label="Service role" value={serviceRole} onChange={(event) => setServiceRole(event.target.value.toLowerCase())} required placeholder="device.edge" /> <TextField label="Роль сервиса" value={serviceRole} onChange={(event) => setServiceRole(event.target.value.toLowerCase())} required placeholder="device.edge" />
</FormWindow>; </FormWindow>;
} }
function HealthObservationDialog({ workspace, ...props }: DialogBaseProps & { workspace: ProjectWorkspace }) { function HealthObservationDialog({ workspace, ...props }: DialogBaseProps & { workspace: ProjectWorkspace }) {
const targets = [ const targets = [
...workspace.ontology.hosts.map((item) => ({ value: `host|${item.hostRef}`, label: item.displayName, description: "Host" })), ...workspace.ontology.hosts.map((item) => ({ value: `host|${item.hostRef}`, label: item.displayName, description: "Хост" })),
...workspace.ontology.serviceInstances.map((item) => ({ value: `service-instance|${item.serviceInstanceRef}`, label: item.displayName, description: "Service instance" })), ...workspace.ontology.serviceInstances.map((item) => ({ value: `service-instance|${item.serviceInstanceRef}`, label: item.displayName, description: "Сервис" })),
]; ];
const [target, setTarget] = useState(targets[0]?.value ?? ""); const [target, setTarget] = useState(targets[0]?.value ?? "");
const [observedState, setObservedState] = useState<"reachable" | "degraded" | "unreachable">("reachable"); const [observedState, setObservedState] = useState<"reachable" | "degraded" | "unreachable">("reachable");
@@ -1484,7 +1479,7 @@ function HealthObservationDialog({ workspace, ...props }: DialogBaseProps & { wo
useEffect(() => { useEffect(() => {
if (!targets.some((item) => item.value === target)) setTarget(targets[0]?.value ?? ""); if (!targets.some((item) => item.value === target)) setTarget(targets[0]?.value ?? "");
}, [target, targets]); }, [target, targets]);
return <FormWindow {...props} id="health-observation-form" title="Health evidence" disabled={!target} submit={async () => { return <FormWindow {...props} id="health-observation-form" title="Записать состояние" disabled={!target} submit={async () => {
const [subjectKind, subjectRef] = target.split("|"); const [subjectKind, subjectRef] = target.split("|");
const observedAt = new Date(); const observedAt = new Date();
const ttl = Number(ttlMinutes); const ttl = Number(ttlMinutes);
@@ -1501,15 +1496,15 @@ function HealthObservationDialog({ workspace, ...props }: DialogBaseProps & { wo
expiresAt: new Date(observedAt.valueOf() + ttl * 60_000).toISOString(), expiresAt: new Date(observedAt.valueOf() + ttl * 60_000).toISOString(),
}); });
}}> }}>
<Select label="Subject" value={target} onChange={setTarget} options={targets} /> <Select label="Объект" value={target} onChange={setTarget} options={targets} />
<Select label="Observed state" value={observedState} onChange={setObservedState} options={[ <Select label="Состояние" value={observedState} onChange={setObservedState} options={[
{ value: "reachable", label: "Reachable" }, { value: "reachable", label: "Доступен" },
{ value: "degraded", label: "Degraded" }, { value: "degraded", label: "Работает с ошибками" },
{ value: "unreachable", label: "Unreachable" }, { value: "unreachable", label: "Недоступен" },
]} /> ]} />
<TextField label="TTL, минут" value={ttlMinutes} onChange={(event) => setTtlMinutes(event.target.value)} required inputMode="numeric" /> <TextField label="Действует, минут" value={ttlMinutes} onChange={(event) => setTtlMinutes(event.target.value)} required inputMode="numeric" />
<TextAreaField label="Bounded evidence JSON" value={evidence} onChange={(event) => setEvidence(event.target.value)} required /> <TextAreaField label="Данные наблюдения JSON" value={evidence} onChange={(event) => setEvidence(event.target.value)} required />
<p className="device-manager-card-copy">Это ручное наблюдение с TTL. Автоматический probe должен писать тот же canonical contract от собственного source ref.</p> <p className="device-manager-card-copy">Состояние действует до указанного срока.</p>
</FormWindow>; </FormWindow>;
} }
@@ -1520,9 +1515,9 @@ function EdgeDialog(props: DialogBaseProps) {
return <FormWindow {...props} id="edge-form" title="Новый узел" submit={async () => { return <FormWindow {...props} id="edge-form" title="Новый узел" submit={async () => {
await ensureEdge({ edgeKey, displayName, deploymentRef: deploymentRef || null, lifecycleState: "provisioning" }); await ensureEdge({ edgeKey, displayName, deploymentRef: deploymentRef || null, lifecycleState: "provisioning" });
}}> }}>
<KeyField label="Edge key" value={edgeKey} onChange={setEdgeKey} /> <KeyField label="Код узла" value={edgeKey} onChange={setEdgeKey} />
<TextField label="Название" value={displayName} onChange={(event) => setDisplayName(event.target.value)} required /> <TextField label="Название" value={displayName} onChange={(event) => setDisplayName(event.target.value)} required />
<TextField label="Deployment ref" value={deploymentRef} onChange={(event) => setDeploymentRef(event.target.value)} description="Opaque artifact/deployment reference, не адрес и не credential." /> <TextField label="Ссылка на развёртывание" value={deploymentRef} onChange={(event) => setDeploymentRef(event.target.value)} description="" />
</FormWindow>; </FormWindow>;
} }
@@ -1554,12 +1549,12 @@ function RouteDialog({ workspace, ...props }: DialogBaseProps & { workspace: Pro
lifecycleState: "draft", lifecycleState: "draft",
}); });
}}> }}>
<KeyField label="Route key" value={routeKey} onChange={setRouteKey} /> <KeyField label="Код маршрута" value={routeKey} onChange={setRouteKey} />
<TextField label="Название" value={displayName} onChange={(event) => setDisplayName(event.target.value)} required /> <TextField label="Название" value={displayName} onChange={(event) => setDisplayName(event.target.value)} required />
<Select label="Edge" value={edgeRef} onChange={setEdgeRef} options={workspace.edges.map((item) => ({ value: item.edgeRef, label: item.displayName, description: item.lifecycleState }))} /> <Select label="Узел приёма данных" value={edgeRef} onChange={setEdgeRef} options={workspace.edges.map((item) => ({ value: item.edgeRef, label: item.displayName, description: item.lifecycleState }))} />
<Select label="Model profile" value={profileRef} onChange={setProfileRef} options={workspace.modelProfiles.map((item) => ({ value: item.modelProfileRef, label: `${item.vendor} ${item.model}`, description: item.protocol }))} /> <Select label="Профиль модели" value={profileRef} onChange={setProfileRef} options={workspace.modelProfiles.map((item) => ({ value: item.modelProfileRef, label: `${item.vendor} ${item.model}`, description: item.protocol }))} />
<TextField label="Listener ref" value={listenerRef} onChange={(event) => setListenerRef(event.target.value)} required /> <TextField label="Канал приёма" value={listenerRef} onChange={(event) => setListenerRef(event.target.value)} required />
<p className="device-manager-card-copy">Маршрут создаётся draft. Его activation остаётся отдельным осознанным изменением данных.</p> <p className="device-manager-card-copy">После создания маршрут можно активировать в списке.</p>
</FormWindow>; </FormWindow>;
} }
@@ -1579,7 +1574,7 @@ function BindingDialog({ workspace, ...props }: DialogBaseProps & { workspace: P
setSourceValue(sources[0]?.value ?? ""); setSourceValue(sources[0]?.value ?? "");
} }
}, [sourceValue, sources]); }, [sourceValue, sources]);
return <FormWindow {...props} id="binding-form" title="Новый data binding" disabled={!sourceValue} submit={async () => { return <FormWindow {...props} id="binding-form" title="Новая связь с приложением" disabled={!sourceValue} submit={async () => {
const [kind, ref] = sourceValue.split("|"); const [kind, ref] = sourceValue.split("|");
await ensureDeviceBinding({ await ensureDeviceBinding({
projectRef: workspace.project.projectRef, projectRef: workspace.project.projectRef,
@@ -1591,12 +1586,12 @@ function BindingDialog({ workspace, ...props }: DialogBaseProps & { workspace: P
capabilities: commaList(capabilities), capabilities: commaList(capabilities),
}); });
}}> }}>
<Select label="Source" value={sourceValue} onChange={setSourceValue} options={sources} /> <Select label="Источник" value={sourceValue} onChange={setSourceValue} options={sources} />
<KeyField label="Binding key" value={bindingKey} onChange={setBindingKey} /> <KeyField label="Код связи" value={bindingKey} onChange={setBindingKey} />
<TextField label="Название" value={displayName} onChange={(event) => setDisplayName(event.target.value)} required /> <TextField label="Название" value={displayName} onChange={(event) => setDisplayName(event.target.value)} required />
<TextField label="Target kind" value={targetKind} onChange={(event) => setTargetKind(event.target.value)} required placeholder="foundry.application" /> <TextField label="Тип приложения" value={targetKind} onChange={(event) => setTargetKind(event.target.value)} required placeholder="foundry.application" />
<TextField label="Target ref" value={targetRef} onChange={(event) => setTargetRef(event.target.value)} required /> <TextField label="Идентификатор приложения" value={targetRef} onChange={(event) => setTargetRef(event.target.value)} required />
<TextField label="Capabilities" value={capabilities} onChange={(event) => setCapabilities(event.target.value)} description="observe, inspect, configure, command" required /> <TextField label="Возможности" value={capabilities} onChange={(event) => setCapabilities(event.target.value)} description="observe, inspect, configure, command" required />
</FormWindow>; </FormWindow>;
} }
@@ -1606,7 +1601,7 @@ function GrantDialog({ projectRef, ...props }: DialogBaseProps & { projectRef: s
const [role, setRole] = useState("viewer"); const [role, setRole] = useState("viewer");
const [allow, setAllow] = useState(""); const [allow, setAllow] = useState("");
const [deny, setDeny] = useState(""); const [deny, setDeny] = useState("");
return <FormWindow {...props} id="grant-form" title="Project access" submit={async () => { return <FormWindow {...props} id="grant-form" title="Доступ к проекту" submit={async () => {
await upsertProjectGrant({ await upsertProjectGrant({
projectRef, projectRef,
principalKind, principalKind,
@@ -1617,11 +1612,11 @@ function GrantDialog({ projectRef, ...props }: DialogBaseProps & { projectRef: s
lifecycleState: "active", lifecycleState: "active",
}); });
}}> }}>
<Select label="Principal type" value={principalKind} onChange={setPrincipalKind} options={[{ value: "user", label: "User" }, { value: "group", label: "Group" }]} /> <Select label="Кому предоставить доступ" value={principalKind} onChange={setPrincipalKind} options={[{ value: "user", label: "Пользователь" }, { value: "group", label: "Группа" }]} />
<TextField label="Principal ref" value={principalRef} onChange={(event) => setPrincipalRef(event.target.value)} required /> <TextField label="Идентификатор пользователя или группы" value={principalRef} onChange={(event) => setPrincipalRef(event.target.value)} required />
<Select label="Project role" value={role} onChange={setRole} options={["viewer", "operator", "engineer", "admin", "owner"].map((value) => ({ value, label: value, disabled: value === "owner" && principalKind === "group" }))} /> <Select label="Роль в проекте" value={role} onChange={setRole} options={["viewer", "operator", "engineer", "admin", "owner"].map((value) => ({ value, label: value, disabled: value === "owner" && principalKind === "group" }))} />
<TextField label="Capability allow" value={allow} onChange={(event) => setAllow(event.target.value)} description="Опциональные точечные добавления" /> <TextField label="Дополнительные разрешения" value={allow} onChange={(event) => setAllow(event.target.value)} description="Опциональные точечные добавления" />
<TextField label="Capability deny" value={deny} onChange={(event) => setDeny(event.target.value)} description="Deny имеет приоритет" /> <TextField label="Запреты" value={deny} onChange={(event) => setDeny(event.target.value)} description="Запреты имеют приоритет" />
</FormWindow>; </FormWindow>;
} }
@@ -1712,7 +1707,7 @@ function ControlSection({ title, count, children }: { title: string; count: numb
function ResourceGrid({ children, empty }: { children: ReactNode; empty: string }) { function ResourceGrid({ children, empty }: { children: ReactNode; empty: string }) {
const hasChildren = Array.isArray(children) ? children.length > 0 : Boolean(children); const hasChildren = Array.isArray(children) ? children.length > 0 : Boolean(children);
return hasChildren ? <div className="device-control-resource-grid">{children}</div> : <div className="device-manager-panel-empty">{empty}</div>; return hasChildren ? <CanonicalResourceList>{Children.toArray(children).map((child, index) => <li key={isValidElement(child) ? child.key ?? index : index}>{child}</li>)}</CanonicalResourceList> : <div className="device-manager-panel-empty">{empty}</div>;
} }
function ResourceCard({ eyebrow, title, description, status, meta, action = null }: { eyebrow: string; title: string; description: string; status: string; meta: string[]; action?: ReactNode }) { function ResourceCard({ eyebrow, title, description, status, meta, action = null }: { eyebrow: string; title: string; description: string; status: string; meta: string[]; action?: ReactNode }) {
@@ -1727,7 +1722,7 @@ function ResourceCard({ eyebrow, title, description, status, meta, action = null
function ResourceList({ children, empty }: { children: ReactNode; empty: string }) { function ResourceList({ children, empty }: { children: ReactNode; empty: string }) {
const hasChildren = Array.isArray(children) ? children.length > 0 : Boolean(children); const hasChildren = Array.isArray(children) ? children.length > 0 : Boolean(children);
return hasChildren ? <div className="device-manager-entity-list">{children}</div> : <div className="device-manager-panel-empty">{empty}</div>; return hasChildren ? <CanonicalResourceList>{Children.toArray(children).map((child, index) => <li key={isValidElement(child) ? child.key ?? index : index}>{child}</li>)}</CanonicalResourceList> : <div className="device-manager-panel-empty">{empty}</div>;
} }
function ResourceRow({ title, description, status, trailing }: { title: string; description: string; status: string; trailing: ReactNode }) { function ResourceRow({ title, description, status, trailing }: { title: string; description: string; status: string; trailing: ReactNode }) {
@@ -1737,10 +1732,6 @@ function ResourceRow({ title, description, status, trailing }: { title: string;
actions={typeof trailing === "string" ? undefined : trailing} />; actions={typeof trailing === "string" ? undefined : trailing} />;
} }
function PolicyCard({ label, value }: { label: string; value: string }) {
return <div><small>{label}</small><strong>{value}</strong></div>;
}
function commaList(value: string) { function commaList(value: string) {
return [...new Set(value.split(",").map((item) => item.trim()).filter(Boolean))].sort(); return [...new Set(value.split(",").map((item) => item.trim()).filter(Boolean))].sort();
} }
+2 -2
View File
@@ -100,7 +100,7 @@ const sectionNavigation: Record<PrimarySection, NavigationItem[]> = {
], ],
infrastructure: [ infrastructure: [
{ id: "hosts", label: "VPS и хосты", icon: "building", capability: "telemetry.observe" }, { id: "hosts", label: "VPS и хосты", icon: "building", capability: "telemetry.observe" },
{ id: "infrastructure", label: "Edges и маршруты", icon: "globe", capability: "telemetry.observe" }, { id: "infrastructure", label: "Узлы и маршруты", icon: "globe", capability: "telemetry.observe" },
{ id: "catalog", label: "Модели и адаптеры", icon: "database", capability: "project.read" }, { id: "catalog", label: "Модели и адаптеры", icon: "database", capability: "project.read" },
], ],
management: [ management: [
@@ -942,7 +942,7 @@ function ProjectSettingsDialog({ open, workspace, presentation, onClose, onSaved
avatarUrl: iconPreview ?? undefined, avatarUrl: iconPreview ?? undefined,
}} }}
sections={[ sections={[
{ id: "identity", label: "Идентичность", icon: "profile", group: "Проект" }, { id: "identity", label: "Основное", icon: "profile", group: "Проект" },
{ id: "media", label: "Медиа", icon: "image", group: "Оформление" }, { id: "media", label: "Медиа", icon: "image", group: "Оформление" },
]} ]}
activeSection={section} activeSection={section}
+1 -3
View File
@@ -121,9 +121,7 @@
} }
.device-control-form { .device-control-form {
max-height: min(62vh, 680px); min-width: 0;
overflow-y: auto;
padding-right: 3px;
} }
.infrastructure-system-workspace { .infrastructure-system-workspace {