import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import org.kde.kirigami as Kirigami
import org.kde.kcmutils as KCM
import "Grafana.js" as G
KCM.SimpleKCM {
id: configBehavior
property string cfg_timeRange: ""
property alias cfg_refreshSeconds: refreshSpin.value
property alias cfg_pinnedSeconds: pinnedSpin.value
property alias cfg_rowHeight: rowHeightSpin.value
readonly property var ranges: ["", "now-15m", "now-1h", "now-3h", "now-6h", "now-12h", "now-24h", "now-2d", "now-7d", "now-30d"]
Kirigami.FormLayout {
QQC2.ComboBox {
Kirigami.FormData.label: i18n("Time range:")
model: configBehavior.ranges.map(function(r) { return r === "" ? i18n("Each dashboard's own") : G.rangeLabel({ from: r, to: "now" }) })
currentIndex: Math.max(0, configBehavior.ranges.indexOf(configBehavior.cfg_timeRange))
onActivated: function(i) { configBehavior.cfg_timeRange = configBehavior.ranges[i] }
}
QQC2.SpinBox {
id: refreshSpin
Kirigami.FormData.label: i18n("Refresh every (seconds):")
from: 0
to: 86400
stepSize: 10
textFromValue: function(v) { return v === 0 ? i18n("dashboard's own") : String(v) }
valueFromText: function(t) { return parseInt(t) || 0 }
}
QQC2.Label {
Layout.fillWidth: true
wrapMode: Text.WordWrap
font: Kirigami.Theme.smallFont
color: Kirigami.Theme.disabledTextColor
text: i18n("Only the dashboard on screen refreshes, and only while the popup is open (always, on the desktop). 10 seconds at the least.")
}
QQC2.SpinBox {
id: pinnedSpin
Kirigami.FormData.label: i18n("Pinned values every (seconds):")
from: 10
to: 3600
stepSize: 10
}
QQC2.SpinBox {
id: rowHeightSpin
Kirigami.FormData.label: i18n("Grid row height (px):")
from: 16
to: 80
}
QQC2.Label {
Layout.fillWidth: true
wrapMode: Text.WordWrap
font: Kirigami.Theme.smallFont
color: Kirigami.Theme.disabledTextColor
text: i18n("Grafana lays panels out in rows of 30px. Smaller fits more of a dashboard in the popup.")
}
}
}
neiam
/grafana-plasmoid
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
2.4 KiB · text
History
35c3541