summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorJakob Borg <jakob@nym.se>2014-05-11 14:43:38 -0300
committerJakob Borg <jakob@nym.se>2014-05-11 14:43:38 -0300
commita91eb701bf2d225eb85fc1c52ae5e76be06f1a5e (patch)
treed09e85a533b4e5279e5c9ed628372bf7177fd98b /gui
parent1a1f118f1a1fe9e40d43921ce234c0aa64fcfe54 (diff)
Reload configuration after lost connection or restart.
Diffstat (limited to 'gui')
-rw-r--r--gui/app.js43
1 files changed, 24 insertions, 19 deletions
diff --git a/gui/app.js b/gui/app.js
index 8feec1e7e9..ca92178a75 100644
--- a/gui/app.js
+++ b/gui/app.js
@@ -44,10 +44,12 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
function getSucceeded() {
if (!getOK) {
+ $scope.init();
$('#networkError').modal('hide');
getOK = true;
}
if (restarting) {
+ $scope.init();
$('#restarting').modal('hide');
restarting = false;
}
@@ -421,32 +423,35 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
$http.post(urlbase + '/config', JSON.stringify($scope.config), {headers: {'Content-Type': 'application/json'}});
};
- $http.get(urlbase + '/version').success(function (data) {
- $scope.version = data;
- });
+ $scope.init = function() {
+ $http.get(urlbase + '/version').success(function (data) {
+ $scope.version = data;
+ });
- $http.get(urlbase + '/system').success(function (data) {
- $scope.system = data;
- $scope.myID = data.myID;
- });
+ $http.get(urlbase + '/system').success(function (data) {
+ $scope.system = data;
+ $scope.myID = data.myID;
+ });
- $http.get(urlbase + '/config').success(function (data) {
- $scope.config = data;
- $scope.config.Options.ListenStr = $scope.config.Options.ListenAddress.join(', ');
+ $http.get(urlbase + '/config').success(function (data) {
+ $scope.config = data;
+ $scope.config.Options.ListenStr = $scope.config.Options.ListenAddress.join(', ');
- var nodes = $scope.config.Nodes;
- nodes.sort(nodeCompare);
- $scope.nodes = nodes;
+ var nodes = $scope.config.Nodes;
+ nodes.sort(nodeCompare);
+ $scope.nodes = nodes;
- $scope.repos = $scope.config.Repositories;
+ $scope.repos = $scope.config.Repositories;
- $scope.refresh();
- });
+ $scope.refresh();
+ });
- $http.get(urlbase + '/config/sync').success(function (data) {
- $scope.configInSync = data.configInSync;
- });
+ $http.get(urlbase + '/config/sync').success(function (data) {
+ $scope.configInSync = data.configInSync;
+ });
+ };
+ $scope.init();
setInterval($scope.refresh, 10000);
});