Show update button and dialog in settings view
This commit is contained in:
@@ -8,6 +8,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
|
||||
$scope.config = Client.getConfig();
|
||||
$scope.backupConfig = {};
|
||||
$scope.appstoreConfig = {};
|
||||
$scope.installedApps = Client.getInstalledApps();
|
||||
|
||||
$scope.lastBackup = null;
|
||||
$scope.backups = [];
|
||||
@@ -76,6 +77,45 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
|
||||
}
|
||||
};
|
||||
|
||||
$scope.update = {
|
||||
error: {},
|
||||
busy: false,
|
||||
|
||||
show: function (form) {
|
||||
$scope.update.error.generic = null;
|
||||
$scope.update.busy = false;
|
||||
|
||||
form.$setPristine();
|
||||
form.$setUntouched();
|
||||
|
||||
if (!$scope.config.update.box.sourceTarballUrl) {
|
||||
$('#setupSubscriptionModal').modal('show');
|
||||
} else {
|
||||
$('#updateModal').modal('show');
|
||||
}
|
||||
},
|
||||
|
||||
submit: function () {
|
||||
$scope.update.error.generic = null;
|
||||
$scope.update.busy = true;
|
||||
|
||||
Client.update(function (error) {
|
||||
if (error) {
|
||||
if (error.statusCode === 409) {
|
||||
$scope.update.error.generic = 'Please try again later. The Cloudron is creating a backup at the moment.';
|
||||
} else {
|
||||
$scope.update.error.generic = error.message;
|
||||
console.error('Unable to update.', error);
|
||||
}
|
||||
$scope.update.busy = false;
|
||||
return;
|
||||
}
|
||||
|
||||
window.location.href = '/update.html';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.planChange = {
|
||||
busy: false,
|
||||
error: {},
|
||||
|
||||
Reference in New Issue
Block a user