Use the new notification onClick api in places

This commit is contained in:
Johannes Zellner
2019-01-07 17:30:01 +01:00
parent 48f63ec761
commit 59c7c1e302
3 changed files with 7 additions and 50 deletions

View File

@@ -73,38 +73,26 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
function runConfigurationChecks() {
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.notify('Update Available', 'Update now to version ' + $scope.config.update.box.version + '.', true, 'success', '/#/settings');
}
Client.getBackupConfig(function (error, backupConfig) {
if (error) return console.error(error);
if (backupConfig.provider === 'noop') {
var actionScope = $scope.$new(true);
actionScope.action = '/#/backups';
Client.notify('Backup Configuration', 'Cloudron backups are disabled. Please ensure this server is backed up using alternate means.', false, 'info', actionScope);
Client.notify('Backup Configuration', 'Cloudron backups are disabled. Please ensure this server is backed up using alternate means.', false, 'info', '/#/backups');
} else if (backupConfig.provider === 'filesystem' && !backupConfig.externalDisk) {
var actionScope = $scope.$new(true);
actionScope.action = '/#/backups';
Client.notify('Backup Configuration',
'Cloudron backups are currently on the same disk as the Cloudron server instance. This is dangerous and can lead to complete data loss if the disk fails.',
false /* persistent */, 'info', actionScope);
false /* persistent */, 'info', '/#/backups');
}
});
Client.isRebootRequired(function (error, isRequired) {
if (error) return console.error(error);
if (!isRequired) return;
var actionScope = $scope.$new(true);
actionScope.action = '/#/system';
Client.notify('Reboot Required', 'To finish security updates, a reboot is necessary.', true /* persistent */, 'warning', actionScope);
Client.notify('Reboot Required', 'To finish security updates, a reboot is necessary.', true /* persistent */, 'warning', '/#/system');
});
Client.getNotifications(false, 1, 100, function (error, results) {