Show restarting notification instead of network error (fixes #129)

This commit is contained in:
Jakob Borg 2014-04-16 15:16:44 +02:00
parent 116203aef8
commit 1ca7e47fd6
3 changed files with 35 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -6,8 +6,9 @@
var syncthing = angular.module('syncthing', []); var syncthing = angular.module('syncthing', []);
syncthing.controller('SyncthingCtrl', function ($scope, $http) { syncthing.controller('SyncthingCtrl', function ($scope, $http) {
var prevDate = 0, var prevDate = 0;
getOK = true; var getOK = true;
var restarting = false;
$scope.connections = {}; $scope.connections = {};
$scope.config = {}; $scope.config = {};
@ -44,9 +45,16 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
$('#networkError').modal('hide'); $('#networkError').modal('hide');
getOK = true; getOK = true;
} }
if (restarting) {
$('#restarting').modal('hide');
restarting = false;
}
} }
function getFailed() { function getFailed() {
if (restarting) {
return;
}
if (getOK) { if (getOK) {
$('#networkError').modal({backdrop: 'static', keyboard: false}); $('#networkError').modal({backdrop: 'static', keyboard: false});
getOK = false; getOK = false;
@ -234,6 +242,8 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
}; };
$scope.restart = function () { $scope.restart = function () {
restarting = true;
$('#restarting').modal('show');
$http.post('/rest/restart'); $http.post('/rest/restart');
$scope.configInSync = true; $scope.configInSync = true;
}; };

View File

@ -114,7 +114,7 @@
<p>The configuration has been saved but not activated. Syncthing must restart to activate the new configuration.</p> <p>The configuration has been saved but not activated. Syncthing must restart to activate the new configuration.</p>
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
<button type="button" class="btn btn-sm btn-default pull-right" ng-click="restart()"><span class="glyphicon glyphicon-off"></span> Restart Now</button> <button type="button" class="btn btn-sm btn-default pull-right" ng-click="restart()"><span class="glyphicon glyphicon-refresh"></span> Restart Now</button>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
</div> </div>
@ -321,6 +321,26 @@
</div> </div>
</div> </div>
<!-- Restarting modal -->
<div id="restarting" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header alert alert-info">
<h4 class="modal-title">
<span class="glyphicon glyphicon-refresh"></span>
Restarting
</h4>
</div>
<div class="modal-body">
<p>
Syncthing is restarting. Please hold&hellip;
</p>
</div>
</div>
</div>
</div>
<!-- Node editor modal --> <!-- Node editor modal -->
<div id="editNode" class="modal fade"> <div id="editNode" class="modal fade">