feat(device-manager): align functional UI with Mission Core interaction patterns
Device Core qualification / qualify (push) Successful in 8m53s
Device Core qualification / qualify (push) Successful in 8m53s
This commit is contained in:
@@ -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 (
|
||||
<>
|
||||
<ApplicationShell
|
||||
@@ -493,14 +491,6 @@ export function DeviceManagerApp() {
|
||||
expanded={shell.contentExpanded}
|
||||
onExpandedChange={shell.setContentExpanded}
|
||||
onClose={shell.closeView}
|
||||
headerTools={activeView === "inventory" && selectedInventoryDevice && inventoryDetail ? (
|
||||
<DeviceDetailHeaderTools
|
||||
device={selectedInventoryDevice}
|
||||
detail={inventoryDetail}
|
||||
canEdit={canConfigure || canManageProject}
|
||||
onDetailChange={setInventoryDetail}
|
||||
/>
|
||||
) : 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 (
|
||||
<GlassSurface className="device-manager-metric" padding="md" tone="soft">
|
||||
<span>{label}</span>
|
||||
<strong>{value}</strong>
|
||||
<StatusBadge tone={tone}>{detail}</StatusBadge>
|
||||
</GlassSurface>
|
||||
<SettingsCard title={label}>
|
||||
<ResourceRow title={String(value)} metadata={detail} status={<StatusBadge variant="indicator" tone={tone} aria-label={label} />} />
|
||||
</SettingsCard>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -846,7 +834,7 @@ function ProjectView({ selectedHostRef, onSelectHost, view, workspace, canManage
|
||||
if (view === "collections") return (
|
||||
<div className="device-manager-stack">
|
||||
<div className="device-manager-panel-toolbar">
|
||||
<p>Коллекции группируют устройства для последующих bindings и задач.</p>
|
||||
<p>Группы устройств проекта.</p>
|
||||
<Button icon={<Icon name="plus" />} disabled={!canManageCollections} onClick={onCreateCollection}>Новая коллекция</Button>
|
||||
</div>
|
||||
<EntityList
|
||||
@@ -863,9 +851,9 @@ function ProjectView({ selectedHostRef, onSelectHost, view, workspace, canManage
|
||||
);
|
||||
return (
|
||||
<div className="device-manager-overview-grid">
|
||||
<Metric label="Устройства" value={workspace.devices.length} detail="inventory" />
|
||||
<Metric label="Quarantine" value={workspace.discoveries.filter((item) => item.lifecycleState === "quarantine").length} detail="safe projection" />
|
||||
<Metric label="Коллекции" value={workspace.collections.length} detail="bindings ready" />
|
||||
<Metric label="Устройства" value={workspace.devices.length} detail="В реестре" />
|
||||
<Metric label="Ожидают проверки" value={workspace.discoveries.filter((item) => item.lifecycleState === "quarantine").length} detail="Обнаружены" />
|
||||
<Metric label="Коллекции" value={workspace.collections.length} detail="Группы устройств" />
|
||||
<SettingsCard title="Права проекта" description={workspace.project.access.projectRole || "read"}>
|
||||
<div className="device-manager-capabilities">
|
||||
{workspace.project.access.capabilities.map((capability) => <StatusBadge key={capability}>{capability}</StatusBadge>)}
|
||||
@@ -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 <div className="device-manager-panel-empty">{empty}</div>;
|
||||
return <div className="device-manager-entity-list">{items.map((item) => (
|
||||
<GlassSurface key={item.id} className="device-manager-entity" padding="md" tone="soft">
|
||||
<span className="device-manager-entity__icon"><Icon name="circle" /></span>
|
||||
<span className="device-manager-entity__body"><strong>{item.title}</strong><small>{item.subtitle}</small></span>
|
||||
<StatusBadge tone={item.tone}>{item.status}</StatusBadge>
|
||||
</GlassSurface>
|
||||
))}</div>;
|
||||
return <ResourceList>{items.map((item) => <li key={item.id}><ResourceRow
|
||||
icon={<Icon name="folder" />} title={item.title} description={item.subtitle}
|
||||
status={<StatusBadge tone={item.tone}>{item.status}</StatusBadge>} /></li>)}</ResourceList>;
|
||||
}
|
||||
|
||||
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 <Window open={open} title="Новый Device Project" subtitle={ownerScope?.displayName || "Owner scope недоступен"} onClose={onClose} footer={
|
||||
return <Window open={open} title="Новый проект" subtitle={ownerScope?.displayName || "Компания недоступна"} onClose={onClose} footer={
|
||||
<WindowFooterActions><Button variant="ghost" onClick={onClose}>Отмена</Button><Button type="submit" form="device-project-form" variant="primary" disabled={pending || !ownerScope}>{pending ? "Создаём…" : "Создать"}</Button></WindowFooterActions>
|
||||
}>
|
||||
<form id="device-project-form" className="device-manager-form" onSubmit={submit}>
|
||||
@@ -1373,7 +1357,6 @@ function ClaimDialog({ enrollment, project, onClose, onClaimed, onError }: {
|
||||
<form id="device-claim-form" className="device-manager-form" onSubmit={submit}>
|
||||
<TextField label="Название устройства" value={name} onChange={(event) => setName(event.target.value)} required maxLength={160} />
|
||||
<TextField label="Ключ устройства" value={key} onChange={(event) => setKey(event.target.value.toLowerCase())} required pattern="[a-z][a-z0-9-]{1,62}" />
|
||||
<p className="device-manager-card-copy">Claim использует только ссылки на enrollment и discovery. Исходный идентификатор не запрашивается повторно.</p>
|
||||
</form>
|
||||
</Window>;
|
||||
}
|
||||
@@ -1452,7 +1435,6 @@ function EnrollmentDialog({ open, workspace, onClose, onCreated, onError }: {
|
||||
<TextField label="Ключ enrollment" value={key} onChange={(event) => setKey(event.target.value.toLowerCase())} required pattern="[a-z][a-z0-9-]{1,62}" />
|
||||
<TextField label="IMEI" value={imei} onChange={(event) => setImei(event.target.value.replace(/\D/g, "").slice(0, 15))} required pattern="[0-9]{15}" inputMode="numeric" autoComplete="off" />
|
||||
<TextField label="Истекает" type="datetime-local" value={expiresAt} onChange={(event) => setExpiresAt(event.target.value)} description="Опционально. Время будет сохранено в UTC." />
|
||||
<p className="device-manager-card-copy">IMEI передаётся один раз по HTTPS в Device Control Core. В базе, audit и ответе останутся только HMAC и маска.</p>
|
||||
</form>
|
||||
</Window>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user