fix: deduplicate status color and guard stale 0/0 in KubernetesPill

This commit is contained in:
2026-04-22 01:45:02 +02:00
parent 222e01c562
commit 7261824837

View File

@@ -14,34 +14,22 @@ BarPill {
return Shared.Theme.blue;
}
readonly property color statusColor: accentColor
content: [
Text {
Layout.alignment: Qt.AlignHCenter
text: "\u{f03be}"
color: {
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;
}
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"
text: (Shared.Kubernetes.status === "loading" || Shared.Kubernetes.totalCount === 0)
? "…"
: Shared.Kubernetes.readyCount + "/" + Shared.Kubernetes.totalCount
color: {
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;
}
color: statusColor
font.pixelSize: Shared.Theme.fontSmall
font.family: Shared.Theme.fontFamily
font.bold: true