|
|
@@ -5,13 +5,12 @@
|
|
|
|
|
|
var syncthing = angular.module('syncthing', []);
|
|
|
var urlbase = 'rest';
|
|
|
-var refreshInterval = 10000; // ms
|
|
|
|
|
|
syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
|
|
var prevDate = 0;
|
|
|
+ var getOK = true;
|
|
|
var restarting = false;
|
|
|
|
|
|
- $scope.getOK = true;
|
|
|
$scope.connections = {};
|
|
|
$scope.config = {};
|
|
|
$scope.myID = '';
|
|
|
@@ -21,8 +20,6 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
|
|
$scope.seenError = '';
|
|
|
$scope.model = {};
|
|
|
$scope.repos = {};
|
|
|
- $scope.lastUpdated = new Date();
|
|
|
- $scope.heartbeat = 0;
|
|
|
|
|
|
// Strings before bools look better
|
|
|
$scope.settings = [
|
|
|
@@ -46,11 +43,10 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
|
|
];
|
|
|
|
|
|
function getSucceeded() {
|
|
|
- $scope.lastUpdated = new Date();
|
|
|
- if (!$scope.getOK) {
|
|
|
+ if (!getOK) {
|
|
|
$scope.init();
|
|
|
$('#networkError').modal('hide');
|
|
|
- $scope.getOK = true;
|
|
|
+ getOK = true;
|
|
|
}
|
|
|
if (restarting) {
|
|
|
$scope.init();
|
|
|
@@ -63,18 +59,9 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
|
|
if (restarting) {
|
|
|
return;
|
|
|
}
|
|
|
- if ($scope.getOK) {
|
|
|
+ if (getOK) {
|
|
|
$('#networkError').modal({backdrop: 'static', keyboard: false});
|
|
|
- $scope.getOK = false;
|
|
|
- $scope.heartbeat = 0;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- function heartbeat() {
|
|
|
- if ($scope.getOK){
|
|
|
- $scope.$apply(function () {
|
|
|
- $scope.heartbeat = ($scope.heartbeat + 1) % 5;
|
|
|
- });
|
|
|
+ getOK = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -458,9 +445,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
|
|
};
|
|
|
|
|
|
$scope.init();
|
|
|
-
|
|
|
- setInterval($scope.refresh, refreshInterval);
|
|
|
- setInterval(heartbeat, 650);
|
|
|
+ setInterval($scope.refresh, 10000);
|
|
|
});
|
|
|
|
|
|
function nodeCompare(a, b) {
|