systemd applet: aggregate counts + lazy running list (step 2)

This commit is contained in:
Damocles 2026-05-07 19:01:42 +02:00
commit 3fb9a36f3b
4 changed files with 212 additions and 125 deletions

View file

@ -4,29 +4,18 @@ import QtQuick
import NovaStats as NS
// Thin wrapper around NS.SystemdService: drives the poll Timer and parses the
// JSON-encoded list properties into JS arrays for QML consumers. Restart helper
// proxies through to the Rust singleton.
// JSON-encoded machine tree into a JS array for QML consumers.
QtObject {
id: root
readonly property string hostname: NS.SystemdService.hostname
readonly property string systemState: NS.SystemdService.systemState
readonly property string userState: NS.SystemdService.userState
readonly property int failedCount: NS.SystemdService.failedCount
// Parsed [{ name, description, subState, scope, machine }, ...]
readonly property var failedUnits: {
// [{ name, isLocal, marker, systemState, runningCount, totalCount,
// failedUnits: [...], runningUnits: [...] }, ...]
readonly property var machines: {
try {
return JSON.parse(NS.SystemdService.failedUnitsJson);
} catch (e) {
return [];
}
}
// Parsed [{ name, class, service, systemState, failedUnits: [...] }, ...]
readonly property var containers: {
try {
return JSON.parse(NS.SystemdService.containersJson);
return JSON.parse(NS.SystemdService.machinesJson);
} catch (e) {
return [];
}