add 'Confirm Task Removal' setting

This commit is contained in:
Vyacheslav Konovalov 2019-10-08 18:20:31 +05:00 committed by mayswind
parent fc2d9678ee
commit 06d6ee0a8e
6 changed files with 31 additions and 2 deletions

View file

@ -39,6 +39,7 @@
rpcListDisplayOrder: 'recentlyUsed',
afterCreatingNewTask: 'task-list',
removeOldTaskAfterRetrying: false,
confirmTaskRemoval: true,
afterRetryingTask: 'task-list-downloading',
displayOrder: 'default:asc',
fileListDisplayOrder: 'default:asc',

View file

@ -182,6 +182,7 @@
'Navigate to Downloading Tasks Page': 'Navigate to Downloading Tasks Page',
'Stay on Current Page': 'Stay on Current Page',
'Remove Old Tasks After Retrying': 'Remove Old Tasks After Retrying',
'Confirm Task Removal': 'Confirm Task Removal',
'RPC List Display Order': 'RPC List Display Order',
'Recently Used': 'Recently Used',
'RPC Alias': 'RPC Alias',

View file

@ -290,7 +290,7 @@
return;
}
ariaNgLocalizationService.confirm('Confirm Remove', 'Are you sure you want to remove the selected task?', 'warning', function () {
var removeTasks = function () {
$rootScope.loadPromise = aria2TaskService.removeTasks(tasks, function (response) {
if (response.hasError && tasks.length > 1) {
ariaNgLocalizationService.showError('Failed to remove some task(s).');
@ -310,7 +310,13 @@
}
}
}, (tasks.length > 1));
});
};
if (ariaNgSettingService.getConfirmTaskRemoval()) {
ariaNgLocalizationService.confirm('Confirm Remove', 'Are you sure you want to remove the selected task?', 'warning', removeTasks);
} else {
removeTasks();
};
};
$scope.clearStoppedTasks = function () {

View file

@ -187,6 +187,10 @@
ariaNgSettingService.setRemoveOldTaskAfterRetrying(value);
};
$scope.setConfirmTaskRemoval = function (value) {
ariaNgSettingService.setConfirmTaskRemoval(value);
};
$scope.setAfterRetryingTask = function (value) {
ariaNgSettingService.setAfterRetryingTask(value);
};

View file

@ -381,6 +381,12 @@
setRemoveOldTaskAfterRetrying: function (value) {
setOption('removeOldTaskAfterRetrying', value);
},
getConfirmTaskRemoval: function () {
return getOption('confirmTaskRemoval');
},
setConfirmTaskRemoval: function (value) {
setOption('confirmTaskRemoval', value);
},
getAfterRetryingTask: function () {
return getOption('afterRetryingTask');
},

View file

@ -171,6 +171,17 @@
</select>
</div>
</div>
<div class="row">
<div class="setting-key setting-key-without-desc col-sm-4">
<span translate>Confirm Task Removal</span>
</div>
<div class="setting-value col-sm-8">
<select class="form-control" style="width: 100%;" ng-model="context.settings.confirmTaskRemoval"
ng-change="setConfirmTaskRemoval(context.settings.confirmTaskRemoval)"
ng-options="option.value as (option.name | translate) for option in context.trueFalseOptions">
</select>
</div>
</div>
<div class="row">
<div class="setting-key setting-key-without-desc col-sm-4">
<span translate>Import / Export AriaNg Settings</span>