Files

39 lines
1.2 KiB
QML

import Quickshell
import QtQuick
import QtQuick.Layouts
import "../shared" as Shared
BarPill {
groupName: "kubernetes"
accentColor: {
let s = Shared.Kubernetes.status;
if (s === "ok") return Shared.Theme.green;
if (s === "degraded") return Shared.Theme.yellow;
if (s === "error") return Shared.Theme.red;
if (s === "stale") return Shared.Theme.overlay0;
return Shared.Theme.blue;
}
readonly property color statusColor: accentColor
content: [
Text {
Layout.alignment: Qt.AlignHCenter
text: "\u{f03be}" // nf-md-kubernetes
color: statusColor
font.pixelSize: Shared.Theme.fontLarge
font.family: Shared.Theme.iconFont
},
Text {
Layout.alignment: Qt.AlignHCenter
text: (Shared.Kubernetes.status === "loading" || Shared.Kubernetes.totalCount === 0)
? "…"
: Shared.Kubernetes.readyCount + "/" + Shared.Kubernetes.totalCount
color: statusColor
font.pixelSize: Shared.Theme.fontSmall
font.family: Shared.Theme.fontFamily
font.bold: true
}
]
}