lib/api, lib/connections, gui: Show connection error for disconnected devices (fixes #3345) (#5727)

* lib/api, lib/connections, gui: Show connection error for disconnected devices (fixes #3345)

This adds functionality in the connetions service to track the last
error per address. That is in turn exposed in the /rest/system/status
API method, as that is also where we already show the listener status
from the connection service.

The GUI uses this info where it lists addresses, showing errors (if any)
in red underneath each address.

I also slightly refactored the existing status method on the connection
service to have a better name and return typed information.

* ok

* review

* formatting

* review
This commit is contained in:
Jakob Borg
2019-05-16 23:11:46 +02:00
committed by Audrius Butkevicius
parent 1da9317a09
commit 2c866277a2
6 changed files with 88 additions and 15 deletions

View File

@@ -2406,4 +2406,14 @@ angular.module('syncthing.core')
$scope.saveConfig();
}
};
$scope.abbreviatedError = function (addr) {
var status = $scope.system.lastDialStatus[addr];
if (!status || !status.error) {
return null;
}
var time = $filter('date')(status.when, "HH:mm:ss")
var err = status.error.replace(/.+: /, '');
return err + " (" + time + ")";
}
});