From b420b2485ef95db00e874f857263c10bf70801f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Wilczy=C5=84ski?= Date: Sun, 11 Sep 2022 18:54:39 +0200 Subject: [PATCH] gui: Mark devices that haven't connected for a long time (fixes #7703) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, a disconnected device is marked as just "Disconnected" without any consideration whether it has been in the state for just a short period of time or rather much longer. This commit adds a new state called "Disconnected (Stale)" which is shown for devices that have been disconnected for longer than a month. It also changes the "Last seen" information, so that "Never" is used only when the device hasn't connected at all, and it displays the exact date otherwise. Additionally, when the date is older than 1 month, it shows that information below in orange, and when it is older than a year, it shows it in red. This provides the user with a visual clue that something may potentially be wrong and needs their intervention. Signed-off-by: Tomasz WilczyƄski --- gui/default/index.html | 18 ++++++++++++++++-- .../syncthing/core/syncthingController.js | 6 +++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/gui/default/index.html b/gui/default/index.html index 3a463ac6ad4..4b9f167352d 100644 --- a/gui/default/index.html +++ b/gui/default/index.html @@ -744,6 +744,7 @@

+
{{deviceName(deviceCfg)}}
@@ -755,8 +756,21 @@

 Last seen - Never - {{deviceStats[deviceCfg.deviceID].lastSeen | date:"yyyy-MM-dd HH:mm:ss"}} + +
+ Never +
+
+
+ {{deviceStats[deviceCfg.deviceID].lastSeen | date:"yyyy-MM-dd HH:mm:ss"}} +
+
+ More than a week ago + More than a month ago + More than a year ago +
+
+  Sync Status diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 8b998a14286..451637ccf5e 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -1094,7 +1094,11 @@ angular.module('syncthing.core') } // Disconnected - return status + 'disconnected'; + if ($scope.deviceStats[deviceCfg.deviceID].lastSeenDays >= 7) { + return 'disconnected-stale'; + } else { + return status + 'disconnected'; + } }; $scope.deviceClass = function (deviceCfg) {