Move update button into notification instead of pill

This commit is contained in:
Johannes Zellner
2018-03-30 15:12:14 +02:00
parent 63ae9a90cf
commit 0ad813cc8d
2 changed files with 10 additions and 99 deletions

View File

@@ -13,11 +13,6 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
$scope.hideNavBarActions = $location.path() === '/logs';
$scope.update = {
busy: false,
error: {}
};
$scope.isActive = function (url) {
if (!$route.current) return false;
return $route.current.$$route.originalPath.indexOf(url) === 0;
@@ -75,47 +70,18 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
$('#setupSubscriptionModal').modal('show');
};
$scope.showUpdateModal = function (form) {
$scope.update.error.generic = null;
form.$setPristine();
form.$setUntouched();
if (!$scope.config.update.box.sourceTarballUrl) {
$('#setupSubscriptionModal').modal('show');
} else {
$('#updateModal').modal('show');
}
};
$scope.doUpdate = 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';
});
};
function runConfigurationChecks() {
var actionScope;
// warn user if dns config is not working (the 'configuring' flag detects if configureWebadmin is 'active')
if (!$scope.status.webadminStatus.configuring && !$scope.status.webadminStatus.dns) {
actionScope = $scope.$new(true);
actionScope.action = '/#/certs';
Client.notify('Invalid Domain Config', 'Unable to update DNS. Click here to update it.', true, 'error', actionScope);
var dnsActionScope = $scope.$new(true);
dnsActionScope.action = '/#/certs';
Client.notify('Invalid Domain Config', 'Unable to update DNS. Click here to update it.', true, 'error', dnsActionScope);
}
if ($scope.config.update && $scope.config.update.box) {
var updateActionScope = $scope.$new(true);
updateActionScope.action = '/#/settings';
Client.notify('Update Available', 'Update now to version ' + $scope.config.update.box.version + '.', true, 'success', updateActionScope);
}
Client.getBackupConfig(function (error, backupConfig) {