systemd applet: aggregate counts + lazy running list (step 2)
This commit is contained in:
parent
6fc7e8bc8a
commit
3fb9a36f3b
4 changed files with 212 additions and 125 deletions
|
|
@ -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 [];
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue