164 lines
4.4 KiB
QML
164 lines
4.4 KiB
QML
import QtQuick
|
|
import "../services" as S
|
|
|
|
Column {
|
|
id: root
|
|
|
|
required property color accentColor
|
|
property bool active: true
|
|
|
|
// Section header: state label + unit count
|
|
Item {
|
|
width: root.width
|
|
height: 28
|
|
|
|
Text {
|
|
anchors.left: parent.left
|
|
anchors.leftMargin: 12
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
text: "SYSTEM"
|
|
color: S.Theme.base03
|
|
font.pixelSize: S.Theme.fontSize - 3
|
|
font.family: S.Theme.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 S.Theme.base0B;
|
|
if (st === "degraded")
|
|
return S.Theme.base0A;
|
|
return S.Theme.base08;
|
|
}
|
|
opacity: 0.85
|
|
radius: 3
|
|
width: _sysStateLbl.width + 8
|
|
height: 14
|
|
|
|
Text {
|
|
id: _sysStateLbl
|
|
anchors.centerIn: parent
|
|
text: S.SystemdService.systemState
|
|
color: S.Theme.base00
|
|
font.pixelSize: S.Theme.fontSize - 3
|
|
font.family: S.Theme.fontFamily
|
|
}
|
|
}
|
|
}
|
|
|
|
Repeater {
|
|
model: S.SystemdService.systemUnits
|
|
|
|
delegate: SystemdUnitRow {
|
|
required property var modelData
|
|
unitName: modelData.name
|
|
description: modelData.description
|
|
subState: modelData.subState
|
|
isUser: false
|
|
machineName: ""
|
|
accentColor: root.accentColor
|
|
onHeightChanged: root.keepPanelOpen?.(300)
|
|
}
|
|
}
|
|
|
|
Item {
|
|
visible: S.SystemdService.systemUnits.length === 0
|
|
width: root.width
|
|
height: 24
|
|
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: "no failed system units"
|
|
color: S.Theme.base0B
|
|
font.pixelSize: S.Theme.fontSize - 2
|
|
font.family: S.Theme.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: S.Theme.base03
|
|
font.pixelSize: S.Theme.fontSize - 3
|
|
font.family: S.Theme.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 S.Theme.base0B;
|
|
if (st === "degraded")
|
|
return S.Theme.base0A;
|
|
return S.Theme.base08;
|
|
}
|
|
opacity: 0.85
|
|
radius: 3
|
|
width: _userStateLbl.width + 8
|
|
height: 14
|
|
|
|
Text {
|
|
id: _userStateLbl
|
|
anchors.centerIn: parent
|
|
text: S.SystemdService.userState
|
|
color: S.Theme.base00
|
|
font.pixelSize: S.Theme.fontSize - 3
|
|
font.family: S.Theme.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.keepPanelOpen?.(300)
|
|
}
|
|
}
|
|
|
|
Item {
|
|
visible: S.SystemdService.userUnits.length === 0
|
|
width: root.width
|
|
height: 24
|
|
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: "no failed user units"
|
|
color: S.Theme.base0B
|
|
font.pixelSize: S.Theme.fontSize - 2
|
|
font.family: S.Theme.fontFamily
|
|
}
|
|
}
|
|
|
|
Item {
|
|
width: 1
|
|
height: 4
|
|
}
|
|
}
|