Simplify device status display and bump client versions
Build and Deploy Gateway / build-and-push (push) Successful in 13s
Build and Deploy Gateway / deploy (push) Successful in 7s

This commit is contained in:
2026-08-07 16:33:02 +03:00
parent 560c243047
commit 9f31eaf396
4 changed files with 23 additions and 60 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
export const HARBOR_VERSIONS = Object.freeze({ export const HARBOR_VERSIONS = Object.freeze({
macClient: '0.12.0', macClient: '0.12.1',
gatewayClient: '0.12.0', gatewayClient: '0.12.1',
gatewayBackend: '0.12.0', gatewayBackend: '0.12.0',
}); });
+7 -18
View File
@@ -6,11 +6,6 @@ import {
sortDevicesByTraffic, sortDevicesByTraffic,
} from '../utils/format.js'; } from '../utils/format.js';
const STATUS_LABELS = {
online: 'В сети',
recent: 'Недавно',
offline: 'Не в сети',
};
const AUTO_REFRESH_MS = 15_000; const AUTO_REFRESH_MS = 15_000;
const DEVICE_MOVE_MS = 520; const DEVICE_MOVE_MS = 520;
@@ -250,7 +245,7 @@ export function DevicesPanel({ open, panelRef, closeRef, onClose }) {
const editing = editingId === device.id; const editing = editingId === device.id;
const saving = savingId === device.id; const saving = savingId === device.id;
const seen = formatLastSeen(device.lastSeenAt); const seen = formatLastSeen(device.lastSeenAt);
const uncertainIdentity = device.confidence !== 'high'; const online = device.status === 'online';
const download = formatByteString(device.downloadBytes); const download = formatByteString(device.downloadBytes);
const upload = formatByteString(device.uploadBytes); const upload = formatByteString(device.uploadBytes);
const policyBusy = device.policyStatus === 'applying'; const policyBusy = device.policyStatus === 'applying';
@@ -285,7 +280,6 @@ export function DevicesPanel({ open, panelRef, closeRef, onClose }) {
key={device.id} key={device.id}
> >
<div className="client-device-heading"> <div className="client-device-heading">
<span className="client-device-status">{STATUS_LABELS[device.status]}</span>
{editing ? ( {editing ? (
<form className="client-device-alias" onSubmit={(event) => saveAlias(event, device)}> <form className="client-device-alias" onSubmit={(event) => saveAlias(event, device)}>
<input <input
@@ -350,14 +344,6 @@ export function DevicesPanel({ open, panelRef, closeRef, onClose }) {
<div className="client-device-addresses"> <div className="client-device-addresses">
{title !== device.ip && device.ip && <span>{device.ip}</span>} {title !== device.ip && device.ip && <span>{device.ip}</span>}
{device.manufacturer && <span className="client-device-manufacturer">{device.manufacturer}</span>} {device.manufacturer && <span className="client-device-manufacturer">{device.manufacturer}</span>}
{uncertainIdentity && <span className="client-device-identity client-tooltip-anchor" tabIndex="0" aria-label="Пояснение идентификации устройства">
<Tooltip>{device.confidence === 'medium'
? 'Устройство использует приватный MAC, производитель может не определиться'
: device.confidence === 'ambiguous'
? 'Gateway видит это устройство с несколькими IP или интерфейсами, поэтому индивидуальное правило небезопасно'
: 'Устройство определено приблизительно'}</Tooltip>
</span>}
</div> </div>
<span className="client-device-policy-wrap client-tooltip-anchor"> <span className="client-device-policy-wrap client-tooltip-anchor">
<button <button
@@ -373,9 +359,12 @@ export function DevicesPanel({ open, panelRef, closeRef, onClose }) {
</button> </button>
<Tooltip>{policyTooltip}</Tooltip> <Tooltip>{policyTooltip}</Tooltip>
</span> </span>
<span className="client-device-last-seen" tabIndex="0"> <span className={`client-device-last-seen${online ? ' is-online' : ''}`} tabIndex="0">
<time dateTime={device.lastSeenAt} aria-label={seen.tooltip}> <time
<TextMorph from={seen.label} to={seen.relative} /> dateTime={device.lastSeenAt}
aria-label={`${online ? 'В сети' : 'Не в сети'}. Последний контакт: ${seen.tooltip}`}
>
{online ? 'В сети' : <TextMorph from={seen.label} to={seen.relative} />}
</time> </time>
</span> </span>
</div> </div>
+7 -38
View File
@@ -885,7 +885,7 @@ p {
.client-device-heading { .client-device-heading {
display: grid; display: grid;
grid-template-columns: 60px minmax(0, 1fr) auto 32px; grid-template-columns: minmax(0, 1fr) auto 32px;
align-items: center; align-items: center;
gap: 6px; gap: 6px;
min-height: 28px; min-height: 28px;
@@ -907,33 +907,6 @@ p {
white-space: nowrap; white-space: nowrap;
} }
.client-device-status {
display: flex;
align-items: center;
gap: 6px;
color: var(--client-muted);
font-size: 9px;
white-space: nowrap;
}
.client-device-status::before {
flex: 0 0 auto;
width: 6px;
height: 6px;
display: inline-block;
border-radius: 50%;
background: currentColor;
content: '';
}
.client-device.is-online .client-device-status {
color: var(--client-accent);
}
.client-device.is-offline .client-device-status {
opacity: 0.56;
}
.client-device-edit-wrap, .client-device-edit-wrap,
.client-device-pin-wrap { .client-device-pin-wrap {
width: 28px; width: 28px;
@@ -996,7 +969,6 @@ p {
grid-template-columns: minmax(0, 1fr) 72px auto; grid-template-columns: minmax(0, 1fr) 72px auto;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
margin-left: 66px;
color: var(--client-muted); color: var(--client-muted);
font-size: 9px; font-size: 9px;
line-height: 1.5; line-height: 1.5;
@@ -1019,19 +991,17 @@ p {
content: '·'; content: '·';
} }
.client-device-identity {
position: relative;
margin-left: 4px;
color: var(--client-accent);
cursor: help;
}
.client-device-last-seen { .client-device-last-seen {
color: var(--client-text); color: var(--client-text);
cursor: default; cursor: default;
white-space: nowrap; white-space: nowrap;
} }
.client-device-last-seen.is-online {
color: var(--client-accent);
font-weight: 700;
}
.client-device-pin-wrap.client-tooltip-anchor > .client-tooltip { .client-device-pin-wrap.client-tooltip-anchor > .client-tooltip {
right: 0; right: 0;
left: auto; left: auto;
@@ -1086,8 +1056,7 @@ p {
transform: scale(1); transform: scale(1);
} }
.client-device-last-seen:focus-visible, .client-device-last-seen:focus-visible {
.client-device-identity:focus-visible {
border-radius: 3px; border-radius: 3px;
outline: 2px solid var(--client-accent); outline: 2px solid var(--client-accent);
outline-offset: 3px; outline-offset: 3px;
+7 -2
View File
@@ -29,11 +29,14 @@ test('Gateway device inventory uses the existing accessible responsive drawer',
assert.match(server, /requestUrl\.pathname === '\/api\/devices\/refresh'[\s\S]*deviceInventory\.refresh\(\)/); assert.match(server, /requestUrl\.pathname === '\/api\/devices\/refresh'[\s\S]*deviceInventory\.refresh\(\)/);
assert.match(server, /\/api\\\/devices\\\/\(dev_\[a-f0-9\]\{16\}\)\\\/policy\$[\s\S]*deviceInventory\.setPolicy/); assert.match(server, /\/api\\\/devices\\\/\(dev_\[a-f0-9\]\{16\}\)\\\/policy\$[\s\S]*deviceInventory\.setPolicy/);
assert.match(panel, /<Tooltip>Изменить название<\/Tooltip>/); assert.match(panel, /<Tooltip>Изменить название<\/Tooltip>/);
assert.match(panel, /<TextMorph from=\{seen\.label\} to=\{seen\.relative\} \/>/); assert.match(panel, /online \? 'В сети' : <TextMorph from=\{seen\.label\} to=\{seen\.relative\} \/>/);
assert.match(panel, /aria-label=\{`\$\{online \? 'В сети' : 'Не в сети'\}\. Последний контакт: \$\{seen\.tooltip\}`\}/);
assert.doesNotMatch(panel, /client-device-status|STATUS_LABELS/);
assert.doesNotMatch(panel, /client-text-morph-goo/); assert.doesNotMatch(panel, /client-text-morph-goo/);
assert.match(panel, /client-device-addresses/); assert.match(panel, /client-device-addresses/);
assert.doesNotMatch(panel, /device\.interface/); assert.doesNotMatch(panel, /device\.interface/);
assert.doesNotMatch(panel, /device\.mac/); assert.doesNotMatch(panel, /device\.mac/);
assert.doesNotMatch(panel, /client-device-identity|Пояснение идентификации устройства|ⓘ/);
assert.match(panel, /device\.confidence === 'ambiguous'/); assert.match(panel, /device\.confidence === 'ambiguous'/);
assert.match(panel, /sortDevicesByTraffic\(snapshot\?\.devices, sortDirection\)/); assert.match(panel, /sortDevicesByTraffic\(snapshot\?\.devices, sortDirection\)/);
assert.match(panel, /Трафик временно не обновляется/); assert.match(panel, /Трафик временно не обновляется/);
@@ -50,8 +53,10 @@ test('Gateway device inventory uses the existing accessible responsive drawer',
assert.match(panel, /maxLength="64"[\s\S]*autoFocus/); assert.match(panel, /maxLength="64"[\s\S]*autoFocus/);
assert.match(styles, /\.client-devices \{\s*width: min\(560px, 100vw\)/); assert.match(styles, /\.client-devices \{\s*width: min\(560px, 100vw\)/);
assert.match(styles, /\.client-device \{[\s\S]*gap: 3px;[\s\S]*padding: 10px 8px/); assert.match(styles, /\.client-device \{[\s\S]*gap: 3px;[\s\S]*padding: 10px 8px/);
assert.match(styles, /\.client-device-heading \{[\s\S]*grid-template-columns: 60px minmax\(0, 1fr\) auto 32px/); assert.match(styles, /\.client-device-heading \{[\s\S]*grid-template-columns: minmax\(0, 1fr\) auto 32px/);
assert.match(styles, /\.client-device-meta \{[\s\S]*grid-template-columns: minmax\(0, 1fr\) 72px auto/); assert.match(styles, /\.client-device-meta \{[\s\S]*grid-template-columns: minmax\(0, 1fr\) 72px auto/);
assert.doesNotMatch(styles, /\.client-device-meta \{[^}]*margin-left/);
assert.match(styles, /\.client-device-last-seen\.is-online \{[\s\S]*color: var\(--client-accent\)/);
assert.match(styles, /\.client-text-morph-value \{[\s\S]*transition: opacity 360ms[\s\S]*filter 480ms/); assert.match(styles, /\.client-text-morph-value \{[\s\S]*transition: opacity 360ms[\s\S]*filter 480ms/);
assert.match(styles, /\.client-device-last-seen:hover \.client-text-morph-value\.is-relative[\s\S]*opacity: 1/); assert.match(styles, /\.client-device-last-seen:hover \.client-text-morph-value\.is-relative[\s\S]*opacity: 1/);
assert.match(styles, /\.client-device-pin-wrap\.client-tooltip-anchor:hover > \.client-tooltip[\s\S]*translate\(0, 0\)/); assert.match(styles, /\.client-device-pin-wrap\.client-tooltip-anchor:hover > \.client-tooltip[\s\S]*translate\(0, 0\)/);