Add a way to disable auto updates
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user