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 () {