diff --git a/src/views/settings.html b/src/views/settings.html
index d91bdc6f7..06873bcf3 100644
--- a/src/views/settings.html
+++ b/src/views/settings.html
@@ -58,13 +58,26 @@
Cloudron backup schedule .
-
-
- Days:
-
+
+
+ Disable Auto Updates
+
+
+
+
+ Enable Auto Updates
+ Select at least one day and time
+
+
+
@@ -228,7 +241,9 @@
- The current auto update schedule for apps is {{ prettyAutoUpdateSchedule(updateSchedule.currentPattern) }} .
+ The current auto update schedule for apps is {{ prettyAutoUpdateSchedule(updateSchedule.currentPattern) }} .
+ Auto update for apps is disabled .
+
diff --git a/src/views/settings.js b/src/views/settings.js
index b04bc37ce..64ef64504 100644
--- a/src/views/settings.js
+++ b/src/views/settings.js
@@ -198,32 +198,46 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
currentPattern: '',
days: [],
hours: [],
+ type: 'pattern',
+
+ isScheduleValid: function () {
+ return $scope.updateSchedule.hours.length !== 0 && $scope.updateSchedule.days !== 0;
+ },
show: function () {
$scope.updateSchedule.busy = false;
- var tmp = $scope.updateSchedule.currentPattern.split(' ');
- var hours = tmp[2].split(','), days = tmp[5].split(',');
- if (days[0] === '*') {
- $scope.updateSchedule.days = angular.copy($scope.cronDays, []);
+ if ($scope.updateSchedule.currentPattern === 'never') {
+ $scope.updateSchedule.type = 'never';
} else {
- $scope.updateSchedule.days = days.map(function (day) { return $scope.cronDays[parseInt(day, 10)]; });
+ $scope.updateSchedule.type = 'pattern';
+
+ var tmp = $scope.updateSchedule.currentPattern.split(' ');
+ var hours = tmp[2].split(','), days = tmp[5].split(',');
+ if (days[0] === '*') {
+ $scope.updateSchedule.days = angular.copy($scope.cronDays, []);
+ } else {
+ $scope.updateSchedule.days = days.map(function (day) { return $scope.cronDays[parseInt(day, 10)]; });
+ }
+ $scope.updateSchedule.hours = hours.map(function (hour) { return $scope.cronHours[parseInt(hour, 10)]; });
}
- $scope.updateSchedule.hours = hours.map(function (hour) { return $scope.cronHours[parseInt(hour, 10)]; });
$('#updateScheduleModal').modal('show');
},
submit: function () {
- var daysPattern;
- if ($scope.updateSchedule.days.length === 7) daysPattern = '*';
- else daysPattern = $scope.updateSchedule.days.map(function (d) { return d.value; });
+ var pattern = 'never';
+ if ($scope.updateSchedule.type === 'pattern') {
+ var daysPattern;
+ if ($scope.updateSchedule.days.length === 7) daysPattern = '*';
+ else daysPattern = $scope.updateSchedule.days.map(function (d) { return d.value; });
- var hoursPattern;
- if ($scope.updateSchedule.hours.length === 24) hoursPattern = '*';
- else hoursPattern = $scope.updateSchedule.hours.map(function (d) { return d.value; });
+ var hoursPattern;
+ if ($scope.updateSchedule.hours.length === 24) hoursPattern = '*';
+ else hoursPattern = $scope.updateSchedule.hours.map(function (d) { return d.value; });
- var pattern ='00 00 ' + hoursPattern + ' * * ' + daysPattern;
+ pattern ='00 00 ' + hoursPattern + ' * * ' + daysPattern;
+ }
$scope.updateSchedule.busy = true;