harbour-server 0.1.0: schermata parametri server (schema status/1)
Prima release dell'app Sailfish: schermata unica con CPU, memoria, disco, container, backup, servizi, SSH, aggiornamenti e VPN, letti da un endpoint read-only /v1/status. Soglie giallo/rosso, aggiornamento ogni 60 s, copertina, impostazioni con indirizzo e token.
This commit is contained in:
commit
24e1f3b376
20 files changed
+1112
No files matched your search
@@ -0,0 +1,79 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import "../components"
|
||||
|
||||
// Un parametro in una card: titolo a sinistra, valore a destra, riga di
|
||||
// dettaglio e barra opzionale. level: 0 = ok, 1 = attenzione, 2 = critico.
|
||||
Rectangle {
|
||||
id: card
|
||||
|
||||
property string title
|
||||
property string value
|
||||
property string detail
|
||||
property real progress: -1
|
||||
property int level: 0
|
||||
|
||||
function levelColor() {
|
||||
if (level === 2) return "#e53935"
|
||||
if (level === 1) return "#ffb300"
|
||||
return "#43a047"
|
||||
}
|
||||
|
||||
width: parent ? parent.width : 0
|
||||
height: content.height + 2 * Theme.paddingMedium
|
||||
radius: Theme.paddingSmall
|
||||
color: Theme.rgba(Theme.highlightBackgroundColor, 0.08)
|
||||
|
||||
Column {
|
||||
id: content
|
||||
x: Theme.paddingMedium
|
||||
y: Theme.paddingMedium
|
||||
width: parent.width - 2 * Theme.paddingMedium
|
||||
spacing: Theme.paddingSmall / 2
|
||||
|
||||
Row {
|
||||
width: parent.width
|
||||
|
||||
Label {
|
||||
text: card.title
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.secondaryColor
|
||||
width: parent.width * 0.55
|
||||
truncationMode: TruncationMode.Fade
|
||||
}
|
||||
|
||||
Label {
|
||||
text: card.value
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: card.level === 0 ? Theme.primaryColor : card.levelColor()
|
||||
horizontalAlignment: Text.AlignRight
|
||||
width: parent.width * 0.45
|
||||
truncationMode: TruncationMode.Fade
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: card.detail
|
||||
visible: card.detail !== ""
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
color: Theme.secondaryColor
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: card.progress >= 0
|
||||
width: parent.width
|
||||
height: 4
|
||||
radius: 2
|
||||
color: Theme.rgba(Theme.primaryColor, 0.15)
|
||||
|
||||
Rectangle {
|
||||
width: parent.width * Math.max(0, Math.min(100, card.progress)) / 100
|
||||
height: parent.height
|
||||
radius: 2
|
||||
color: card.levelColor()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user