pragma ComponentBehavior: Bound import QtQuick import "../services" as S import NovaStats as NS // One section of the systemd applet: a header with title + state chip, // expandable list of failed units underneath. 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 var units property bool startExpanded: false width: parent?.width ?? 0 property bool _expanded: startExpanded Item { width: root.width height: 32 Rectangle { anchors.fill: parent anchors.leftMargin: 4 anchors.rightMargin: 4 color: _hdrHover.hovered ? NS.ThemeService.base02 : "transparent" radius: NS.ThemeService.radius z: -1 } HoverHandler { id: _hdrHover } Text { anchors.left: parent.left anchors.leftMargin: 12 anchors.right: _stateChip.left anchors.rightMargin: 6 anchors.verticalCenter: parent.verticalCenter text: root.title + (root.marker !== "" ? " " + root.marker : "") color: NS.ThemeService.base05 font.pixelSize: NS.ThemeService.fontSize font.family: NS.ThemeService.fontFamily elide: Text.ElideRight } Rectangle { id: _stateChip anchors.right: _chevron.left anchors.rightMargin: 8 anchors.verticalCenter: parent.verticalCenter visible: root.systemState !== "unknown" color: { const st = root.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: _stateLbl.width + 8 height: 14 Text { id: _stateLbl anchors.centerIn: parent text: root.systemState color: NS.ThemeService.base00 font.pixelSize: NS.ThemeService.fontSize - 3 font.family: NS.ThemeService.fontFamily } } Text { id: _chevron anchors.right: parent.right anchors.rightMargin: 12 anchors.verticalCenter: parent.verticalCenter text: root._expanded ? "" : "" color: NS.ThemeService.base04 font.pixelSize: NS.ThemeService.fontSize - 2 font.family: NS.ThemeService.iconFontFamily } TapHandler { onTapped: root._expanded = !root._expanded } } Repeater { model: root._expanded ? root.units : [] delegate: SystemdUnitRow { required property var modelData unitName: modelData.name description: modelData.description ?? "" subState: modelData.subState ?? "" scope: modelData.scope ?? "system" machineName: root.machineName accentColor: root.accentColor } } }