Fixed an issue with editing the scheduled days on an existing backup.

This fixes #2324
This commit is contained in:
Kenneth Skovhede
2017-02-26 23:39:16 +01:00
parent 53ab54fc59
commit 51b4d4e8d1
2 changed files with 15 additions and 6 deletions
@@ -147,10 +147,7 @@ backupApp.controller('EditBackupController', function ($scope, $routeParams, $lo
}
};
$scope.toggleArraySelection = function (lst, value) {
if (lst === null)
lst = [];
function toggleArraySelection(lst, value) {
var ix = lst.indexOf(value);
if (ix > -1)
@@ -159,6 +156,18 @@ backupApp.controller('EditBackupController', function ($scope, $routeParams, $lo
lst.push(value);
};
$scope.toggleAllowedDays = function(value) {
if ($scope.Schedule.AllowedDays == null)
$scope.Schedule.AllowedDays = [];
toggleArraySelection($scope.Schedule.AllowedDays, value);
};
$scope.toggleExcludeAttributes = function(value) {
if ($scope.ExcludeAttributes == null)
$scope.ExcludeAttributes = [];
toggleArraySelection($scope.ExcludeAttributes, value);
};
$scope.save = function() {
if (!EditBackupService.preValidate($scope))
@@ -216,7 +216,7 @@
name="fileattr_{{attr.value}}"
value="{{attr.value}}"
ng-checked="ExcludeAttributes.indexOf(attr.value) > -1"
ng-click="toggleArraySelection(ExcludeAttributes, attr.value)"
ng-click="toggleExcludeAttributes(attr.value)"
/>
<label for="fileattr_{{attr.value}}">{{attr.name}}</label>
</div>
@@ -275,7 +275,7 @@
name="dayofweek_{{day.value}}"
value="{{day.value}}"
ng-checked="Schedule.AllowedDays.indexOf(day.value) > -1"
ng-click="toggleArraySelection(Schedule.AllowedDays, day.value)"
ng-click="toggleAllowedDays(day.value)"
/>
<label for="dayofweek_{{day.value}}">{{day.name}}</label>
</div>