Upgrade from within GUI (fixes #190)

This commit is contained in:
Jakob Borg
2014-07-14 10:45:29 +02:00
parent 54a1f37bf5
commit d812f559ef
7 changed files with 116 additions and 47 deletions

View File

@@ -32,6 +32,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
$scope.repos = {};
$scope.reportData = {};
$scope.reportPreview = false;
$scope.upgradeInfo = {};
$scope.needActions = {
'rm': 'Del',
@@ -336,6 +337,8 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
$scope.restart = function () {
restarting = true;
$scope.restartingHeader = "Restarting"
$scope.restartingBody = "Syncthing is restarting."
$('#restarting').modal({backdrop: 'static', keyboard: false});
$http.post(urlbase + '/restart');
$scope.configInSync = true;
@@ -356,6 +359,18 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
}
};
$scope.upgrade = function () {
$scope.restartingHeader = "Upgrading"
$scope.restartingBody = "Syncthing is upgrading."
$('#restarting').modal({backdrop: 'static', keyboard: false});
$http.post(urlbase + '/upgrade').success(function () {
restarting = true;
$scope.restartingBody = "Syncthing is restarting into the new version."
}).error(function () {
$('#restarting').modal('hide');
});
};
$scope.shutdown = function () {
restarting = true;
$http.post(urlbase + '/shutdown').success(function () {
@@ -606,6 +621,12 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
$http.get(urlbase + '/report').success(function (data) {
$scope.reportData = data;
});
$http.get(urlbase + '/upgrade').success(function (data) {
$scope.upgradeInfo = data;
}).error(function () {
$scope.upgradeInfo = {};
});
};
$scope.acceptUR = function () {

View File

@@ -96,6 +96,9 @@
<div class="container">
<span class="navbar-brand"><img class="logo" src="st-logo-128.png" width="32" height="32" /> Syncthing<small class="hidden-xs"> <span class="text-muted">|</span> {{thisNodeName()}}</small></span>
<ul class="nav navbar-nav navbar-right">
<li ng-if="upgradeInfo.newer">
<button type="button" class="btn navbar-btn btn-default" href="" ng-click="upgrade()"><span class="glyphicon glyphicon-chevron-up"></span>&emsp;Upgrade to {{upgradeInfo.latest}}</button>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit&nbsp;<b class="caret"></b></a>
<ul class="dropdown-menu">
@@ -376,12 +379,12 @@
<div class="modal-header alert alert-info">
<h4 class="modal-title">
<span class="glyphicon glyphicon-refresh"></span>
Restarting
{{restartingHeader}}
</h4>
</div>
<div class="modal-body">
<p>
Syncthing is restarting. Please hold&hellip;
{{restartingBody}} Please hold&hellip;
</p>
</div>
</div>