diff --git a/src/qml/CMakeLists.txt b/src/qml/CMakeLists.txt
index b7e8697..8850f6d 100644
--- a/src/qml/CMakeLists.txt
+++ b/src/qml/CMakeLists.txt
@@ -135,6 +135,7 @@ qt_add_qml_module(appqml
LogosStorageLayout.qml
PortForwarding.qml
ErrorToast.qml
+ HealthIndicator.qml
)
# Set up QML module directory for runtime
diff --git a/src/qml/HealthIndicator.qml b/src/qml/HealthIndicator.qml
new file mode 100644
index 0000000..74a7aa2
--- /dev/null
+++ b/src/qml/HealthIndicator.qml
@@ -0,0 +1,78 @@
+import QtQuick
+
+Item {
+ id: root
+
+ property bool nodeIsUp: false
+ property var backend: mockBackend
+ readonly property int running: 2
+
+ Timer {
+ readonly property int threeMinutes: 180000
+
+ interval: threeMinutes
+ repeat: true
+ running: root.backend.status == root.running
+ triggeredOnStart: true
+ onTriggered: root.backend.checkNodeIsUp()
+ }
+
+ Connections {
+ target: root.backend
+
+ function onNodeIsUp() {
+ root.nodeIsUp = true
+ }
+
+ function onNodeIsntUp(reason) {
+ root.nodeIsUp = false
+ }
+
+ function onStatusChanged() {
+ if (root.backend.status !== root.running) {
+ root.nodeIsUp = false
+ }
+ }
+ }
+
+ property bool blinkOn: true
+
+ Timer {
+ interval: 600
+ repeat: true
+ running: true
+ onTriggered: root.blinkOn = !root.blinkOn
+ }
+
+ Row {
+ id: nodeStatusBadge
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.topMargin: 18
+ anchors.rightMargin: 20
+ spacing: 7
+
+ Rectangle {
+ width: 10
+ height: 10
+ radius: 5
+ anchors.verticalCenter: parent.verticalCenter
+ color: root.nodeIsUp ? "#4CAF50" : "#f44336"
+ opacity: root.blinkOn ? 1.0 : 0.15
+ }
+
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: root.nodeIsUp ? "Node reachable" : "Node unreachable"
+ color: root.nodeIsUp ? "#4CAF50" : "#f44336"
+ font.pixelSize: 12
+ }
+ }
+
+ QtObject {
+ id: mockBackend
+
+ signal nodeIsUp
+ signal nodeIsntUp(string reason)
+ }
+}
diff --git a/src/qml/StorageView.qml b/src/qml/StorageView.qml
index 4e45207..d18e5dc 100644
--- a/src/qml/StorageView.qml
+++ b/src/qml/StorageView.qml
@@ -5,13 +5,8 @@ import QtQuick.Layouts
import QtCore
// qmllint disable unqualified
-Rectangle {
+LogosStorageLayout {
id: root
- Layout.fillWidth: true
- Layout.fillHeight: true
- implicitWidth: 800
- implicitHeight: 800
- color: "#000000"
property var backend: mockBackend
readonly property int stopped: 0
@@ -92,6 +87,11 @@ Rectangle {
return (bytes / (1024 * 1024 * 1024)).toFixed(2) + " GB"
}
+ HealthIndicator {
+ backend: root.backend
+ anchors.fill: parent
+ }
+
Text {
id: statusTextElement
objectName: "status"
diff --git a/src/storage_resources.qrc b/src/storage_resources.qrc
index a43bd09..fe9cd5e 100644
--- a/src/storage_resources.qrc
+++ b/src/storage_resources.qrc
@@ -9,5 +9,6 @@
qml/LogosStorageLayout.qml
qml/PortForwarding.qml
qml/ErrorToast.qml
+ qml/HealthIndicator.qml