Allow changing the autoupdate pattern in the settings view

This commit is contained in:
Johannes Zellner
2017-01-26 21:30:54 -08:00
parent 0568093a2a
commit 020ec54264
2 changed files with 76 additions and 0 deletions

View File

@@ -420,6 +420,27 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
}
};
$scope.autoUpdate = {
busy: false,
error: '',
pattern: '',
currentPattern: '',
submit: function () {
if ($scope.autoUpdate.pattern === $scope.autoUpdate.currentPattern) return;
$scope.autoUpdate.error = '';
$scope.autoUpdate.busy = true;
Client.setAutoupdatePattern($scope.autoUpdate.pattern, function (error) {
if (error) $scope.autoUpdate.error = error.message;
else $scope.autoUpdate.currentPattern = $scope.autoUpdate.pattern;
$scope.autoUpdate.busy = false;
});
}
};
function fetchBackups() {
Client.getBackups(function (error, backups) {
if (error) return console.error(error);
@@ -460,6 +481,15 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
});
}
function getAutoupdatePattern() {
Client.getAutoupdatePattern(function (error, result) {
if (error) return console.error(error);
$scope.autoUpdate.currentPattern = result.pattern;
$scope.autoUpdate.pattern = result.pattern;
});
}
function showExpectedDnsRecords(callback) {
callback = callback || function (error) { if (error) console.error(error); };
@@ -573,6 +603,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
getMailConfig();
getBackupConfig();
getDnsConfig();
getAutoupdatePattern();
if ($scope.config.provider === 'caas') {
getPlans();