Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -278,19 +278,17 @@ body {
}

.node-name {
font-family: var(--font-mono);
font-weight: 500;
font-size: 13px;
letter-spacing: 0.3px;
letter-spacing: var(--tracking-name);
color: var(--text-primary);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.selected-node-header .node-name {
font-family: var(--font-mono);
letter-spacing: 0.3px;
font-weight: 600;
}

.node-project {
Expand Down Expand Up @@ -936,7 +934,7 @@ body {
}

.tunnel-local code {
font-family: monospace;
font-family: var(--font-mono);
background: rgba(0, 0, 0, 0.3);
padding: 2px 6px;
border-radius: 4px;
Expand Down Expand Up @@ -1153,6 +1151,7 @@ body {
.service-name {
font-weight: 600;
font-size: 14px;
letter-spacing: var(--tracking-name);
color: var(--text-primary);
}

Expand Down Expand Up @@ -1305,7 +1304,7 @@ body {
padding: 10px;
max-height: 150px;
overflow-y: auto;
font-family: monospace;
font-family: var(--font-mono);
font-size: 11px;
text-align: left;
user-select: text;
Expand Down Expand Up @@ -1381,6 +1380,7 @@ body {
.cluster-name {
font-size: 13px;
font-weight: 500;
letter-spacing: var(--tracking-name);
margin-bottom: 4px;
white-space: nowrap;
overflow: hidden;
Expand Down Expand Up @@ -1468,7 +1468,7 @@ body {
}

.token-input {
font-family: monospace;
font-family: var(--font-mono);
font-size: 13px;
flex: 1;
min-width: 0;
Expand Down Expand Up @@ -1506,7 +1506,7 @@ body {
.token-field-value {
flex: 1;
min-width: 0;
font-family: monospace;
font-family: var(--font-mono);
font-size: 12px;
letter-spacing: 0.5px;
color: var(--text-primary);
Expand Down Expand Up @@ -1836,7 +1836,7 @@ body {

.version-value {
color: var(--text-primary);
font-family: monospace;
font-variant-numeric: tabular-nums;
}

.update-available-row {
Expand Down Expand Up @@ -2013,7 +2013,7 @@ body {

.stats-text {
font-size: 11px;
font-family: monospace;
font-variant-numeric: tabular-nums;
color: var(--text-secondary);
display: flex;
gap: 4px;
Expand Down
46 changes: 28 additions & 18 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ConnectToNode, CancelConnection, GetSettings, SaveSettings, GetDeviceSe
import { Search, Settings, Server, Activity, Save, Monitor, ArrowLeft, Terminal, Globe, Lock, Unlock, AlertTriangle, ChevronDown, ChevronRight, X, Plus, Check, AlertCircle, Cpu, Wifi, HardDrive, Clock, Hash, ExternalLink, Copy, Play, RefreshCw, Trash2, ArrowRight, Info, Download, Box, Layers, Shield, Moon, Sun, HelpCircle, Key, Plug, Unplug } from 'lucide-react';
import eveOsIcon from './assets/eve-os.png';
import Tooltip from './components/Tooltip';
import DeviceInfoPanel, { formatWorkloadUsage } from './components/DeviceInfoPanel';
import DeviceInfoPanel, { AppUsage, formatWorkloadUsage } from './components/DeviceInfoPanel';
import useDeviceInfo from './useDeviceInfo';
import About from './components/About';
import UpdateBanner from './components/UpdateBanner';
Expand Down Expand Up @@ -224,7 +224,7 @@ const PortComboBox = ({ value, onChange, exposedPorts = [], showCommonPorts = tr
height: '34px',
boxSizing: 'border-box',
outline: 'none',
fontFamily: 'var(--font-mono)'
fontVariantNumeric: 'tabular-nums'
}}
/>
{matchedPort && (
Expand Down Expand Up @@ -364,7 +364,7 @@ const PortComboBox = ({ value, onChange, exposedPorts = [], showCommonPorts = tr
style={{ display: 'flex', alignItems: 'center', width: '100%' }}
title={`${p.label} - ${p.description}`}
>
<div style={{ width: '45px', textAlign: 'right', marginRight: '12px', flexShrink: 0, fontFamily: 'var(--font-mono)' }}>
<div style={{ width: '45px', textAlign: 'right', marginRight: '12px', flexShrink: 0, fontVariantNumeric: 'tabular-nums' }}>
<span style={{ color: 'var(--text-primary)', fontWeight: '500' }}>{p.port}</span>
</div>
<div style={{ width: '65px', textAlign: 'left', marginRight: '8px', flexShrink: 0 }}>
Expand Down Expand Up @@ -3410,12 +3410,24 @@ Do you want to try connecting anyway?`)) {
} else if (e.key === 'Enter') {
const node = getNodeAtIndex(selectedIndex);
if (node) handleConnect(node);
} else if (e.metaKey && e.key === ',') {
e.preventDefault();
setShowSettings(true);
}
};

// Cmd+, (Ctrl+, on Windows/Linux) opens Settings from every view. Listened
// for on window rather than in handleKeyDown: that handler stops early on
// the device page, and only sees keys while focus is inside the container
// (focus drops to <body> when a focused control unmounts).
useEffect(() => {
const onKeyDown = (e) => {
if ((e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && e.key === ',') {
e.preventDefault();
setShowSettings(true);
}
};
window.addEventListener('keydown', onKeyDown);
return () => window.removeEventListener('keydown', onKeyDown);
}, []);

const addNewCluster = () => {
const newName = `Cluster ${config.clusters.length + 1}`;
const newClusters = [...config.clusters, { name: newName, baseUrl: '', apiToken: '' }];
Expand Down Expand Up @@ -4412,7 +4424,7 @@ Do you want to try connecting anyway?`)) {
style={{
padding: '8px 10px', cursor: 'pointer',
background: editingCluster.baseUrl === u ? 'var(--bg-hover)' : 'transparent',
fontFamily: 'Menlo, monospace', fontSize: '13px',
fontSize: '13px',
}}
onMouseEnter={(e) => { e.currentTarget.style.background = 'var(--bg-hover)'; }}
onMouseLeave={(e) => { e.currentTarget.style.background = editingCluster.baseUrl === u ? 'var(--bg-hover)' : 'transparent'; }}
Expand Down Expand Up @@ -5088,7 +5100,7 @@ Do you want to try connecting anyway?`)) {
padding: '3px 10px',
borderRadius: '6px',
fontSize: '11px',
fontFamily: 'monospace',
fontFamily: 'var(--font-mono)',
whiteSpace: 'nowrap',
border: '1px solid var(--border-subtle, rgba(255, 255, 255, 0.06))',
color: 'inherit',
Expand Down Expand Up @@ -5342,7 +5354,7 @@ Do you want to try connecting anyway?`)) {
>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px', fontSize: '12px' }}>
<span style={{
fontFamily: 'Menlo, monospace', fontWeight: 600,
fontWeight: 600,
color: k.valid ? 'var(--text-primary)' : 'var(--color-warning)',
}}>
{k.valid ? k.type : 'unparseable line'}
Expand Down Expand Up @@ -5381,7 +5393,7 @@ Do you want to try connecting anyway?`)) {
</div>
{k.fingerprint && (
<div style={{
fontFamily: 'Menlo, monospace', fontSize: '11px',
fontFamily: 'var(--font-mono)', fontSize: '11px',
color: 'var(--text-tertiary)', marginTop: '2px',
}}>
{k.fingerprint}
Expand All @@ -5391,7 +5403,7 @@ Do you want to try connecting anyway?`)) {
<div
title={k.raw}
style={{
fontFamily: 'Menlo, monospace', fontSize: '11px',
fontFamily: 'var(--font-mono)', fontSize: '11px',
color: 'var(--text-tertiary)', marginTop: '2px',
overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
}}
Expand Down Expand Up @@ -5600,9 +5612,7 @@ Do you want to try connecting anyway?`)) {
<div>Memory: used / allocated to this app</div>
</div>
}>
<span data-testid="app-usage" style={{ fontSize: '0.85em', color: 'var(--text-secondary)', whiteSpace: 'nowrap', cursor: 'help' }}>
{usage.text}
</span>
<AppUsage data-testid="app-usage" workload={usage.workload} online={isDeviceOnline} />
</Tooltip>
);
})()}
Expand Down Expand Up @@ -5637,7 +5647,7 @@ Do you want to try connecting anyway?`)) {
borderRadius: '4px',
padding: '2px 6px',
fontSize: '11px',
fontFamily: 'monospace',
fontFamily: 'var(--font-mono)',
color: 'var(--text-secondary)',
cursor: 'pointer',
display: 'flex',
Expand Down Expand Up @@ -5747,7 +5757,7 @@ Do you want to try connecting anyway?`)) {
borderRadius: '4px',
padding: '2px 6px',
fontSize: '11px',
fontFamily: 'monospace',
fontVariantNumeric: 'tabular-nums',
color: 'var(--text-secondary)',
cursor: 'pointer',
display: 'flex',
Expand Down Expand Up @@ -6356,7 +6366,7 @@ Do you want to try connecting anyway?`)) {
borderRadius: '4px',
padding: '2px 6px',
fontSize: '13px',
fontFamily: 'monospace',
fontFamily: 'var(--font-mono)',
cursor: 'pointer',
width: '100%'
}}
Expand Down Expand Up @@ -6434,7 +6444,7 @@ Do you want to try connecting anyway?`)) {
borderRadius: '4px',
padding: '2px 6px',
fontSize: '13px',
fontFamily: 'monospace',
fontFamily: 'var(--font-mono)',
cursor: 'pointer'
}}
>
Expand Down
27 changes: 23 additions & 4 deletions frontend/src/App.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2534,7 +2534,8 @@ describe('Device info section', () => {
await openDevice();
const summary = await screen.findByTestId('device-summary');
expect(electronAPI.GetDeviceInfo).toHaveBeenCalledWith('node-1', 'Info-Dev');
expect(summary).toHaveTextContent('EVE 16.6.0-lts · up 3d 5h · CPU 7.5% · Mem 2.5/8.0 GB');
expect(summary).toHaveTextContent('EVE 16.6.0-lts · up 3d 5h');
expect(screen.getByTestId('device-summary-usage')).toHaveAttribute('aria-label', 'CPU 7.5% · Mem 2.5/8.0 GB');
expect(deviceToggle()).toHaveAttribute('aria-expanded', 'false');
expect(screen.queryByText('UPTIME', { selector: '.status-label' })).not.toBeInTheDocument();

Expand Down Expand Up @@ -2653,8 +2654,11 @@ describe('Device info section', () => {
],
}));
await openDevice();
await waitFor(() => expect(usageOf('docker-runtime')).toHaveTextContent('CPU 3.0% · 1.2 / 2.0 GB'));
expect(usageOf('compose-app')).toHaveTextContent('CPU 12% · 300 MB / 1.0 GB');
await waitFor(() => expect(usageOf('docker-runtime')).toHaveAttribute('aria-label', 'CPU 3.0% · 1.2 / 2.0 GB'));
expect(usageOf('compose-app')).toHaveAttribute('aria-label', 'CPU 12% · 300 MB / 1.0 GB');
// Rendered as gauges: a mini bar each for CPU and memory.
expect(usageOf('docker-runtime')).toHaveTextContent('CPU3.0%MEM1.2/2.0 GB');
expect(within(usageOf('docker-runtime')).getAllByTestId('usage-bar')).toHaveLength(2);
expect(usageOf('name-twin')).toBeNull();
// One read feeds both the Device section and the app rows.
expect(electronAPI.GetDeviceInfo).toHaveBeenCalledTimes(1);
Expand All @@ -2666,8 +2670,23 @@ describe('Device info section', () => {
electronAPI.GetDeviceServices.mockResolvedValue(JSON.stringify([{ id: 'a1', name: 'my-app', status: 'RUN_STATE_HALTED', appType: 'APP_TYPE_VM' }]));
electronAPI.GetDeviceInfo.mockResolvedValue(deviceInfo({ online: false }));
await openDevice();
await waitFor(() => expect(usageOf('my-app')).toHaveTextContent('256 MB / 1.0 GB'));
await waitFor(() => expect(usageOf('my-app')).toHaveAttribute('aria-label', '256 MB / 1.0 GB'));
expect(usageOf('my-app')).not.toHaveTextContent('CPU');
expect(within(usageOf('my-app')).getAllByTestId('usage-bar')).toHaveLength(1);
});

it('opens Settings with Cmd+, (or Ctrl+,) from the device page, wherever focus is', async () => {
await openDevice();
await screen.findByText('Running Applications');
// Focus outside the app container (e.g. after a focused control unmounted).
document.activeElement?.blur();
fireEvent.keyDown(document.body, { key: ',', metaKey: true });
await screen.findByRole('heading', { name: 'Configuration' });

fireEvent.click(document.querySelector('.settings-panel .close-btn'));
await waitFor(() => expect(screen.queryByRole('heading', { name: 'Configuration' })).not.toBeInTheDocument());
fireEvent.keyDown(document.body, { key: ',', ctrlKey: true });
await screen.findByRole('heading', { name: 'Configuration' });
});

it('shows no usage on app rows when device info has no data', async () => {
Expand Down
Loading
Loading