2025-12-11 18:32:55 -07:00
|
|
|
import React from 'react';
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
import {IconInfoCircle, IconPlayerEject} from '@tabler/icons-react';
|
|
|
|
|
import {
|
|
|
|
|
Button,
|
|
|
|
|
Checkbox,
|
|
|
|
|
Confirm,
|
|
|
|
|
Group,
|
|
|
|
|
Header,
|
|
|
|
|
Icon,
|
|
|
|
|
IconButton,
|
|
|
|
|
Loading,
|
|
|
|
|
Message,
|
|
|
|
|
Modal,
|
|
|
|
|
Panel,
|
|
|
|
|
Select,
|
|
|
|
|
Status,
|
|
|
|
|
Table,
|
|
|
|
|
TextInput,
|
|
|
|
|
toast,
|
|
|
|
|
} from "../ui";
|
controller: VNC toggle, gated on the Desktop running
Add a VNC toggle to the Controller (both UIs) that starts/stops whichever VNC
backend is installed: wayvnc for Wayland (Raspberry Pi OS), RealVNC for X11.
Runtime-only, like the Desktop toggle: the unit is never enabled, so VNC does
not return after a reboot. Users who want it permanently on can enable it with
raspi-config.
VNC serves the desktop session, so starting it without a desktop gives clients
a blank screen. The gate lives in the backend, not just the UI, so curl callers
get it too (409, distinct from a systemctl failure). Stopping is never gated so
a running VNC server can't be stranded on with no way to turn it off.
Backend selection deliberately avoids raspi-config's live-compositor probe
(pgrep labwc), which reports X11 — and would pick the wrong backend — whenever
the desktop is stopped. wayvnc also requires its config to exist; that is
checked directly rather than via the unit's ConditionResult, which reports 'no'
for any unit that has never been started.
Extracts _unit_properties()/_systemctl_unit() so Desktop and VNC share one
systemd probe and start/stop path.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-29 16:53:45 -06:00
|
|
|
import {APIButton, BluetoothToggle, DesktopToggle, DirectorySearch, HandPointMessage, HotspotToggle, InfoMessage, ThrottleToggle, Toggle, VncToggle,} from "../Common";
|
2026-03-28 16:28:47 -06:00
|
|
|
import {useDockerized, useMediaDirectory} from "../../hooks/customHooks";
|
2025-12-17 15:11:35 -07:00
|
|
|
import {Media} from "../../contexts/contexts";
|
2025-12-11 18:32:55 -07:00
|
|
|
import {
|
2025-12-17 18:54:48 -07:00
|
|
|
addFstabEntry,
|
2026-03-28 16:28:47 -06:00
|
|
|
addSambaShare,
|
2025-12-11 18:32:55 -07:00
|
|
|
disableService,
|
2025-12-17 18:54:48 -07:00
|
|
|
enableService,
|
2025-12-11 18:32:55 -07:00
|
|
|
getDisks,
|
2025-12-16 15:06:41 -07:00
|
|
|
getFstabEntries,
|
2026-07-04 08:22:24 -06:00
|
|
|
getHotspotDevices,
|
2026-07-28 19:52:39 -06:00
|
|
|
getHotspotProtocols,
|
2026-07-04 08:22:24 -06:00
|
|
|
getHotspotSettings,
|
2026-03-28 16:28:47 -06:00
|
|
|
getSambaStatus,
|
2025-12-17 18:54:48 -07:00
|
|
|
getServiceLogs,
|
|
|
|
|
getServices,
|
|
|
|
|
getSmartStatus,
|
2025-12-16 15:06:41 -07:00
|
|
|
mountDisk,
|
2025-12-17 18:54:48 -07:00
|
|
|
removeFstabEntry,
|
2026-03-28 16:28:47 -06:00
|
|
|
removeSambaShare,
|
2025-12-17 18:54:48 -07:00
|
|
|
restartService,
|
|
|
|
|
restartServices,
|
|
|
|
|
startService,
|
|
|
|
|
stopService,
|
2025-12-16 15:06:41 -07:00
|
|
|
unmountDisk,
|
2026-07-04 08:22:24 -06:00
|
|
|
updateHotspotSettings,
|
2025-12-11 18:32:55 -07:00
|
|
|
} from "../../api/controller";
|
2026-07-04 08:22:24 -06:00
|
|
|
import QRCode from "react-qr-code";
|
2025-12-11 18:32:55 -07:00
|
|
|
import {RestartButton, ShutdownButton} from "./Settings";
|
2026-02-03 16:36:44 -07:00
|
|
|
import {CONTROLLER_URI} from "../Vars";
|
2025-12-11 18:32:55 -07:00
|
|
|
|
|
|
|
|
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
// Service status kind mapping. Status only knows complete/active/pending/failed,
|
|
|
|
|
// so "stopped" and "unknown" both land on pending -- the Start/Stop button and
|
|
|
|
|
// service name still tell them apart, this dot only carries running vs. failed.
|
|
|
|
|
const statusKinds = {
|
|
|
|
|
running: 'complete',
|
|
|
|
|
stopped: 'pending',
|
|
|
|
|
failed: 'failed',
|
|
|
|
|
unknown: 'pending',
|
2025-12-11 18:32:55 -07:00
|
|
|
};
|
|
|
|
|
|
controller: group services into Core vs Optional & Maintenance
The Controller listed every wrolpi-* service in one flat table, which was
confusing for new users who couldn't tell always-on infrastructure from
one-off/dev/maintenance units.
Services are now split into two groups computed once in the backend and
exposed as `service.group`:
* Core Services - persistent services enabled at boot (api, app, caddy,
kiwix, ...), the normal running system.
* Optional & Maintenance - one-off/dev/maintenance tasks (bootstrap, repair,
upgrade, *-dev, discovered wrolpi-*), plus persistent
services the user has disabled at boot (e.g. Samba with
no shares configured).
Rule: core iff kind == "persistent" and enabled; otherwise optional. Group
membership only changes when the user toggles Boot, never on start/stop or
polling, so rows stay put. Within each group, failed/stopped services sort
first so problems stay visible.
Feature parity across all three render paths: the React ControllerPage, the
server-side Jinja template, and the client-side poll refresh. Docker
containers have no group field and fall back to a single ungrouped list.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 19:41:17 -06:00
|
|
|
// Sort order within a group: problems first so they stay visible.
|
|
|
|
|
const statusSortOrder = {
|
|
|
|
|
failed: 0,
|
|
|
|
|
unknown: 1,
|
|
|
|
|
stopped: 2,
|
|
|
|
|
running: 3,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Partition services into the two Controller groups. The backend computes each
|
|
|
|
|
// service's `group` ("core" | "optional"); a missing group (e.g. Docker
|
|
|
|
|
// containers) is treated as core so nothing is hidden. Within each group,
|
|
|
|
|
// failed/stopped services sort first, then alphabetically.
|
|
|
|
|
export const groupServices = (services) => {
|
|
|
|
|
const byStatusThenName = (a, b) => {
|
|
|
|
|
const sa = statusSortOrder[a.status] ?? 1;
|
|
|
|
|
const sb = statusSortOrder[b.status] ?? 1;
|
|
|
|
|
if (sa !== sb) return sa - sb;
|
|
|
|
|
return a.name.localeCompare(b.name);
|
|
|
|
|
};
|
|
|
|
|
const core = services.filter(s => s.group !== 'optional').sort(byStatusThenName);
|
|
|
|
|
const optional = services.filter(s => s.group === 'optional').sort(byStatusThenName);
|
|
|
|
|
return {core, optional};
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-11 18:32:55 -07:00
|
|
|
|
2025-12-15 16:53:24 -07:00
|
|
|
const linesOptions = [
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
{value: '100', label: '100 lines'},
|
|
|
|
|
{value: '250', label: '250 lines'},
|
|
|
|
|
{value: '500', label: '500 lines'},
|
|
|
|
|
{value: '1000', label: '1000 lines'},
|
|
|
|
|
{value: '5000', label: '5000 lines'},
|
2025-12-15 16:53:24 -07:00
|
|
|
];
|
|
|
|
|
|
2025-12-17 18:31:40 -07:00
|
|
|
// Custom hook for service row state and handlers
|
|
|
|
|
function useServiceRow(service, onAction) {
|
2025-12-11 18:32:55 -07:00
|
|
|
const [loading, setLoading] = React.useState(false);
|
|
|
|
|
const [logsOpen, setLogsOpen] = React.useState(false);
|
|
|
|
|
const [logs, setLogs] = React.useState('');
|
|
|
|
|
const [logsLoading, setLogsLoading] = React.useState(false);
|
2025-12-15 16:53:24 -07:00
|
|
|
const [linesCount, setLinesCount] = React.useState(250);
|
|
|
|
|
const [countdown, setCountdown] = React.useState(10);
|
|
|
|
|
const logsRef = React.useRef(null);
|
2025-12-11 18:32:55 -07:00
|
|
|
|
|
|
|
|
const handleAction = async (action, actionFn) => {
|
|
|
|
|
setLoading(true);
|
|
|
|
|
try {
|
|
|
|
|
await actionFn(service.name);
|
|
|
|
|
toast({
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: `${action} ${service.name}`,
|
|
|
|
|
description: `Successfully ${action.toLowerCase()}ed ${service.name}`,
|
|
|
|
|
time: 3000,
|
|
|
|
|
});
|
|
|
|
|
if (onAction) onAction();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
toast({
|
|
|
|
|
type: 'error',
|
|
|
|
|
title: `${action} Failed`,
|
|
|
|
|
description: e.message,
|
|
|
|
|
time: 5000,
|
|
|
|
|
});
|
|
|
|
|
} finally {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-15 16:53:24 -07:00
|
|
|
const fetchLogs = async (lines, showLoading = false) => {
|
|
|
|
|
if (showLoading) setLogsLoading(true);
|
2025-12-11 18:32:55 -07:00
|
|
|
try {
|
2025-12-15 16:53:24 -07:00
|
|
|
const result = await getServiceLogs(service.name, lines);
|
2025-12-11 18:32:55 -07:00
|
|
|
setLogs(result.logs || 'No logs available');
|
|
|
|
|
} catch (e) {
|
|
|
|
|
setLogs(`Error fetching logs: ${e.message}`);
|
|
|
|
|
} finally {
|
2025-12-15 16:53:24 -07:00
|
|
|
if (showLoading) setLogsLoading(false);
|
2025-12-11 18:32:55 -07:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-15 16:53:24 -07:00
|
|
|
// Scroll to bottom when logs finish loading
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (!logsLoading && logsRef.current) {
|
|
|
|
|
logsRef.current.scrollTop = logsRef.current.scrollHeight;
|
|
|
|
|
}
|
|
|
|
|
}, [logsLoading]);
|
|
|
|
|
|
|
|
|
|
// Auto-refresh countdown timer (only when scrolled to bottom)
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (!logsOpen) return;
|
|
|
|
|
|
|
|
|
|
const interval = setInterval(() => {
|
|
|
|
|
setCountdown(prev => {
|
|
|
|
|
if (prev <= 1) {
|
|
|
|
|
// Check if scrolled to bottom (within 50px threshold)
|
|
|
|
|
if (logsRef.current) {
|
|
|
|
|
const {scrollTop, scrollHeight, clientHeight} = logsRef.current;
|
|
|
|
|
const isAtBottom = scrollHeight - scrollTop - clientHeight < 50;
|
|
|
|
|
if (isAtBottom) {
|
|
|
|
|
fetchLogs(linesCount);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 10; // Reset countdown
|
|
|
|
|
}
|
|
|
|
|
return prev - 1;
|
|
|
|
|
});
|
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
|
|
return () => clearInterval(interval);
|
|
|
|
|
}, [logsOpen, linesCount]);
|
|
|
|
|
|
|
|
|
|
const handleViewLogs = async () => {
|
|
|
|
|
setLogsOpen(true);
|
|
|
|
|
fetchLogs(linesCount, true); // Show loading on initial open
|
|
|
|
|
};
|
|
|
|
|
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
const handleLinesChange = (value) => {
|
|
|
|
|
const lines = parseInt(value, 10);
|
|
|
|
|
setLinesCount(lines);
|
|
|
|
|
fetchLogs(lines);
|
2025-12-15 16:53:24 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleDownloadLogs = () => {
|
|
|
|
|
const datetime = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
|
|
|
|
|
const filename = `${service.name}_${datetime}.txt`;
|
|
|
|
|
const blob = new Blob([logs], {type: 'text/plain'});
|
|
|
|
|
const url = URL.createObjectURL(blob);
|
|
|
|
|
const a = document.createElement('a');
|
|
|
|
|
a.href = url;
|
|
|
|
|
a.download = filename;
|
|
|
|
|
a.click();
|
|
|
|
|
URL.revokeObjectURL(url);
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-11 18:32:55 -07:00
|
|
|
const isRunning = service.status === 'running';
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
const statusKind = statusKinds[service.status] || 'pending';
|
2025-12-11 18:32:55 -07:00
|
|
|
|
|
|
|
|
// Build view URL if service is viewable
|
|
|
|
|
let viewUrl = null;
|
|
|
|
|
if (service.viewable && service.port && isRunning) {
|
|
|
|
|
const protocol = service.use_https ? 'https' : 'http';
|
|
|
|
|
const host = window.location.hostname;
|
|
|
|
|
const path = service.view_path || '';
|
2026-04-09 15:03:16 -06:00
|
|
|
const isDefaultPort = (protocol === 'https' && service.port === 443) || (protocol === 'http' && service.port === 80);
|
|
|
|
|
const portSuffix = isDefaultPort ? '' : `:${service.port}`;
|
|
|
|
|
viewUrl = `${protocol}://${host}${portSuffix}${path}`;
|
2025-12-11 18:32:55 -07:00
|
|
|
}
|
|
|
|
|
|
2025-12-17 18:31:40 -07:00
|
|
|
return {
|
|
|
|
|
loading, logsOpen, setLogsOpen, logs, logsLoading, linesCount, countdown, logsRef,
|
|
|
|
|
handleAction, fetchLogs, handleViewLogs, handleLinesChange, handleDownloadLogs,
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
isRunning, statusKind, viewUrl
|
2025-12-17 18:31:40 -07:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Logs modal component (shared between mobile and desktop)
|
2025-12-17 18:54:48 -07:00
|
|
|
function ServiceLogsModal({
|
|
|
|
|
service,
|
|
|
|
|
logsOpen,
|
|
|
|
|
setLogsOpen,
|
|
|
|
|
logs,
|
|
|
|
|
logsLoading,
|
|
|
|
|
logsRef,
|
|
|
|
|
linesCount,
|
|
|
|
|
countdown,
|
|
|
|
|
handleLinesChange,
|
|
|
|
|
handleDownloadLogs,
|
|
|
|
|
fetchLogs
|
|
|
|
|
}) {
|
2025-12-17 18:31:40 -07:00
|
|
|
return (
|
|
|
|
|
<Modal
|
|
|
|
|
open={logsOpen}
|
|
|
|
|
onClose={() => setLogsOpen(false)}
|
|
|
|
|
size='fullscreen'
|
|
|
|
|
>
|
|
|
|
|
<Modal.Header>Logs: {service.name}</Modal.Header>
|
|
|
|
|
<Modal.Content scrolling>
|
|
|
|
|
{logsLoading ? (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Loading/>
|
2025-12-17 18:31:40 -07:00
|
|
|
) : (
|
|
|
|
|
<pre ref={logsRef} style={{
|
|
|
|
|
whiteSpace: 'pre-wrap',
|
|
|
|
|
wordWrap: 'break-word',
|
|
|
|
|
maxHeight: '400px',
|
|
|
|
|
overflow: 'auto',
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
background: 'var(--panel)',
|
|
|
|
|
color: 'var(--text)',
|
2025-12-17 18:31:40 -07:00
|
|
|
padding: '1em',
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
fontFamily: 'var(--font-mono)',
|
2025-12-17 18:31:40 -07:00
|
|
|
fontSize: '0.85em',
|
|
|
|
|
}}>
|
|
|
|
|
{logs}
|
|
|
|
|
</pre>
|
|
|
|
|
)}
|
|
|
|
|
</Modal.Content>
|
|
|
|
|
<Modal.Actions>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<span style={{marginRight: '0.5em', color: 'var(--muted)'}}>{countdown}s</span>
|
|
|
|
|
<Select
|
|
|
|
|
data={linesOptions}
|
|
|
|
|
value={String(linesCount)}
|
2025-12-17 18:31:40 -07:00
|
|
|
onChange={handleLinesChange}
|
|
|
|
|
style={{marginRight: 'auto'}}
|
|
|
|
|
/>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Button onClick={() => fetchLogs(linesCount)} role='primary' icon='refresh'>Refresh</Button>
|
|
|
|
|
<Button onClick={handleDownloadLogs} color='yellow' icon='download'>Download</Button>
|
|
|
|
|
<Button role='cancel' onClick={() => setLogsOpen(false)}>Close</Button>
|
2025-12-17 18:31:40 -07:00
|
|
|
</Modal.Actions>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Mobile service row - simplified layout
|
|
|
|
|
function MobileServiceRow({service, onAction}) {
|
|
|
|
|
const {
|
|
|
|
|
loading, logsOpen, setLogsOpen, logs, logsLoading, linesCount, countdown, logsRef,
|
|
|
|
|
handleAction, fetchLogs, handleViewLogs, handleLinesChange, handleDownloadLogs,
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
isRunning, statusKind, viewUrl
|
2025-12-17 18:31:40 -07:00
|
|
|
} = useServiceRow(service, onAction);
|
|
|
|
|
|
2025-12-11 18:32:55 -07:00
|
|
|
return (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Table.Row failed={service.status === 'failed'}>
|
2025-12-11 18:32:55 -07:00
|
|
|
<Table.Cell>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Status kind={statusKind} plain/>
|
2025-12-11 18:32:55 -07:00
|
|
|
<strong>{service.name}</strong>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
{service.description &&
|
|
|
|
|
<div style={{fontSize: '0.9em', color: 'var(--muted)'}}>{service.description}</div>}
|
2025-12-17 18:31:40 -07:00
|
|
|
</Table.Cell>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Table.Cell numeric>
|
2025-12-17 18:31:40 -07:00
|
|
|
{isRunning ? (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<IconButton
|
2025-12-17 18:31:40 -07:00
|
|
|
icon='stop'
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
label={`Stop ${service.name}`}
|
|
|
|
|
role='danger'
|
2025-12-17 18:31:40 -07:00
|
|
|
disabled={loading}
|
|
|
|
|
loading={loading}
|
|
|
|
|
onClick={() => handleAction('Stop', stopService)}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<IconButton
|
2025-12-17 18:31:40 -07:00
|
|
|
icon='play'
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
label={`Start ${service.name}`}
|
|
|
|
|
role='save'
|
2025-12-17 18:31:40 -07:00
|
|
|
disabled={loading}
|
|
|
|
|
loading={loading}
|
|
|
|
|
onClick={() => handleAction('Start', startService)}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<IconButton
|
2025-12-17 18:31:40 -07:00
|
|
|
icon='refresh'
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
label={`Restart ${service.name}`}
|
|
|
|
|
role='retry'
|
2025-12-17 18:31:40 -07:00
|
|
|
disabled={loading}
|
|
|
|
|
loading={loading}
|
|
|
|
|
onClick={() => handleAction('Restart', restartService)}
|
|
|
|
|
/>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<IconButton
|
|
|
|
|
icon='file text'
|
|
|
|
|
label={`View logs for ${service.name}`}
|
|
|
|
|
role='primary'
|
|
|
|
|
onClick={handleViewLogs}
|
|
|
|
|
/>
|
2025-12-17 18:31:40 -07:00
|
|
|
<ServiceLogsModal
|
|
|
|
|
service={service}
|
|
|
|
|
logsOpen={logsOpen}
|
|
|
|
|
setLogsOpen={setLogsOpen}
|
|
|
|
|
logs={logs}
|
|
|
|
|
logsLoading={logsLoading}
|
|
|
|
|
logsRef={logsRef}
|
|
|
|
|
linesCount={linesCount}
|
|
|
|
|
countdown={countdown}
|
|
|
|
|
handleLinesChange={handleLinesChange}
|
|
|
|
|
handleDownloadLogs={handleDownloadLogs}
|
|
|
|
|
fetchLogs={fetchLogs}
|
|
|
|
|
/>
|
|
|
|
|
{viewUrl && (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<IconButton
|
2025-12-17 18:31:40 -07:00
|
|
|
icon='external'
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
label={`Open ${service.name}`}
|
|
|
|
|
color='violet'
|
|
|
|
|
component='a'
|
2025-12-17 18:31:40 -07:00
|
|
|
href={viewUrl}
|
|
|
|
|
target='_blank'
|
|
|
|
|
rel='noopener noreferrer'
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Desktop service row - full layout with all columns
|
|
|
|
|
function DesktopServiceRow({service, onAction, dockerized}) {
|
|
|
|
|
const {
|
|
|
|
|
loading, logsOpen, setLogsOpen, logs, logsLoading, linesCount, countdown, logsRef,
|
|
|
|
|
handleAction, fetchLogs, handleViewLogs, handleLinesChange, handleDownloadLogs,
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
isRunning, statusKind, viewUrl
|
2025-12-17 18:31:40 -07:00
|
|
|
} = useServiceRow(service, onAction);
|
|
|
|
|
|
|
|
|
|
return (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Table.Row failed={service.status === 'failed'}>
|
2025-12-17 18:31:40 -07:00
|
|
|
<Table.Cell>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Status kind={statusKind} plain/>
|
2025-12-17 18:31:40 -07:00
|
|
|
<strong>{service.name}</strong>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
{service.description &&
|
|
|
|
|
<div style={{fontSize: '0.9em', color: 'var(--muted)'}}>{service.description}</div>}
|
2025-12-17 18:31:40 -07:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>{service.port || '-'}</Table.Cell>
|
2025-12-11 18:32:55 -07:00
|
|
|
<Table.Cell>
|
|
|
|
|
{isRunning ? (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<IconButton
|
2025-12-11 18:32:55 -07:00
|
|
|
icon='stop'
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
label={`Stop ${service.name}`}
|
|
|
|
|
role='danger'
|
2025-12-11 18:32:55 -07:00
|
|
|
disabled={loading}
|
|
|
|
|
loading={loading}
|
|
|
|
|
onClick={() => handleAction('Stop', stopService)}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<IconButton
|
2025-12-11 18:32:55 -07:00
|
|
|
icon='play'
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
label={`Start ${service.name}`}
|
|
|
|
|
role='save'
|
2025-12-11 18:32:55 -07:00
|
|
|
disabled={loading}
|
|
|
|
|
loading={loading}
|
|
|
|
|
onClick={() => handleAction('Start', startService)}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<IconButton
|
2025-12-11 18:32:55 -07:00
|
|
|
icon='refresh'
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
label={`Restart ${service.name}`}
|
|
|
|
|
role='retry'
|
2025-12-11 18:32:55 -07:00
|
|
|
disabled={loading}
|
|
|
|
|
loading={loading}
|
|
|
|
|
onClick={() => handleAction('Restart', restartService)}
|
|
|
|
|
/>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<IconButton
|
|
|
|
|
icon='file text'
|
|
|
|
|
label={`View logs for ${service.name}`}
|
|
|
|
|
role='primary'
|
|
|
|
|
onClick={handleViewLogs}
|
|
|
|
|
/>
|
2025-12-17 18:31:40 -07:00
|
|
|
<ServiceLogsModal
|
|
|
|
|
service={service}
|
|
|
|
|
logsOpen={logsOpen}
|
|
|
|
|
setLogsOpen={setLogsOpen}
|
|
|
|
|
logs={logs}
|
|
|
|
|
logsLoading={logsLoading}
|
|
|
|
|
logsRef={logsRef}
|
|
|
|
|
linesCount={linesCount}
|
|
|
|
|
countdown={countdown}
|
|
|
|
|
handleLinesChange={handleLinesChange}
|
|
|
|
|
handleDownloadLogs={handleDownloadLogs}
|
|
|
|
|
fetchLogs={fetchLogs}
|
|
|
|
|
/>
|
2025-12-11 18:32:55 -07:00
|
|
|
{viewUrl && (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<IconButton
|
2025-12-11 18:32:55 -07:00
|
|
|
icon='external'
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
label={`Open ${service.name}`}
|
|
|
|
|
color='violet'
|
|
|
|
|
component='a'
|
2025-12-11 18:32:55 -07:00
|
|
|
href={viewUrl}
|
|
|
|
|
target='_blank'
|
|
|
|
|
rel='noopener noreferrer'
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
{!dockerized && (
|
2025-12-17 18:31:40 -07:00
|
|
|
<Table.Cell>
|
|
|
|
|
<Toggle
|
|
|
|
|
checked={service.enabled === true}
|
|
|
|
|
disabled={service.enabled === null || loading}
|
|
|
|
|
onChange={async (checked) => {
|
|
|
|
|
if (checked) {
|
|
|
|
|
await handleAction('Enable', enableService);
|
|
|
|
|
} else {
|
|
|
|
|
await handleAction('Disable', disableService);
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
label={service.enabled ? 'Enabled' : 'Disabled'}
|
|
|
|
|
/>
|
|
|
|
|
</Table.Cell>
|
2025-12-11 18:32:55 -07:00
|
|
|
)}
|
|
|
|
|
</Table.Row>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ServicesSection() {
|
|
|
|
|
const [services, setServices] = React.useState([]);
|
|
|
|
|
const [loading, setLoading] = React.useState(true);
|
|
|
|
|
const [error, setError] = React.useState(null);
|
|
|
|
|
const [restarting, setRestarting] = React.useState(false);
|
|
|
|
|
const dockerized = useDockerized();
|
|
|
|
|
|
|
|
|
|
const handleRestartServices = async () => {
|
|
|
|
|
setRestarting(true);
|
|
|
|
|
try {
|
|
|
|
|
await restartServices();
|
|
|
|
|
toast({
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: 'Services Restarting',
|
|
|
|
|
description: 'All WROLPi services are being restarted.',
|
|
|
|
|
time: 5000,
|
|
|
|
|
});
|
|
|
|
|
// Refresh service list after restart initiated
|
|
|
|
|
fetchServices();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
toast({
|
|
|
|
|
type: 'error',
|
|
|
|
|
title: 'Restart Failed',
|
|
|
|
|
description: e.message,
|
|
|
|
|
time: 5000,
|
|
|
|
|
});
|
|
|
|
|
} finally {
|
|
|
|
|
setRestarting(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const fetchServices = async () => {
|
|
|
|
|
setLoading(true);
|
|
|
|
|
setError(null);
|
|
|
|
|
try {
|
|
|
|
|
const result = await getServices();
|
|
|
|
|
setServices(Array.isArray(result) ? result : []);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
setError(e.message);
|
|
|
|
|
setServices([]);
|
|
|
|
|
} finally {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
fetchServices();
|
|
|
|
|
// Refresh every 10 seconds
|
|
|
|
|
const interval = setInterval(fetchServices, 10000);
|
|
|
|
|
return () => clearInterval(interval);
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
if (loading && services.length === 0) {
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
return <Panel>
|
2025-12-11 18:32:55 -07:00
|
|
|
<Header as='h3'>Services</Header>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Loading/>
|
|
|
|
|
</Panel>;
|
2025-12-11 18:32:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (error) {
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
return <Panel>
|
2025-12-11 18:32:55 -07:00
|
|
|
<Header as='h3'>Services</Header>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Message kind='error'>Error loading services: {error}</Message>
|
|
|
|
|
<Button role='retry' icon='refresh' onClick={fetchServices}>Retry</Button>
|
|
|
|
|
</Panel>;
|
2025-12-11 18:32:55 -07:00
|
|
|
}
|
|
|
|
|
|
2025-12-17 18:31:40 -07:00
|
|
|
const restartButton = (colSpan) => (
|
|
|
|
|
<Table.Footer>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.HeaderCell colSpan={colSpan}>
|
|
|
|
|
<APIButton
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
role='retry'
|
|
|
|
|
icon='refresh'
|
2025-12-17 18:31:40 -07:00
|
|
|
onClick={handleRestartServices}
|
|
|
|
|
confirmContent='Are you sure you want to restart all WROLPi services?'
|
|
|
|
|
confirmButton='Restart Services'
|
|
|
|
|
disabled={restarting}
|
|
|
|
|
>
|
|
|
|
|
{restarting ? 'Restarting...' : 'Restart All Services'}
|
|
|
|
|
</APIButton>
|
|
|
|
|
</Table.HeaderCell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
</Table.Footer>
|
|
|
|
|
);
|
|
|
|
|
|
controller: group services into Core vs Optional & Maintenance
The Controller listed every wrolpi-* service in one flat table, which was
confusing for new users who couldn't tell always-on infrastructure from
one-off/dev/maintenance units.
Services are now split into two groups computed once in the backend and
exposed as `service.group`:
* Core Services - persistent services enabled at boot (api, app, caddy,
kiwix, ...), the normal running system.
* Optional & Maintenance - one-off/dev/maintenance tasks (bootstrap, repair,
upgrade, *-dev, discovered wrolpi-*), plus persistent
services the user has disabled at boot (e.g. Samba with
no shares configured).
Rule: core iff kind == "persistent" and enabled; otherwise optional. Group
membership only changes when the user toggles Boot, never on start/stop or
polling, so rows stay put. Within each group, failed/stopped services sort
first so problems stay visible.
Feature parity across all three render paths: the React ControllerPage, the
server-side Jinja template, and the client-side poll refresh. Docker
containers have no group field and fall back to a single ungrouped list.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 19:41:17 -06:00
|
|
|
const {core, optional} = groupServices(services);
|
|
|
|
|
|
|
|
|
|
// Full-width labeled separator between the two service groups.
|
|
|
|
|
const groupLabelRow = (key, title, colSpan) => (
|
|
|
|
|
<Table.Row key={key} className='service-group-label'>
|
|
|
|
|
<Table.Cell colSpan={colSpan} style={{fontWeight: 'bold'}}>
|
|
|
|
|
{title}
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const groupedRows = (RowComponent, colSpan, extraProps = {}) => {
|
|
|
|
|
const rows = [];
|
|
|
|
|
// Only label the Core group when there is also an Optional group to
|
|
|
|
|
// distinguish it from; otherwise a lone header adds noise.
|
|
|
|
|
if (core.length > 0 && optional.length > 0) {
|
|
|
|
|
rows.push(groupLabelRow('label-core', 'Core Services', colSpan));
|
|
|
|
|
}
|
|
|
|
|
core.forEach(service => rows.push(
|
|
|
|
|
<RowComponent key={service.name} service={service} onAction={fetchServices} {...extraProps}/>
|
|
|
|
|
));
|
|
|
|
|
if (optional.length > 0) {
|
|
|
|
|
rows.push(groupLabelRow('label-optional', 'Optional & Maintenance', colSpan));
|
|
|
|
|
optional.forEach(service => rows.push(
|
|
|
|
|
<RowComponent key={service.name} service={service} onAction={fetchServices} {...extraProps}/>
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
return rows;
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-11 18:32:55 -07:00
|
|
|
return (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Panel>
|
|
|
|
|
<Header as='h3' icon='server'>Services</Header>
|
2025-12-17 18:31:40 -07:00
|
|
|
{/* Mobile table - 2 columns */}
|
|
|
|
|
<Media at='mobile'>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Table>
|
2025-12-17 18:31:40 -07:00
|
|
|
<Table.Header>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.HeaderCell>Service</Table.HeaderCell>
|
|
|
|
|
<Table.HeaderCell>Actions</Table.HeaderCell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
</Table.Header>
|
|
|
|
|
<Table.Body>
|
controller: group services into Core vs Optional & Maintenance
The Controller listed every wrolpi-* service in one flat table, which was
confusing for new users who couldn't tell always-on infrastructure from
one-off/dev/maintenance units.
Services are now split into two groups computed once in the backend and
exposed as `service.group`:
* Core Services - persistent services enabled at boot (api, app, caddy,
kiwix, ...), the normal running system.
* Optional & Maintenance - one-off/dev/maintenance tasks (bootstrap, repair,
upgrade, *-dev, discovered wrolpi-*), plus persistent
services the user has disabled at boot (e.g. Samba with
no shares configured).
Rule: core iff kind == "persistent" and enabled; otherwise optional. Group
membership only changes when the user toggles Boot, never on start/stop or
polling, so rows stay put. Within each group, failed/stopped services sort
first so problems stay visible.
Feature parity across all three render paths: the React ControllerPage, the
server-side Jinja template, and the client-side poll refresh. Docker
containers have no group field and fall back to a single ungrouped list.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 19:41:17 -06:00
|
|
|
{groupedRows(MobileServiceRow, 2)}
|
2025-12-17 18:31:40 -07:00
|
|
|
</Table.Body>
|
|
|
|
|
{restartButton(2)}
|
|
|
|
|
</Table>
|
|
|
|
|
</Media>
|
|
|
|
|
{/* Desktop table - full columns */}
|
|
|
|
|
<Media greaterThanOrEqual='tablet'>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Table>
|
2025-12-17 18:31:40 -07:00
|
|
|
<Table.Header>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.HeaderCell>Service</Table.HeaderCell>
|
2025-12-17 15:11:35 -07:00
|
|
|
<Table.HeaderCell>Port</Table.HeaderCell>
|
2025-12-17 18:31:40 -07:00
|
|
|
<Table.HeaderCell>Actions</Table.HeaderCell>
|
|
|
|
|
{!dockerized && <Table.HeaderCell>Boot</Table.HeaderCell>}
|
|
|
|
|
</Table.Row>
|
|
|
|
|
</Table.Header>
|
|
|
|
|
<Table.Body>
|
controller: group services into Core vs Optional & Maintenance
The Controller listed every wrolpi-* service in one flat table, which was
confusing for new users who couldn't tell always-on infrastructure from
one-off/dev/maintenance units.
Services are now split into two groups computed once in the backend and
exposed as `service.group`:
* Core Services - persistent services enabled at boot (api, app, caddy,
kiwix, ...), the normal running system.
* Optional & Maintenance - one-off/dev/maintenance tasks (bootstrap, repair,
upgrade, *-dev, discovered wrolpi-*), plus persistent
services the user has disabled at boot (e.g. Samba with
no shares configured).
Rule: core iff kind == "persistent" and enabled; otherwise optional. Group
membership only changes when the user toggles Boot, never on start/stop or
polling, so rows stay put. Within each group, failed/stopped services sort
first so problems stay visible.
Feature parity across all three render paths: the React ControllerPage, the
server-side Jinja template, and the client-side poll refresh. Docker
containers have no group field and fall back to a single ungrouped list.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 19:41:17 -06:00
|
|
|
{groupedRows(DesktopServiceRow, dockerized ? 3 : 4, {dockerized})}
|
2025-12-17 18:31:40 -07:00
|
|
|
</Table.Body>
|
|
|
|
|
{restartButton(dockerized ? 4 : 5)}
|
|
|
|
|
</Table>
|
|
|
|
|
</Media>
|
2025-12-11 18:32:55 -07:00
|
|
|
{services.length === 0 && (
|
|
|
|
|
<p>No services found. Services may not be available in this environment.</p>
|
|
|
|
|
)}
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
</Panel>
|
2025-12-11 18:32:55 -07:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Helper to get health status color from SMART assessment
|
|
|
|
|
const getHealthColor = (assessment) => {
|
ui: route genuine success and failure through the roles
Sixteen call sites, chosen by reading each one rather than by grepping for a
hue. Four sub-agents judged them independently against one rule: convert only
what genuinely means success or failure; identification, category and
decoration stay hue-named.
Converted:
SMART drive health (all four branches -- PASS/WARN/FAIL/unknown)
config validity: valid / invalid / empty
"Failed to load preview"
the two "Download error" triggers
expired inventory items, desktop and mobile
the refresh phases: complete / active / not reached
a refresh Progress bar in its error state
cookie status: Unlocked / Locked
a chip-mismatch label on the flasher
CPU load thresholds (LoadStatistic)
the outcome of an API call in useAPIButton
the gallery's "Danger zone" heading and its load readings
Left alone, deliberately:
the file browser toolbar -- every action has its own colour to be told apart,
and delete already uses role='danger' (Roland's ruling)
diff add/remove in the config and inventory import previews. Adding is not a
success and removing is not a failure; in Overwrite mode the removals are
exactly what the user asked for, and painting them danger would report their
intended action as broken
seasons in DatesSelector, the uploader star and favourite heart, TagIcon,
downloader category buttons, "Recommended to Keep"
Three sites were wrong in a way worth naming. Both "Download error" triggers
guard on the same condition and render the same modal, but one was `orange` and
the other `red` -- and `orange` is the single worst choice, byte-identical to
`--text` in night, so that error button was indistinguishable from an ordinary
control. Config validity drew its valid state in `--violet`, which no user
parses as "valid". And `LoadStatistic` -- the thing users actually watch on the
Status page -- rendered its warning threshold in that same invisible orange.
Also fixed a stale comment in Videos.js that claimed no token existed for these.
Two notes on the tests:
The first LoadStatistic test I wrote rendered the component and asserted the
inline colour. jsdom REJECTS `color: var(--danger)` as an invalid declaration
and drops it, so every colour reads back as the empty string -- two of the four
assertions passed for that reason alone and would have kept passing with the
hues restored. It is a source guard now, with the painted result asserted in
the browser instead.
That browser test then found something real: an uncoloured reading inherits
`--text`, which in night is 4.98:1 against `--warning`'s 4.91:1, so a machine
under load is marginally QUIETER than one that is fine. Not fixed here. The
only way up on a dark panel is lightness, and night's danger would desaturate
from #ff3e3e to about #ff5d5d -- trading the theme's "red only" character for
loudness. That is a palette decision, so the test documents it and asserts what
does hold rather than quietly making it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 18:08:34 -06:00
|
|
|
// Roles, not hues: a drive's assessment is a severity and has to rank as one. All
|
|
|
|
|
// four branches together -- a helper where PASS and FAIL rank but WARN is an
|
|
|
|
|
// unranked hue is worse than either choice, and in night `--amber` is byte-identical
|
|
|
|
|
// to `--yellow` so WARN would stop sitting between them.
|
|
|
|
|
if (!assessment) return 'var(--neutral)';
|
2025-12-11 18:32:55 -07:00
|
|
|
const upper = assessment.toUpperCase();
|
ui: route genuine success and failure through the roles
Sixteen call sites, chosen by reading each one rather than by grepping for a
hue. Four sub-agents judged them independently against one rule: convert only
what genuinely means success or failure; identification, category and
decoration stay hue-named.
Converted:
SMART drive health (all four branches -- PASS/WARN/FAIL/unknown)
config validity: valid / invalid / empty
"Failed to load preview"
the two "Download error" triggers
expired inventory items, desktop and mobile
the refresh phases: complete / active / not reached
a refresh Progress bar in its error state
cookie status: Unlocked / Locked
a chip-mismatch label on the flasher
CPU load thresholds (LoadStatistic)
the outcome of an API call in useAPIButton
the gallery's "Danger zone" heading and its load readings
Left alone, deliberately:
the file browser toolbar -- every action has its own colour to be told apart,
and delete already uses role='danger' (Roland's ruling)
diff add/remove in the config and inventory import previews. Adding is not a
success and removing is not a failure; in Overwrite mode the removals are
exactly what the user asked for, and painting them danger would report their
intended action as broken
seasons in DatesSelector, the uploader star and favourite heart, TagIcon,
downloader category buttons, "Recommended to Keep"
Three sites were wrong in a way worth naming. Both "Download error" triggers
guard on the same condition and render the same modal, but one was `orange` and
the other `red` -- and `orange` is the single worst choice, byte-identical to
`--text` in night, so that error button was indistinguishable from an ordinary
control. Config validity drew its valid state in `--violet`, which no user
parses as "valid". And `LoadStatistic` -- the thing users actually watch on the
Status page -- rendered its warning threshold in that same invisible orange.
Also fixed a stale comment in Videos.js that claimed no token existed for these.
Two notes on the tests:
The first LoadStatistic test I wrote rendered the component and asserted the
inline colour. jsdom REJECTS `color: var(--danger)` as an invalid declaration
and drops it, so every colour reads back as the empty string -- two of the four
assertions passed for that reason alone and would have kept passing with the
hues restored. It is a source guard now, with the painted result asserted in
the browser instead.
That browser test then found something real: an uncoloured reading inherits
`--text`, which in night is 4.98:1 against `--warning`'s 4.91:1, so a machine
under load is marginally QUIETER than one that is fine. Not fixed here. The
only way up on a dark panel is lightness, and night's danger would desaturate
from #ff3e3e to about #ff5d5d -- trading the theme's "red only" character for
loudness. That is a palette decision, so the test documents it and asserts what
does hold rather than quietly making it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 18:08:34 -06:00
|
|
|
if (upper === 'PASS') return 'var(--success)';
|
|
|
|
|
if (upper === 'WARN') return 'var(--warning)';
|
|
|
|
|
if (upper === 'FAIL') return 'var(--danger)';
|
|
|
|
|
return 'var(--neutral)';
|
2025-12-11 18:32:55 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Helper to format power-on hours
|
|
|
|
|
const formatPowerOnHours = (hours) => {
|
|
|
|
|
if (hours === null || hours === undefined) return '-';
|
|
|
|
|
const days = Math.floor(hours / 24);
|
|
|
|
|
const years = Math.floor(days / 365);
|
|
|
|
|
if (years > 0) return `${hours.toLocaleString()} hrs (${years}y ${days % 365}d)`;
|
|
|
|
|
if (days > 0) return `${hours.toLocaleString()} hrs (${days}d)`;
|
|
|
|
|
return `${hours} hrs`;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function SmartDetailsModal({drive, open, onClose}) {
|
|
|
|
|
if (!drive) return null;
|
|
|
|
|
|
2026-06-24 15:59:34 -06:00
|
|
|
const healthColor = getHealthColor(drive.health || drive.assessment);
|
2025-12-11 18:32:55 -07:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Modal open={open} onClose={onClose} size='small'>
|
|
|
|
|
<Modal.Header>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Icon name='heartbeat'/> SMART Details: {drive.device}
|
2025-12-11 18:32:55 -07:00
|
|
|
</Modal.Header>
|
|
|
|
|
<Modal.Content>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Table>
|
2025-12-11 18:32:55 -07:00
|
|
|
<Table.Body>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.Cell width={6}>Model</Table.Cell>
|
|
|
|
|
<Table.Cell>{drive.model || '-'}</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.Cell>Serial</Table.Cell>
|
|
|
|
|
<Table.Cell>{drive.serial || '-'}</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.Cell>Capacity</Table.Cell>
|
|
|
|
|
<Table.Cell>{drive.capacity || '-'}</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.Cell>Assessment</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<span style={{color: healthColor}}>●</span>{' '}
|
2026-06-26 07:23:15 -06:00
|
|
|
{drive.assessment || drive.health || 'Unknown'}
|
|
|
|
|
{drive.smart_limited
|
|
|
|
|
? ' (limited — USB enclosure reports health only, no attributes)'
|
|
|
|
|
: ''}
|
2025-12-11 18:32:55 -07:00
|
|
|
</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.Cell>Temperature</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
|
|
|
|
{drive.temperature !== null && drive.temperature !== undefined
|
|
|
|
|
? `${drive.temperature}°C`
|
|
|
|
|
: '-'}
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.Cell>Power-On Hours</Table.Cell>
|
|
|
|
|
<Table.Cell>{formatPowerOnHours(drive.power_on_hours)}</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.Cell>Reallocated Sectors</Table.Cell>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Table.Cell style={{color: drive.reallocated_sectors > 0 ? 'var(--amber)' : 'inherit'}}>
|
2025-12-11 18:32:55 -07:00
|
|
|
{drive.reallocated_sectors !== null && drive.reallocated_sectors !== undefined
|
|
|
|
|
? drive.reallocated_sectors
|
|
|
|
|
: '-'}
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.Cell>Pending Sectors</Table.Cell>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Table.Cell style={{color: drive.pending_sectors > 0 ? 'var(--amber)' : 'inherit'}}>
|
2025-12-11 18:32:55 -07:00
|
|
|
{drive.pending_sectors !== null && drive.pending_sectors !== undefined
|
|
|
|
|
? drive.pending_sectors
|
|
|
|
|
: '-'}
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
</Table.Row>
|
2026-06-24 15:59:34 -06:00
|
|
|
<Table.Row>
|
|
|
|
|
<Table.Cell>Uncorrectable Sectors</Table.Cell>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Table.Cell style={{color: drive.offline_uncorrectable > 0 ? 'var(--amber)' : 'inherit'}}>
|
2026-06-24 15:59:34 -06:00
|
|
|
{drive.offline_uncorrectable !== null && drive.offline_uncorrectable !== undefined
|
|
|
|
|
? drive.offline_uncorrectable
|
|
|
|
|
: '-'}
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
</Table.Row>
|
2025-12-11 18:32:55 -07:00
|
|
|
<Table.Row>
|
|
|
|
|
<Table.Cell>SMART Enabled</Table.Cell>
|
|
|
|
|
<Table.Cell>{drive.smart_enabled ? 'Yes' : 'No'}</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
</Table.Body>
|
|
|
|
|
</Table>
|
|
|
|
|
</Modal.Content>
|
|
|
|
|
<Modal.Actions>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Button role='cancel' onClick={onClose}>Close</Button>
|
2025-12-11 18:32:55 -07:00
|
|
|
</Modal.Actions>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2026-07-23 19:09:23 -06:00
|
|
|
// The primary mount can be unmounted (to swap in a backup drive), but doing
|
|
|
|
|
// so stops the WROLPi API service — the unmount modal warns about this. Any
|
|
|
|
|
// mount outside /media belongs to the system (/, /boot/efi, /boot/firmware, …)
|
|
|
|
|
// and is entirely untouchable.
|
2026-07-05 14:50:56 -06:00
|
|
|
const PRIMARY_MOUNT = '/media/wrolpi';
|
2025-12-16 15:06:41 -07:00
|
|
|
|
|
|
|
|
// Helper to format disk size
|
|
|
|
|
const formatSize = (size) => {
|
|
|
|
|
if (!size) return '-';
|
|
|
|
|
// If already a string (e.g., "59.5G" from lsblk), return as-is
|
|
|
|
|
if (typeof size === 'string') return size;
|
|
|
|
|
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
|
|
|
let i = 0;
|
|
|
|
|
let bytes = size;
|
|
|
|
|
while (bytes >= 1024 && i < units.length - 1) {
|
|
|
|
|
bytes /= 1024;
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
return `${bytes.toFixed(1)} ${units[i]}`;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2026-05-14 16:38:02 -06:00
|
|
|
function formatBytes(bytes) {
|
|
|
|
|
if (!bytes || bytes < 1) return '0 B';
|
|
|
|
|
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
|
|
|
let i = 0;
|
|
|
|
|
let n = bytes;
|
|
|
|
|
while (n >= 1024 && i < units.length - 1) {
|
|
|
|
|
n /= 1024;
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
return `${n.toFixed(n >= 10 ? 0 : 1)} ${units[i]}`;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-16 15:06:41 -07:00
|
|
|
function MountModal({disk, open, onClose, onMount}) {
|
|
|
|
|
const [mountPoint, setMountPoint] = React.useState('');
|
|
|
|
|
const [persist, setPersist] = React.useState(false);
|
|
|
|
|
const [loading, setLoading] = React.useState(false);
|
2026-05-14 16:38:02 -06:00
|
|
|
const [shadowed, setShadowed] = React.useState(null);
|
2025-12-16 15:06:41 -07:00
|
|
|
|
|
|
|
|
// Set default mount point when disk changes
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (disk) {
|
|
|
|
|
const defaultMount = disk.label ? `/media/${disk.label}` : `/media/${disk.name}`;
|
|
|
|
|
setMountPoint(defaultMount);
|
|
|
|
|
setPersist(false);
|
2026-05-14 16:38:02 -06:00
|
|
|
setShadowed(null);
|
2025-12-16 15:06:41 -07:00
|
|
|
}
|
|
|
|
|
}, [disk]);
|
|
|
|
|
|
2026-05-14 16:38:02 -06:00
|
|
|
const performMount = async (forceShadowed) => {
|
2025-12-16 15:06:41 -07:00
|
|
|
setLoading(true);
|
|
|
|
|
try {
|
2026-05-14 16:38:02 -06:00
|
|
|
const result = await mountDisk(disk.path, mountPoint.trim(), disk.fstype, 'defaults', persist, forceShadowed);
|
|
|
|
|
|
|
|
|
|
// Soft-block: target contains data that would be hidden by the mount.
|
|
|
|
|
if (result && result.success === false && result.needs_force === 'shadowed') {
|
|
|
|
|
setShadowed(result.shadowed_data || {entries: [], size_bytes: 0});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-16 15:06:41 -07:00
|
|
|
toast({
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: 'Disk Mounted',
|
|
|
|
|
description: `${disk.name} mounted at ${mountPoint}`,
|
|
|
|
|
time: 3000,
|
|
|
|
|
});
|
|
|
|
|
onClose();
|
|
|
|
|
if (onMount) onMount();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
toast({
|
|
|
|
|
type: 'error',
|
|
|
|
|
title: 'Mount Failed',
|
|
|
|
|
description: e.message,
|
|
|
|
|
time: 5000,
|
|
|
|
|
});
|
|
|
|
|
} finally {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-05-14 16:38:02 -06:00
|
|
|
const handleMount = async () => {
|
|
|
|
|
if (!mountPoint.trim()) {
|
|
|
|
|
toast({
|
|
|
|
|
type: 'error',
|
|
|
|
|
title: 'Mount point required',
|
|
|
|
|
description: 'Please enter a mount point.',
|
|
|
|
|
time: 3000,
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
await performMount(false);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleForceMount = () => performMount(true);
|
|
|
|
|
|
|
|
|
|
const handleCancel = () => {
|
|
|
|
|
setShadowed(null);
|
|
|
|
|
onClose();
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-16 15:06:41 -07:00
|
|
|
if (!disk) return null;
|
|
|
|
|
|
2026-05-14 16:38:02 -06:00
|
|
|
if (shadowed) {
|
|
|
|
|
const entries = (shadowed.entries || []).join(', ') || '(unknown)';
|
|
|
|
|
return (
|
|
|
|
|
<Modal open={open} onClose={handleCancel} size='small'>
|
|
|
|
|
<Modal.Header>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Icon name='warning sign'/> Existing Files Detected
|
2026-05-14 16:38:02 -06:00
|
|
|
</Modal.Header>
|
|
|
|
|
<Modal.Content>
|
|
|
|
|
<p>
|
|
|
|
|
Mounting <strong>{disk.name}</strong> at <code>{mountPoint}</code> would
|
|
|
|
|
hide existing files that are already there.
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
Found <strong>{entries}</strong> ({formatBytes(shadowed.size_bytes)}) at the mount target.
|
|
|
|
|
</p>
|
ui: route genuine success and failure through the roles
Sixteen call sites, chosen by reading each one rather than by grepping for a
hue. Four sub-agents judged them independently against one rule: convert only
what genuinely means success or failure; identification, category and
decoration stay hue-named.
Converted:
SMART drive health (all four branches -- PASS/WARN/FAIL/unknown)
config validity: valid / invalid / empty
"Failed to load preview"
the two "Download error" triggers
expired inventory items, desktop and mobile
the refresh phases: complete / active / not reached
a refresh Progress bar in its error state
cookie status: Unlocked / Locked
a chip-mismatch label on the flasher
CPU load thresholds (LoadStatistic)
the outcome of an API call in useAPIButton
the gallery's "Danger zone" heading and its load readings
Left alone, deliberately:
the file browser toolbar -- every action has its own colour to be told apart,
and delete already uses role='danger' (Roland's ruling)
diff add/remove in the config and inventory import previews. Adding is not a
success and removing is not a failure; in Overwrite mode the removals are
exactly what the user asked for, and painting them danger would report their
intended action as broken
seasons in DatesSelector, the uploader star and favourite heart, TagIcon,
downloader category buttons, "Recommended to Keep"
Three sites were wrong in a way worth naming. Both "Download error" triggers
guard on the same condition and render the same modal, but one was `orange` and
the other `red` -- and `orange` is the single worst choice, byte-identical to
`--text` in night, so that error button was indistinguishable from an ordinary
control. Config validity drew its valid state in `--violet`, which no user
parses as "valid". And `LoadStatistic` -- the thing users actually watch on the
Status page -- rendered its warning threshold in that same invisible orange.
Also fixed a stale comment in Videos.js that claimed no token existed for these.
Two notes on the tests:
The first LoadStatistic test I wrote rendered the component and asserted the
inline colour. jsdom REJECTS `color: var(--danger)` as an invalid declaration
and drops it, so every colour reads back as the empty string -- two of the four
assertions passed for that reason alone and would have kept passing with the
hues restored. It is a source guard now, with the painted result asserted in
the browser instead.
That browser test then found something real: an uncoloured reading inherits
`--text`, which in night is 4.98:1 against `--warning`'s 4.91:1, so a machine
under load is marginally QUIETER than one that is fine. Not fixed here. The
only way up on a dark panel is lightness, and night's danger would desaturate
from #ff3e3e to about #ff5d5d -- trading the theme's "red only" character for
loudness. That is a palette decision, so the test documents it and asserts what
does hold rather than quietly making it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 18:08:34 -06:00
|
|
|
{/* A caution about a consequence, not a failure -- the destructive
|
|
|
|
|
weight is already carried by the confirm button below. */}
|
|
|
|
|
<p style={{color: 'var(--warning)'}}>
|
2026-05-14 16:38:02 -06:00
|
|
|
Those files will continue to consume space on the underlying filesystem
|
|
|
|
|
(typically the SD card on a Raspberry Pi) and can fill it up.
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
Recommended: cancel, move or delete the existing files, then mount.
|
|
|
|
|
</p>
|
|
|
|
|
</Modal.Content>
|
|
|
|
|
<Modal.Actions>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Button role='cancel' onClick={handleCancel} disabled={loading}>Cancel</Button>
|
|
|
|
|
<Button role='retry' icon='exclamation triangle' onClick={handleForceMount} loading={loading}
|
|
|
|
|
disabled={loading}>
|
2026-05-14 16:38:02 -06:00
|
|
|
Mount Anyway
|
|
|
|
|
</Button>
|
|
|
|
|
</Modal.Actions>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-16 15:06:41 -07:00
|
|
|
return (
|
|
|
|
|
<Modal open={open} onClose={onClose} size='small'>
|
|
|
|
|
<Modal.Header>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Icon name='disk'/> Mount Disk: {disk.name}
|
2025-12-16 15:06:41 -07:00
|
|
|
</Modal.Header>
|
|
|
|
|
<Modal.Content>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<TextInput
|
|
|
|
|
autoFocus
|
|
|
|
|
label='Mount Point'
|
|
|
|
|
value={mountPoint}
|
|
|
|
|
onChange={(e) => setMountPoint(e.target.value)}
|
|
|
|
|
placeholder="/media/..."
|
|
|
|
|
/>
|
|
|
|
|
<div style={{marginTop: '0.8em'}}>
|
|
|
|
|
<Checkbox
|
|
|
|
|
label="Persistent (survive reboots)"
|
|
|
|
|
checked={persist}
|
|
|
|
|
onChange={(e) => setPersist(e.currentTarget.checked)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
{disk.fstype && (
|
|
|
|
|
<p style={{color: 'var(--muted)', fontSize: '0.9em'}}>
|
|
|
|
|
Filesystem: {disk.fstype}
|
|
|
|
|
{disk.label && ` | Label: ${disk.label}`}
|
|
|
|
|
{disk.size && ` | Size: ${formatSize(disk.size)}`}
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
2025-12-16 15:06:41 -07:00
|
|
|
</Modal.Content>
|
|
|
|
|
<Modal.Actions>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Button role='cancel' onClick={onClose} disabled={loading}>Cancel</Button>
|
|
|
|
|
<Button role='save' icon='check' onClick={handleMount} loading={loading} disabled={loading}>
|
2025-12-16 15:06:41 -07:00
|
|
|
Mount
|
|
|
|
|
</Button>
|
|
|
|
|
</Modal.Actions>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-12-11 18:32:55 -07:00
|
|
|
function DiskSection() {
|
|
|
|
|
const [disks, setDisks] = React.useState([]);
|
2025-12-16 15:06:41 -07:00
|
|
|
const [fstabEntries, setFstabEntries] = React.useState([]);
|
2025-12-11 18:32:55 -07:00
|
|
|
const [smartDrives, setSmartDrives] = React.useState([]);
|
|
|
|
|
const [smartAvailable, setSmartAvailable] = React.useState(true);
|
|
|
|
|
const [loading, setLoading] = React.useState(true);
|
|
|
|
|
const [error, setError] = React.useState(null);
|
|
|
|
|
const [selectedDrive, setSelectedDrive] = React.useState(null);
|
|
|
|
|
const [detailsOpen, setDetailsOpen] = React.useState(false);
|
2025-12-16 15:06:41 -07:00
|
|
|
const [mountModalOpen, setMountModalOpen] = React.useState(false);
|
|
|
|
|
const [selectedDisk, setSelectedDisk] = React.useState(null);
|
|
|
|
|
const [unmountConfirmOpen, setUnmountConfirmOpen] = React.useState(false);
|
|
|
|
|
const [unmountTarget, setUnmountTarget] = React.useState(null);
|
2025-12-11 18:32:55 -07:00
|
|
|
const dockerized = useDockerized();
|
|
|
|
|
|
|
|
|
|
const fetchDiskInfo = async () => {
|
|
|
|
|
setLoading(true);
|
|
|
|
|
setError(null);
|
|
|
|
|
try {
|
2025-12-16 15:06:41 -07:00
|
|
|
const [disksResult, fstabResult, smartResult] = await Promise.allSettled([
|
2025-12-11 18:32:55 -07:00
|
|
|
getDisks(),
|
2025-12-16 15:06:41 -07:00
|
|
|
getFstabEntries(),
|
2025-12-11 18:32:55 -07:00
|
|
|
getSmartStatus(),
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
if (disksResult.status === 'fulfilled') {
|
|
|
|
|
setDisks(Array.isArray(disksResult.value) ? disksResult.value : []);
|
|
|
|
|
}
|
2025-12-16 15:06:41 -07:00
|
|
|
if (fstabResult.status === 'fulfilled') {
|
|
|
|
|
setFstabEntries(Array.isArray(fstabResult.value) ? fstabResult.value : []);
|
2025-12-11 18:32:55 -07:00
|
|
|
}
|
|
|
|
|
if (smartResult.status === 'fulfilled' && smartResult.value) {
|
|
|
|
|
// Handle new API format: {available: bool, drives: [...]}
|
|
|
|
|
const smartData = smartResult.value;
|
|
|
|
|
setSmartAvailable(smartData.available !== false);
|
|
|
|
|
setSmartDrives(Array.isArray(smartData.drives) ? smartData.drives : []);
|
|
|
|
|
} else {
|
|
|
|
|
setSmartAvailable(false);
|
|
|
|
|
setSmartDrives([]);
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
setError(e.message);
|
|
|
|
|
} finally {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleShowDetails = (drive) => {
|
|
|
|
|
setSelectedDrive(drive);
|
|
|
|
|
setDetailsOpen(true);
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-16 15:06:41 -07:00
|
|
|
const handleOpenMountModal = (disk) => {
|
|
|
|
|
setSelectedDisk(disk);
|
|
|
|
|
setMountModalOpen(true);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleCloseMountModal = () => {
|
|
|
|
|
setMountModalOpen(false);
|
|
|
|
|
setSelectedDisk(null);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleUnmountClick = (mountPoint) => {
|
|
|
|
|
setUnmountTarget(mountPoint);
|
|
|
|
|
setUnmountConfirmOpen(true);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleUnmountConfirm = async () => {
|
|
|
|
|
if (!unmountTarget) return;
|
|
|
|
|
|
|
|
|
|
try {
|
2026-07-23 19:09:23 -06:00
|
|
|
const result = await unmountDisk(unmountTarget);
|
|
|
|
|
const stoppedServices = (result && result.stopped_services) || [];
|
2025-12-16 15:06:41 -07:00
|
|
|
toast({
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: 'Disk Unmounted',
|
2026-07-23 19:09:23 -06:00
|
|
|
description: stoppedServices.length > 0 ?
|
|
|
|
|
`Unmounted ${unmountTarget}; stopped ${stoppedServices.join(', ')}` :
|
|
|
|
|
`Unmounted ${unmountTarget}`,
|
|
|
|
|
time: 5000,
|
2025-12-16 15:06:41 -07:00
|
|
|
});
|
|
|
|
|
fetchDiskInfo();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
toast({
|
|
|
|
|
type: 'error',
|
|
|
|
|
title: 'Unmount Failed',
|
|
|
|
|
description: e.message,
|
|
|
|
|
time: 5000,
|
|
|
|
|
});
|
|
|
|
|
} finally {
|
|
|
|
|
setUnmountConfirmOpen(false);
|
|
|
|
|
setUnmountTarget(null);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleTogglePersist = async (disk, enable) => {
|
|
|
|
|
try {
|
|
|
|
|
if (enable) {
|
|
|
|
|
await addFstabEntry(disk.path, disk.mountpoint, disk.fstype || 'auto');
|
|
|
|
|
toast({
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: 'Persistence Enabled',
|
|
|
|
|
description: `${disk.mountpoint} will persist across reboots`,
|
|
|
|
|
time: 3000,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
await removeFstabEntry(disk.mountpoint);
|
|
|
|
|
toast({
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: 'Persistence Disabled',
|
|
|
|
|
description: `${disk.mountpoint} will not persist across reboots`,
|
|
|
|
|
time: 3000,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
fetchDiskInfo();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
toast({
|
|
|
|
|
type: 'error',
|
|
|
|
|
title: 'Failed to update persistence',
|
|
|
|
|
description: e.message,
|
|
|
|
|
time: 5000,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Check if a mount point is in fstab (persistent)
|
|
|
|
|
const isPersistent = (mountpoint) => {
|
|
|
|
|
return fstabEntries.some(entry => entry.mount_point === mountpoint);
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-11 18:32:55 -07:00
|
|
|
React.useEffect(() => {
|
|
|
|
|
fetchDiskInfo();
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
if (dockerized) {
|
|
|
|
|
return (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Panel>
|
|
|
|
|
<Header as='h3' icon='disk'>Disk Management</Header>
|
2025-12-11 18:32:55 -07:00
|
|
|
<p>Disk management is not available in Docker environments.</p>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
</Panel>
|
2025-12-11 18:32:55 -07:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (loading) {
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
return <Panel>
|
2025-12-11 18:32:55 -07:00
|
|
|
<Header as='h3'>Disk Management</Header>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Loading/>
|
|
|
|
|
</Panel>;
|
2025-12-11 18:32:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Panel>
|
|
|
|
|
<Header as='h3' icon='disk'>Disk Management</Header>
|
2025-12-11 18:32:55 -07:00
|
|
|
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
{error && <Message kind='warning'>Some disk information unavailable: {error}</Message>}
|
2025-12-11 18:32:55 -07:00
|
|
|
|
2025-12-16 15:06:41 -07:00
|
|
|
<Header as='h4'>Disks</Header>
|
|
|
|
|
{disks.length > 0 ? (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Table>
|
2025-12-11 18:32:55 -07:00
|
|
|
<Table.Header>
|
|
|
|
|
<Table.Row>
|
2025-12-16 15:06:41 -07:00
|
|
|
<Table.HeaderCell>Name</Table.HeaderCell>
|
|
|
|
|
<Table.HeaderCell>Size</Table.HeaderCell>
|
|
|
|
|
<Table.HeaderCell>Type</Table.HeaderCell>
|
|
|
|
|
<Table.HeaderCell>Label</Table.HeaderCell>
|
2025-12-11 18:32:55 -07:00
|
|
|
<Table.HeaderCell>Mount Point</Table.HeaderCell>
|
2025-12-16 15:06:41 -07:00
|
|
|
<Table.HeaderCell>Persist</Table.HeaderCell>
|
|
|
|
|
<Table.HeaderCell>Actions</Table.HeaderCell>
|
2025-12-11 18:32:55 -07:00
|
|
|
</Table.Row>
|
|
|
|
|
</Table.Header>
|
|
|
|
|
<Table.Body>
|
2025-12-16 15:06:41 -07:00
|
|
|
{disks.map((disk) => {
|
|
|
|
|
const isMounted = disk.mountpoint && disk.mountpoint !== '';
|
2026-07-05 14:50:56 -06:00
|
|
|
const isPrimary = disk.mountpoint === PRIMARY_MOUNT;
|
|
|
|
|
// Mounts outside /media (/, /boot/efi, …) are system mounts.
|
|
|
|
|
const isSystemMount = isMounted && !isPrimary && !disk.mountpoint.startsWith('/media/');
|
2025-12-16 15:06:41 -07:00
|
|
|
const persistent = isMounted && isPersistent(disk.mountpoint);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Table.Row key={disk.path || disk.name}>
|
|
|
|
|
<Table.Cell>{disk.name}</Table.Cell>
|
|
|
|
|
<Table.Cell>{formatSize(disk.size)}</Table.Cell>
|
|
|
|
|
<Table.Cell>{disk.fstype || '-'}</Table.Cell>
|
|
|
|
|
<Table.Cell>{disk.label || '-'}</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
|
|
|
|
{isMounted ? (
|
|
|
|
|
<span>{disk.mountpoint}</span>
|
|
|
|
|
) : (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<span style={{color: 'var(--muted)'}}>-</span>
|
2025-12-16 15:06:41 -07:00
|
|
|
)}
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
2026-07-05 14:50:56 -06:00
|
|
|
{isMounted && !isSystemMount ? (
|
2025-12-16 15:06:41 -07:00
|
|
|
<Toggle
|
|
|
|
|
checked={persistent}
|
|
|
|
|
onChange={(checked) => handleTogglePersist(disk, checked)}
|
|
|
|
|
label={persistent ? 'Enabled' : 'Disabled'}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<span style={{color: 'var(--muted)'}}>-</span>
|
2025-12-16 15:06:41 -07:00
|
|
|
)}
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
2026-07-23 19:09:23 -06:00
|
|
|
{isMounted && isSystemMount ? (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<span style={{color: 'var(--muted)'}}>System</span>
|
2025-12-16 15:06:41 -07:00
|
|
|
) : isMounted ? (
|
|
|
|
|
<Button
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
size='sm'
|
|
|
|
|
role='danger'
|
|
|
|
|
icon={IconPlayerEject}
|
2025-12-16 15:06:41 -07:00
|
|
|
onClick={() => handleUnmountClick(disk.mountpoint)}
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
>
|
|
|
|
|
Unmount
|
|
|
|
|
</Button>
|
2025-12-16 15:06:41 -07:00
|
|
|
) : (
|
|
|
|
|
<Button
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
size='sm'
|
|
|
|
|
role='save'
|
2025-12-16 15:06:41 -07:00
|
|
|
icon='plug'
|
|
|
|
|
onClick={() => handleOpenMountModal(disk)}
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
>
|
|
|
|
|
Mount
|
|
|
|
|
</Button>
|
2025-12-16 15:06:41 -07:00
|
|
|
)}
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
);
|
|
|
|
|
})}
|
2025-12-11 18:32:55 -07:00
|
|
|
</Table.Body>
|
|
|
|
|
</Table>
|
|
|
|
|
) : (
|
2025-12-16 15:06:41 -07:00
|
|
|
<p>No disks detected.</p>
|
2025-12-11 18:32:55 -07:00
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<Header as='h4'>SMART Health</Header>
|
|
|
|
|
{!smartAvailable ? (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<p style={{color: 'var(--muted)'}}>SMART monitoring not available (pySMART not installed or not
|
|
|
|
|
supported)</p>
|
2025-12-11 18:32:55 -07:00
|
|
|
) : smartDrives.length > 0 ? (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Table>
|
2025-12-11 18:32:55 -07:00
|
|
|
<Table.Header>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.HeaderCell>Device</Table.HeaderCell>
|
|
|
|
|
<Table.HeaderCell>Health</Table.HeaderCell>
|
|
|
|
|
<Table.HeaderCell>Temperature</Table.HeaderCell>
|
|
|
|
|
<Table.HeaderCell>Actions</Table.HeaderCell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
</Table.Header>
|
|
|
|
|
<Table.Body>
|
|
|
|
|
{smartDrives.map((drive) => (
|
|
|
|
|
<Table.Row key={drive.device}>
|
|
|
|
|
<Table.Cell>{drive.device}</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<span style={{color: getHealthColor(drive.health || drive.assessment)}}>
|
|
|
|
|
●
|
|
|
|
|
</span>{' '}
|
2026-06-24 15:59:34 -06:00
|
|
|
{drive.health || drive.assessment || 'Unknown'}
|
2026-06-26 07:23:15 -06:00
|
|
|
{drive.smart_limited ? ' (limited)' : ''}
|
2025-12-11 18:32:55 -07:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
|
|
|
|
{drive.temperature !== null && drive.temperature !== undefined
|
|
|
|
|
? `${drive.temperature}°C`
|
|
|
|
|
: '-'}
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
|
|
|
|
<Button
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
size='sm'
|
|
|
|
|
role='cancel'
|
|
|
|
|
icon={IconInfoCircle}
|
2025-12-11 18:32:55 -07:00
|
|
|
onClick={() => handleShowDetails(drive)}
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
>
|
|
|
|
|
Details
|
|
|
|
|
</Button>
|
2025-12-11 18:32:55 -07:00
|
|
|
</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
))}
|
|
|
|
|
</Table.Body>
|
|
|
|
|
</Table>
|
|
|
|
|
) : (
|
|
|
|
|
<p>No SMART-capable drives detected.</p>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<SmartDetailsModal
|
|
|
|
|
drive={selectedDrive}
|
|
|
|
|
open={detailsOpen}
|
|
|
|
|
onClose={() => setDetailsOpen(false)}
|
|
|
|
|
/>
|
|
|
|
|
|
2025-12-16 15:06:41 -07:00
|
|
|
<MountModal
|
|
|
|
|
disk={selectedDisk}
|
|
|
|
|
open={mountModalOpen}
|
|
|
|
|
onClose={handleCloseMountModal}
|
|
|
|
|
onMount={fetchDiskInfo}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<Confirm
|
|
|
|
|
open={unmountConfirmOpen}
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
title='Unmount Disk'
|
|
|
|
|
destructive
|
|
|
|
|
confirmLabel='Unmount'
|
|
|
|
|
onCancel={() => {
|
|
|
|
|
setUnmountConfirmOpen(false);
|
|
|
|
|
setUnmountTarget(null);
|
|
|
|
|
}}
|
|
|
|
|
onConfirm={handleUnmountConfirm}
|
|
|
|
|
>
|
|
|
|
|
{unmountTarget === PRIMARY_MOUNT ? (
|
|
|
|
|
<div>
|
2026-07-23 19:09:23 -06:00
|
|
|
<p>Are you sure you want to unmount <code>{unmountTarget}</code>?</p>
|
|
|
|
|
<p>
|
|
|
|
|
This is the primary WROLPi drive. The WROLPi API service will
|
|
|
|
|
be <strong>stopped</strong> before unmounting, and your media will be
|
|
|
|
|
unavailable until a drive is mounted at <code>{PRIMARY_MOUNT}</code> and
|
|
|
|
|
the API service is started again.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
) : `Are you sure you want to unmount ${unmountTarget}?`}
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
</Confirm>
|
2025-12-16 15:06:41 -07:00
|
|
|
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Button role='cancel' icon='refresh' onClick={fetchDiskInfo} style={{marginTop: '1em'}}>
|
2025-12-11 18:32:55 -07:00
|
|
|
Refresh
|
|
|
|
|
</Button>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
</Panel>
|
2025-12-11 18:32:55 -07:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2026-03-28 16:28:47 -06:00
|
|
|
function SambaSection() {
|
|
|
|
|
const [status, setStatus] = React.useState(null);
|
|
|
|
|
const [loading, setLoading] = React.useState(true);
|
|
|
|
|
const [actionLoading, setActionLoading] = React.useState(false);
|
|
|
|
|
const [addOpen, setAddOpen] = React.useState(false);
|
|
|
|
|
const [shareAll, setShareAll] = React.useState(true);
|
|
|
|
|
const [newName, setNewName] = React.useState('');
|
|
|
|
|
const [newPath, setNewPath] = React.useState('');
|
|
|
|
|
const [newReadOnly, setNewReadOnly] = React.useState(true);
|
|
|
|
|
const [newComment, setNewComment] = React.useState('');
|
|
|
|
|
const [removeConfirmName, setRemoveConfirmName] = React.useState(null);
|
|
|
|
|
const dockerized = useDockerized();
|
|
|
|
|
const mediaDirectory = useMediaDirectory();
|
|
|
|
|
|
|
|
|
|
const fetchStatus = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const result = await getSambaStatus();
|
|
|
|
|
setStatus(result);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('Failed to fetch Samba status:', e);
|
|
|
|
|
} finally {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
fetchStatus();
|
|
|
|
|
const interval = setInterval(fetchStatus, 10000);
|
|
|
|
|
return () => clearInterval(interval);
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const handleAddShare = async () => {
|
|
|
|
|
if (!newName.trim()) return;
|
|
|
|
|
setActionLoading(true);
|
|
|
|
|
const absolutePath = shareAll
|
|
|
|
|
? mediaDirectory
|
|
|
|
|
: `${mediaDirectory}/${newPath.trim()}`;
|
|
|
|
|
try {
|
|
|
|
|
await addSambaShare(newName.trim(), absolutePath, newReadOnly, newComment.trim());
|
|
|
|
|
toast({type: 'success', title: 'Share Added', description: `Added share "${newName}"`, time: 3000});
|
|
|
|
|
setAddOpen(false);
|
|
|
|
|
setShareAll(true);
|
|
|
|
|
setNewName('');
|
|
|
|
|
setNewPath('');
|
|
|
|
|
setNewReadOnly(true);
|
|
|
|
|
setNewComment('');
|
|
|
|
|
await fetchStatus();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
toast({type: 'error', title: 'Add Share Failed', description: e.message, time: 5000});
|
|
|
|
|
} finally {
|
|
|
|
|
setActionLoading(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleRemoveShare = async (name) => {
|
|
|
|
|
setActionLoading(true);
|
|
|
|
|
try {
|
|
|
|
|
await removeSambaShare(name);
|
|
|
|
|
toast({type: 'success', title: 'Share Removed', description: `Removed share "${name}"`, time: 3000});
|
|
|
|
|
await fetchStatus();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
toast({type: 'error', title: 'Remove Share Failed', description: e.message, time: 5000});
|
|
|
|
|
} finally {
|
|
|
|
|
setActionLoading(false);
|
|
|
|
|
setRemoveConfirmName(null);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (loading) {
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
return <Panel><Loading/></Panel>;
|
2026-03-28 16:28:47 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!status || !status.available) {
|
|
|
|
|
if (dockerized) return null;
|
|
|
|
|
return (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Panel>
|
|
|
|
|
<Header as='h3' icon='folder open'>Network Shares (Samba)</Header>
|
|
|
|
|
<Message kind='info'>Samba is not available on this system.</Message>
|
|
|
|
|
</Panel>
|
2026-03-28 16:28:47 -06:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const shares = status.shares || [];
|
|
|
|
|
|
|
|
|
|
return (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Panel>
|
|
|
|
|
<Header as='h3' icon='folder open'>Network Shares (Samba)</Header>
|
2026-03-28 16:28:47 -06:00
|
|
|
|
|
|
|
|
<p>Configure directories to share over the local network. Start the smbd service to activate sharing.</p>
|
|
|
|
|
|
|
|
|
|
{shares.length > 0 && (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Table style={{marginTop: '1em'}}>
|
2026-03-28 16:28:47 -06:00
|
|
|
<Table.Header>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.HeaderCell>Name</Table.HeaderCell>
|
|
|
|
|
<Table.HeaderCell>Path</Table.HeaderCell>
|
|
|
|
|
<Table.HeaderCell>Read Only</Table.HeaderCell>
|
|
|
|
|
<Table.HeaderCell>Comment</Table.HeaderCell>
|
|
|
|
|
<Table.HeaderCell>Actions</Table.HeaderCell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
</Table.Header>
|
|
|
|
|
<Table.Body>
|
|
|
|
|
{shares.map(share => (
|
|
|
|
|
<Table.Row key={share.name}>
|
|
|
|
|
<Table.Cell>{share.name}</Table.Cell>
|
|
|
|
|
<Table.Cell><code>{share.path}</code></Table.Cell>
|
|
|
|
|
<Table.Cell>{share.read_only ? 'Yes' : 'No'}</Table.Cell>
|
|
|
|
|
<Table.Cell>{share.comment}</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<IconButton
|
2026-03-28 16:28:47 -06:00
|
|
|
icon='trash'
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
label={`Remove share "${share.name}"`}
|
|
|
|
|
role='danger'
|
|
|
|
|
size='xs'
|
2026-03-28 16:28:47 -06:00
|
|
|
disabled={actionLoading}
|
|
|
|
|
onClick={() => setRemoveConfirmName(share.name)}
|
|
|
|
|
/>
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
))}
|
|
|
|
|
</Table.Body>
|
|
|
|
|
</Table>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<Confirm
|
|
|
|
|
open={removeConfirmName !== null}
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
title='Remove Share'
|
|
|
|
|
confirmLabel='Remove'
|
|
|
|
|
destructive
|
2026-03-28 16:28:47 -06:00
|
|
|
onCancel={() => setRemoveConfirmName(null)}
|
|
|
|
|
onConfirm={() => handleRemoveShare(removeConfirmName)}
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
>
|
|
|
|
|
{`Remove the share "${removeConfirmName}"?`}
|
|
|
|
|
</Confirm>
|
2026-03-28 16:28:47 -06:00
|
|
|
|
|
|
|
|
<div style={{marginTop: '1em'}}>
|
|
|
|
|
<Button
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
role='primary'
|
2026-03-28 16:28:47 -06:00
|
|
|
icon='plus'
|
|
|
|
|
onClick={() => setAddOpen(true)}
|
|
|
|
|
disabled={actionLoading}
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
>
|
|
|
|
|
Add Share
|
|
|
|
|
</Button>
|
2026-03-28 16:28:47 -06:00
|
|
|
</div>
|
|
|
|
|
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Modal open={addOpen} onClose={() => {
|
|
|
|
|
setAddOpen(false);
|
|
|
|
|
setShareAll(true);
|
|
|
|
|
}} size='small'>
|
2026-03-28 16:28:47 -06:00
|
|
|
<Modal.Header>Add Samba Share</Modal.Header>
|
|
|
|
|
<Modal.Content>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<TextInput
|
|
|
|
|
label='Share Name'
|
|
|
|
|
placeholder='e.g. Documents'
|
|
|
|
|
value={newName}
|
|
|
|
|
onChange={(e) => setNewName(e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
<div style={{marginTop: '0.8em'}}>
|
|
|
|
|
<Checkbox
|
|
|
|
|
label='Share all files'
|
|
|
|
|
checked={shareAll}
|
|
|
|
|
onChange={(e) => setShareAll(e.currentTarget.checked)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
{!shareAll && (
|
|
|
|
|
<div style={{marginTop: '0.8em'}}>
|
|
|
|
|
<label>Path</label>
|
|
|
|
|
<DirectorySearch
|
|
|
|
|
onSelect={setNewPath}
|
|
|
|
|
value={newPath}
|
2026-03-28 16:28:47 -06:00
|
|
|
/>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
<div style={{marginTop: '0.8em'}}>
|
|
|
|
|
<Checkbox
|
|
|
|
|
label='Read Only'
|
|
|
|
|
checked={newReadOnly}
|
|
|
|
|
onChange={(e) => setNewReadOnly(e.currentTarget.checked)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<TextInput
|
|
|
|
|
style={{marginTop: '0.8em'}}
|
|
|
|
|
label='Comment (optional)'
|
|
|
|
|
placeholder='Description of this share'
|
|
|
|
|
value={newComment}
|
|
|
|
|
onChange={(e) => setNewComment(e.target.value)}
|
|
|
|
|
/>
|
2026-03-28 16:28:47 -06:00
|
|
|
</Modal.Content>
|
|
|
|
|
<Modal.Actions>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Button role='cancel' onClick={() => setAddOpen(false)}>Cancel</Button>
|
2026-03-28 16:28:47 -06:00
|
|
|
<Button
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
role='save'
|
2026-03-28 16:28:47 -06:00
|
|
|
icon='plus'
|
|
|
|
|
disabled={!newName.trim() || actionLoading}
|
|
|
|
|
loading={actionLoading}
|
|
|
|
|
onClick={handleAddShare}
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
>
|
|
|
|
|
Add Share
|
|
|
|
|
</Button>
|
2026-03-28 16:28:47 -06:00
|
|
|
</Modal.Actions>
|
|
|
|
|
</Modal>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
</Panel>
|
2026-03-28 16:28:47 -06:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2026-07-28 19:52:39 -06:00
|
|
|
// Human labels for the hotspot protocols reported by the Controller.
|
|
|
|
|
const hotspotProtocolLabels = {
|
|
|
|
|
wpa2: 'WPA2 (most compatible)',
|
|
|
|
|
wpa3: 'WPA3',
|
|
|
|
|
};
|
|
|
|
|
|
2026-07-04 08:22:24 -06:00
|
|
|
function HotspotSettingsForm() {
|
|
|
|
|
const dockerized = useDockerized();
|
|
|
|
|
const [devices, setDevices] = React.useState([]);
|
2026-07-28 19:52:39 -06:00
|
|
|
const [protocols, setProtocols] = React.useState([]);
|
|
|
|
|
const [form, setForm] = React.useState({device: '', ssid: '', password: '', protocol: ''});
|
2026-07-04 08:22:24 -06:00
|
|
|
const [loading, setLoading] = React.useState(true);
|
|
|
|
|
const [saving, setSaving] = React.useState(false);
|
|
|
|
|
const [qrOpen, setQrOpen] = React.useState(false);
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
const fetchSettings = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const [settings, devicesResponse] = await Promise.all([getHotspotSettings(), getHotspotDevices()]);
|
2026-07-28 19:52:39 -06:00
|
|
|
setForm({
|
|
|
|
|
device: settings.device,
|
|
|
|
|
ssid: settings.ssid,
|
|
|
|
|
password: settings.password,
|
|
|
|
|
protocol: settings.protocol,
|
|
|
|
|
});
|
2026-07-04 08:22:24 -06:00
|
|
|
setDevices(devicesResponse.devices || []);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('Failed to fetch hotspot settings', e);
|
|
|
|
|
} finally {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
fetchSettings();
|
|
|
|
|
}, []);
|
|
|
|
|
|
2026-07-28 19:52:39 -06:00
|
|
|
// The supported protocols depend on the selected device's hardware.
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (!form.device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-07-28 20:59:10 -06:00
|
|
|
// Ignore out-of-order responses when the user switches devices quickly.
|
|
|
|
|
let cancelled = false;
|
2026-07-28 19:52:39 -06:00
|
|
|
const fetchProtocols = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const response = await getHotspotProtocols(form.device);
|
2026-07-28 20:59:10 -06:00
|
|
|
if (cancelled) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const supported = response.protocols || [];
|
|
|
|
|
setProtocols(supported);
|
|
|
|
|
// Reset a selection the probed device does not support (e.g. WPA3 kept
|
|
|
|
|
// after switching to a WPA2-only adapter).
|
|
|
|
|
if (supported.length) {
|
|
|
|
|
setForm(f => supported.includes(f.protocol) ? f : {...f, protocol: supported[0]});
|
|
|
|
|
}
|
2026-07-28 19:52:39 -06:00
|
|
|
} catch (e) {
|
2026-07-28 20:59:10 -06:00
|
|
|
if (!cancelled) {
|
|
|
|
|
console.error('Failed to fetch hotspot protocols', e);
|
|
|
|
|
setProtocols([]);
|
|
|
|
|
}
|
2026-07-28 19:52:39 -06:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
fetchProtocols();
|
2026-07-28 20:59:10 -06:00
|
|
|
return () => {
|
|
|
|
|
cancelled = true;
|
|
|
|
|
};
|
2026-07-28 19:52:39 -06:00
|
|
|
}, [form.device]);
|
|
|
|
|
|
2026-07-04 08:22:24 -06:00
|
|
|
const handleSave = async () => {
|
|
|
|
|
setSaving(true);
|
|
|
|
|
try {
|
|
|
|
|
const settings = await updateHotspotSettings(form);
|
|
|
|
|
setForm(settings);
|
|
|
|
|
toast({type: 'success', title: 'Hotspot settings saved', time: 3000});
|
|
|
|
|
} catch (e) {
|
|
|
|
|
toast({type: 'error', title: 'Failed to save hotspot settings', description: e.message, time: 5000});
|
|
|
|
|
} finally {
|
|
|
|
|
setSaving(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (loading) {
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
return <Panel>
|
|
|
|
|
<Header as='h4' icon='wifi'>Hotspot Settings</Header>
|
|
|
|
|
<Loading size='xs'/>
|
|
|
|
|
</Panel>;
|
2026-07-04 08:22:24 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Keep the saved device selectable even if it is not currently present
|
|
|
|
|
// (e.g. a USB WiFi dongle is unplugged).
|
|
|
|
|
const deviceOptions = [...new Set([...devices, form.device].filter(Boolean))]
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
.map(device => ({value: device, label: device}));
|
2026-07-04 08:22:24 -06:00
|
|
|
|
2026-07-28 19:52:39 -06:00
|
|
|
// Keep the saved protocol selectable even if the device does not report it.
|
|
|
|
|
const protocolOptions = [...new Set([...protocols, form.protocol].filter(Boolean))]
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
.map(protocol => ({value: protocol, label: hotspotProtocolLabels[protocol] || protocol}));
|
2026-07-28 19:52:39 -06:00
|
|
|
|
2026-07-04 08:22:24 -06:00
|
|
|
// Special string which allows a mobile device to connect to a specific Wi-Fi.
|
2026-07-04 08:56:12 -06:00
|
|
|
// The WPA QR format requires backslash-escaping of \ ; , " in the SSID and password.
|
|
|
|
|
const escapeWifi = (s) => s.replace(/([\\;,"])/g, '\\$1');
|
|
|
|
|
const qrCodeValue = `WIFI:S:${escapeWifi(form.ssid)};T:WPA;P:${escapeWifi(form.password)};;`;
|
2026-07-04 08:22:24 -06:00
|
|
|
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
return <Panel>
|
|
|
|
|
<Header as='h4' icon='wifi'>Hotspot Settings</Header>
|
|
|
|
|
<Group grow align='flex-start'>
|
|
|
|
|
<TextInput
|
|
|
|
|
label='Hotspot SSID'
|
|
|
|
|
value={form.ssid}
|
|
|
|
|
disabled={dockerized || saving}
|
|
|
|
|
onChange={(e) => setForm({...form, ssid: e.target.value})}
|
|
|
|
|
/>
|
|
|
|
|
<TextInput
|
|
|
|
|
label='Hotspot Password'
|
|
|
|
|
value={form.password}
|
|
|
|
|
disabled={dockerized || saving}
|
|
|
|
|
onChange={(e) => setForm({...form, password: e.target.value})}
|
|
|
|
|
/>
|
|
|
|
|
<Select
|
|
|
|
|
label='Hotspot Device'
|
|
|
|
|
placeholder='No WiFi devices found'
|
|
|
|
|
data={deviceOptions}
|
|
|
|
|
value={form.device}
|
|
|
|
|
disabled={dockerized || saving}
|
|
|
|
|
onChange={(value) => setForm({...form, device: value})}
|
|
|
|
|
/>
|
|
|
|
|
<Select
|
|
|
|
|
label='Hotspot Protocol'
|
|
|
|
|
placeholder='No protocols supported'
|
|
|
|
|
data={protocolOptions}
|
|
|
|
|
value={form.protocol}
|
|
|
|
|
disabled={dockerized || saving}
|
|
|
|
|
onChange={(value) => setForm({...form, protocol: value})}
|
|
|
|
|
/>
|
|
|
|
|
</Group>
|
|
|
|
|
<div style={{marginTop: '0.8em'}}>
|
2026-07-04 09:16:44 -06:00
|
|
|
<Button
|
|
|
|
|
color='violet'
|
|
|
|
|
disabled={dockerized}
|
|
|
|
|
loading={saving}
|
|
|
|
|
onClick={handleSave}
|
|
|
|
|
>Save</Button>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<IconButton
|
|
|
|
|
icon='qrcode'
|
|
|
|
|
label='Scan this code to join the hotspot'
|
|
|
|
|
color='violet'
|
|
|
|
|
style={{marginLeft: '0.5em'}}
|
|
|
|
|
onClick={() => setQrOpen(true)}
|
|
|
|
|
/>
|
|
|
|
|
<Modal open={qrOpen} onClose={() => setQrOpen(false)} closeIcon>
|
2026-07-04 09:16:44 -06:00
|
|
|
<Modal.Header>Scan this code to join the hotspot</Modal.Header>
|
|
|
|
|
<Modal.Content>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
{/* `media`: filtered as a unit by night mode; a QR code needs real black-on-white
|
|
|
|
|
contrast to scan, so it is exempted the same way DonatePage's and Share's are. */}
|
|
|
|
|
<div className='media'
|
|
|
|
|
style={{display: 'inline-block', backgroundColor: '#ffffff', padding: '1em'}}>
|
2026-07-04 09:16:44 -06:00
|
|
|
<QRCode value={qrCodeValue} size={300}/>
|
|
|
|
|
</div>
|
|
|
|
|
</Modal.Content>
|
|
|
|
|
</Modal>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
</div>
|
|
|
|
|
</Panel>;
|
2026-07-04 08:22:24 -06:00
|
|
|
}
|
|
|
|
|
|
2025-12-11 18:32:55 -07:00
|
|
|
function AdminControlsSection() {
|
|
|
|
|
const dockerized = useDockerized();
|
|
|
|
|
|
|
|
|
|
return (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<Panel>
|
|
|
|
|
<Header as='h3' icon='settings'>Hardware Controls</Header>
|
2025-12-11 18:32:55 -07:00
|
|
|
|
|
|
|
|
<HotspotToggle/>
|
2026-03-28 10:09:58 -06:00
|
|
|
<BluetoothToggle/>
|
2026-07-29 14:57:28 -06:00
|
|
|
<DesktopToggle/>
|
controller: VNC toggle, gated on the Desktop running
Add a VNC toggle to the Controller (both UIs) that starts/stops whichever VNC
backend is installed: wayvnc for Wayland (Raspberry Pi OS), RealVNC for X11.
Runtime-only, like the Desktop toggle: the unit is never enabled, so VNC does
not return after a reboot. Users who want it permanently on can enable it with
raspi-config.
VNC serves the desktop session, so starting it without a desktop gives clients
a blank screen. The gate lives in the backend, not just the UI, so curl callers
get it too (409, distinct from a systemctl failure). Stopping is never gated so
a running VNC server can't be stranded on with no way to turn it off.
Backend selection deliberately avoids raspi-config's live-compositor probe
(pgrep labwc), which reports X11 — and would pick the wrong backend — whenever
the desktop is stopped. wayvnc also requires its config to exist; that is
checked directly rather than via the unit's ConditionResult, which reports 'no'
for any unit that has never been started.
Extracts _unit_properties()/_systemctl_unit() so Desktop and VNC share one
systemd probe and start/stop path.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-29 16:53:45 -06:00
|
|
|
<VncToggle/>
|
2025-12-11 18:32:55 -07:00
|
|
|
<ThrottleToggle/>
|
|
|
|
|
|
2026-07-04 09:16:44 -06:00
|
|
|
<HotspotSettingsForm/>
|
|
|
|
|
|
2025-12-11 18:32:55 -07:00
|
|
|
{!dockerized && (
|
|
|
|
|
<div style={{marginTop: '1em'}}>
|
|
|
|
|
<RestartButton/>
|
|
|
|
|
<ShutdownButton/>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
</Panel>
|
2025-12-11 18:32:55 -07:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function ControllerPage() {
|
|
|
|
|
return (
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
<div>
|
2025-12-11 18:32:55 -07:00
|
|
|
<AdminControlsSection/>
|
|
|
|
|
<ServicesSection/>
|
2026-03-28 16:28:47 -06:00
|
|
|
<SambaSection/>
|
2025-12-11 18:32:55 -07:00
|
|
|
<DiskSection/>
|
ui: migrate ControllerPage.js off Semantic UI onto the token component library
Replaces semantic-ui-react and Theme.tsx imports with components from
components/ui (Panel, Table, Modal, Confirm, Status, Select, TextInput,
Checkbox, IconButton, Message). Preserves every confirmation, disabled
state, and polling interval; service status now maps onto Status'
complete/active/pending/failed kinds instead of a raw color. Repairs
ControllerPage.test.js to render inside MantineProvider and to find the
unmount Confirm button by dialog role instead of DOM-order position,
since Mantine portals the modal ahead of the page content. Drops
ControllerPage.js from semantic-baseline.json now that it's migrated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:23:59 -06:00
|
|
|
</div>
|
2025-12-11 18:32:55 -07:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default ControllerPage;
|