merge systemd + machinectl into one module/applet (step 1)
This commit is contained in:
parent
96bfc1fd5a
commit
6fc7e8bc8a
16 changed files with 261 additions and 1029 deletions
|
|
@ -9,156 +9,43 @@ Column {
|
|||
|
||||
required property color accentColor
|
||||
property bool active: true
|
||||
// Emitted when content resizes; parent can connect to extend panel-close grace.
|
||||
signal contentResized
|
||||
|
||||
// Section header: state label + unit count
|
||||
Item {
|
||||
onHeightChanged: root.contentResized()
|
||||
|
||||
// Local machine header + units
|
||||
SystemdMachineSection {
|
||||
width: root.width
|
||||
height: 28
|
||||
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "SYSTEM"
|
||||
color: NS.ThemeService.base03
|
||||
font.pixelSize: NS.ThemeService.fontSize - 3
|
||||
font.family: NS.ThemeService.fontFamily
|
||||
font.letterSpacing: 1
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: S.SystemdService.systemState !== "unknown"
|
||||
color: {
|
||||
const st = S.SystemdService.systemState;
|
||||
if (st === "running")
|
||||
return NS.ThemeService.base0B;
|
||||
if (st === "degraded")
|
||||
return NS.ThemeService.base0A;
|
||||
return NS.ThemeService.base08;
|
||||
}
|
||||
opacity: 0.85
|
||||
radius: 3
|
||||
width: _sysStateLbl.width + 8
|
||||
height: 14
|
||||
|
||||
Text {
|
||||
id: _sysStateLbl
|
||||
anchors.centerIn: parent
|
||||
text: S.SystemdService.systemState
|
||||
color: NS.ThemeService.base00
|
||||
font.pixelSize: NS.ThemeService.fontSize - 3
|
||||
font.family: NS.ThemeService.fontFamily
|
||||
}
|
||||
}
|
||||
accentColor: root.accentColor
|
||||
machineName: ""
|
||||
title: S.SystemdService.hostname
|
||||
marker: " this machine"
|
||||
systemState: S.SystemdService.systemState
|
||||
units: S.SystemdService.failedUnits
|
||||
startExpanded: true
|
||||
}
|
||||
|
||||
// Containers
|
||||
Repeater {
|
||||
model: S.SystemdService.systemUnits
|
||||
model: S.SystemdService.containers
|
||||
|
||||
delegate: SystemdUnitRow {
|
||||
delegate: Column {
|
||||
id: _row
|
||||
required property var modelData
|
||||
unitName: modelData.name
|
||||
description: modelData.description
|
||||
subState: modelData.subState
|
||||
isUser: false
|
||||
machineName: ""
|
||||
accentColor: root.accentColor
|
||||
onHeightChanged: root.contentResized()
|
||||
}
|
||||
}
|
||||
width: root.width
|
||||
|
||||
Item {
|
||||
visible: S.SystemdService.systemUnits.length === 0
|
||||
width: root.width
|
||||
height: 24
|
||||
Separator {}
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "no failed system units"
|
||||
color: NS.ThemeService.base0B
|
||||
font.pixelSize: NS.ThemeService.fontSize - 2
|
||||
font.family: NS.ThemeService.fontFamily
|
||||
}
|
||||
}
|
||||
|
||||
Separator {}
|
||||
|
||||
// User section
|
||||
Item {
|
||||
width: root.width
|
||||
height: 28
|
||||
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "USER"
|
||||
color: NS.ThemeService.base03
|
||||
font.pixelSize: NS.ThemeService.fontSize - 3
|
||||
font.family: NS.ThemeService.fontFamily
|
||||
font.letterSpacing: 1
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: S.SystemdService.userState !== "unknown"
|
||||
color: {
|
||||
const st = S.SystemdService.userState;
|
||||
if (st === "running")
|
||||
return NS.ThemeService.base0B;
|
||||
if (st === "degraded")
|
||||
return NS.ThemeService.base0A;
|
||||
return NS.ThemeService.base08;
|
||||
SystemdMachineSection {
|
||||
width: _row.width
|
||||
accentColor: root.accentColor
|
||||
machineName: _row.modelData.name
|
||||
title: _row.modelData.name
|
||||
marker: ""
|
||||
systemState: _row.modelData.systemState ?? "unknown"
|
||||
units: _row.modelData.failedUnits ?? []
|
||||
startExpanded: (_row.modelData.failedUnits ?? []).length > 0
|
||||
}
|
||||
opacity: 0.85
|
||||
radius: 3
|
||||
width: _userStateLbl.width + 8
|
||||
height: 14
|
||||
|
||||
Text {
|
||||
id: _userStateLbl
|
||||
anchors.centerIn: parent
|
||||
text: S.SystemdService.userState
|
||||
color: NS.ThemeService.base00
|
||||
font.pixelSize: NS.ThemeService.fontSize - 3
|
||||
font.family: NS.ThemeService.fontFamily
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: S.SystemdService.userUnits
|
||||
|
||||
delegate: SystemdUnitRow {
|
||||
required property var modelData
|
||||
unitName: modelData.name
|
||||
description: modelData.description
|
||||
subState: modelData.subState
|
||||
isUser: true
|
||||
machineName: ""
|
||||
accentColor: root.accentColor
|
||||
onHeightChanged: root.contentResized()
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
visible: S.SystemdService.userUnits.length === 0
|
||||
width: root.width
|
||||
height: 24
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "no failed user units"
|
||||
color: NS.ThemeService.base0B
|
||||
font.pixelSize: NS.ThemeService.fontSize - 2
|
||||
font.family: NS.ThemeService.fontFamily
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue