systemd: container/remote restart, permanent-error backoff, recursive section via loader (step 6)
This commit is contained in:
parent
5676b1ac62
commit
dfa3840d97
6 changed files with 118 additions and 56 deletions
|
|
@ -32,7 +32,8 @@ Column {
|
|||
SystemdMachineSection {
|
||||
width: _row.width
|
||||
accentColor: root.accentColor
|
||||
machineName: _row.modelData.isLocal ? "" : _row.modelData.name
|
||||
hostTarget: _row.modelData.isLocal ? "" : _row.modelData.name
|
||||
machineName: ""
|
||||
title: _row.modelData.name
|
||||
marker: _row.modelData.marker ?? ""
|
||||
systemState: _row.modelData.systemState ?? "unknown"
|
||||
|
|
|
|||
|
|
@ -10,15 +10,17 @@ import NovaStats as NS
|
|||
Column {
|
||||
id: root
|
||||
|
||||
required property color accentColor
|
||||
required property string machineName
|
||||
required property string title
|
||||
required property string marker
|
||||
required property string systemState
|
||||
required property int runningCount
|
||||
required property int totalCount
|
||||
required property var failedUnits
|
||||
required property var runningUnits
|
||||
property color accentColor
|
||||
// SSH target string (for remote hosts/their containers); "" for local-side entries.
|
||||
property string hostTarget: ""
|
||||
property string machineName: ""
|
||||
property string title: ""
|
||||
property string marker: ""
|
||||
property string systemState: "unknown"
|
||||
property int runningCount: 0
|
||||
property int totalCount: 0
|
||||
property var failedUnits: []
|
||||
property var runningUnits: []
|
||||
property string errorKind: ""
|
||||
property string errorReason: ""
|
||||
property int lastSeen: 0
|
||||
|
|
@ -169,6 +171,7 @@ Column {
|
|||
description: modelData.description ?? ""
|
||||
subState: modelData.subState ?? ""
|
||||
scope: modelData.scope ?? "system"
|
||||
hostTarget: root.hostTarget
|
||||
machineName: root.machineName
|
||||
accentColor: root.accentColor
|
||||
}
|
||||
|
|
@ -229,40 +232,47 @@ Column {
|
|||
description: modelData.description ?? ""
|
||||
subState: modelData.subState ?? ""
|
||||
scope: modelData.scope ?? "system"
|
||||
hostTarget: root.hostTarget
|
||||
machineName: root.machineName
|
||||
accentColor: root.accentColor
|
||||
}
|
||||
}
|
||||
|
||||
// Nested containers running on this machine. Indented to convey hierarchy.
|
||||
// QML disallows direct recursive component use, so we load the same .qml
|
||||
// by source path through a Loader to break the static graph.
|
||||
Repeater {
|
||||
model: root.containers ?? []
|
||||
delegate: Item {
|
||||
id: _childWrap
|
||||
required property var modelData
|
||||
width: root.width
|
||||
height: _child.height + 4
|
||||
height: _childLoader.height + 4
|
||||
|
||||
SystemdMachineSection {
|
||||
id: _child
|
||||
Loader {
|
||||
id: _childLoader
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 16
|
||||
width: parent.width - 16
|
||||
accentColor: root.accentColor
|
||||
machineName: _childWrap.modelData.name
|
||||
title: _childWrap.modelData.name
|
||||
marker: _childWrap.modelData.marker ?? ""
|
||||
systemState: _childWrap.modelData.systemState ?? "unknown"
|
||||
runningCount: _childWrap.modelData.runningCount ?? 0
|
||||
totalCount: _childWrap.modelData.totalCount ?? 0
|
||||
failedUnits: _childWrap.modelData.failedUnits ?? []
|
||||
runningUnits: _childWrap.modelData.runningUnits ?? []
|
||||
errorKind: _childWrap.modelData.errorKind ?? ""
|
||||
errorReason: _childWrap.modelData.errorReason ?? ""
|
||||
lastSeen: _childWrap.modelData.lastSeen ?? 0
|
||||
containers: _childWrap.modelData.containers ?? []
|
||||
depth: root.depth + 1
|
||||
onContentResized: root.contentResized()
|
||||
source: "SystemdMachineSection.qml"
|
||||
onLoaded: {
|
||||
item.accentColor = root.accentColor;
|
||||
item.hostTarget = root.hostTarget;
|
||||
item.machineName = _childWrap.modelData.name;
|
||||
item.title = _childWrap.modelData.name;
|
||||
item.marker = _childWrap.modelData.marker ?? "";
|
||||
item.systemState = _childWrap.modelData.systemState ?? "unknown";
|
||||
item.runningCount = _childWrap.modelData.runningCount ?? 0;
|
||||
item.totalCount = _childWrap.modelData.totalCount ?? 0;
|
||||
item.failedUnits = _childWrap.modelData.failedUnits ?? [];
|
||||
item.runningUnits = _childWrap.modelData.runningUnits ?? [];
|
||||
item.errorKind = _childWrap.modelData.errorKind ?? "";
|
||||
item.errorReason = _childWrap.modelData.errorReason ?? "";
|
||||
item.lastSeen = _childWrap.modelData.lastSeen ?? 0;
|
||||
item.containers = _childWrap.modelData.containers ?? [];
|
||||
item.depth = root.depth + 1;
|
||||
item.contentResized.connect(root.contentResized);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ Item {
|
|||
required property string description
|
||||
required property string subState
|
||||
required property string scope
|
||||
required property string hostTarget
|
||||
required property string machineName
|
||||
required property color accentColor
|
||||
|
||||
|
|
@ -96,7 +97,7 @@ Item {
|
|||
}
|
||||
TapHandler {
|
||||
enabled: _rowHover.hovered
|
||||
onTapped: S.SystemdService.restartUnit(root.unitName, root.scope, root.machineName)
|
||||
onTapped: S.SystemdService.restartUnit(root.unitName, root.scope, root.hostTarget, root.machineName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ QtObject {
|
|||
}
|
||||
}
|
||||
|
||||
function restartUnit(name, scope, machine) {
|
||||
NS.SystemdService.restartUnit(name, scope ?? "system", machine ?? "");
|
||||
function restartUnit(name, scope, host, machine) {
|
||||
NS.SystemdService.restartUnit(name, scope ?? "system", host ?? "", machine ?? "");
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue