support setting action after restarting task

This commit is contained in:
MaysWind 2018-10-21 23:22:05 +08:00
parent dd24ea052b
commit 620f5b99a8
8 changed files with 45 additions and 3 deletions

View file

@ -157,6 +157,9 @@ Action After Creating New Tasks=创建新任务后执行操作
Removing Old Task After Restarting=重试任务后删除原任务 Removing Old Task After Restarting=重试任务后删除原任务
Navigate to Task List Page=转到任务列表页面 Navigate to Task List Page=转到任务列表页面
Navigate to Task Detail Page=转到任务详情页面 Navigate to Task Detail Page=转到任务详情页面
Action After Restarting Task=重试任务后执行操作
Navigate to Downloading Task List Page=转到正在下载任务列表页面
Stay on Current Page=留在当前页面
RPC List Display Order=RPC 列表显示顺序 RPC List Display Order=RPC 列表显示顺序
Recently Used=最近使用 Recently Used=最近使用
RPC Alias=RPC 别名 RPC Alias=RPC 别名

View file

@ -157,6 +157,9 @@ Action After Creating New Tasks=建立新工作後執行操作
Removing Old Task After Restarting=重試工作後刪除原工作 Removing Old Task After Restarting=重試工作後刪除原工作
Navigate to Task List Page=轉到工作清單頁面 Navigate to Task List Page=轉到工作清單頁面
Navigate to Task Detail Page=轉到工作詳情頁面 Navigate to Task Detail Page=轉到工作詳情頁面
Action After Restarting Task=重試工作後執行操作
Navigate to Downloading Task List Page=轉到正在下載工作清單頁面
Stay on Current Page=留在目前頁面
RPC List Display Order=RPC 清單顯示順序 RPC List Display Order=RPC 清單顯示順序
Recently Used=最近使用 Recently Used=最近使用
RPC Alias=RPC 別名 RPC Alias=RPC 別名

View file

@ -38,6 +38,7 @@
rpcListDisplayOrder: 'recentlyUsed', rpcListDisplayOrder: 'recentlyUsed',
afterCreatingNewTask: 'task-list', afterCreatingNewTask: 'task-list',
removeOldTaskAfterRestarting: false, removeOldTaskAfterRestarting: false,
afterRestartingTask: 'task-list-downloading',
displayOrder: 'default:asc', displayOrder: 'default:asc',
fileListDisplayOrder: 'default:asc', fileListDisplayOrder: 'default:asc',
peerListDisplayOrder: 'default:asc' peerListDisplayOrder: 'default:asc'

View file

@ -161,6 +161,9 @@
'Removing Old Task After Restarting': 'Removing Old Task After Restarting', 'Removing Old Task After Restarting': 'Removing Old Task After Restarting',
'Navigate to Task List Page': 'Navigate to Task List Page', 'Navigate to Task List Page': 'Navigate to Task List Page',
'Navigate to Task Detail Page': 'Navigate to Task Detail Page', 'Navigate to Task Detail Page': 'Navigate to Task Detail Page',
'Action After Restarting Task': 'Action After Restarting Task',
'Navigate to Downloading Task List Page': 'Navigate to Downloading Task List Page',
'Stay on Current Page': 'Stay on Current Page',
'RPC List Display Order': 'RPC List Display Order', 'RPC List Display Order': 'RPC List Display Order',
'Recently Used': 'Recently Used', 'Recently Used': 'Recently Used',
'RPC Alias': 'RPC Alias', 'RPC Alias': 'RPC Alias',

View file

@ -148,12 +148,21 @@
refreshGlobalStat(true); refreshGlobalStat(true);
if (response.success) { var actionAfterRestartingTask = ariaNgSettingService.getAfterRestartingTask();
if (response.success && response.data) {
console.log(response);
if (actionAfterRestartingTask === 'task-list-downloading') {
if ($location.path() !== '/downloading') { if ($location.path() !== '/downloading') {
$location.path('/downloading'); $location.path('/downloading');
} else { } else {
$route.reload(); $route.reload();
} }
} else if (actionAfterRestartingTask === 'task-detail') {
$location.path('/task/detail/' + response.data);
} else {
$route.reload();
}
} }
}, false); }, false);
}); });

View file

@ -173,6 +173,10 @@
ariaNgSettingService.setRemoveOldTaskAfterRestarting(value); ariaNgSettingService.setRemoveOldTaskAfterRestarting(value);
}; };
$scope.setAfterRestartingTask = function (value) {
ariaNgSettingService.setAfterRestartingTask(value);
};
$scope.showImportSettingsModal = function () { $scope.showImportSettingsModal = function () {
$scope.context.importSettings = null; $scope.context.importSettings = null;
angular.element('#import-settings-modal').modal(); angular.element('#import-settings-modal').modal();

View file

@ -366,6 +366,12 @@
setRemoveOldTaskAfterRestarting: function (value) { setRemoveOldTaskAfterRestarting: function (value) {
setOption('removeOldTaskAfterRestarting', value); setOption('removeOldTaskAfterRestarting', value);
}, },
getAfterRestartingTask: function () {
return getOption('afterRestartingTask');
},
setAfterRestartingTask: function (value) {
setOption('afterRestartingTask', value);
},
getCurrentRpcDisplayName: function () { getCurrentRpcDisplayName: function () {
var options = getOptions(); var options = getOptions();

View file

@ -151,6 +151,19 @@
</select> </select>
</div> </div>
</div> </div>
<div class="row">
<div class="setting-key setting-key-without-desc col-sm-4">
<span translate>Action After Restarting Task</span>
</div>
<div class="setting-value col-sm-8">
<select class="form-control" style="width: 100%;" ng-model="context.settings.afterRestartingTask"
ng-change="setAfterRestartingTask(context.settings.afterRestartingTask)">
<option value="task-list-downloading" translate>Navigate to Downloading Task List Page</option>
<option value="task-detail" translate>Navigate to Task Detail Page</option>
<option value="stay-on-current" translate>Stay on Current Page</option>
</select>
</div>
</div>
<div class="row"> <div class="row">
<div class="setting-key setting-key-without-desc col-sm-4"> <div class="setting-key setting-key-without-desc col-sm-4">
<span translate>Import / Export AriaNg Settings</span> <span translate>Import / Export AriaNg Settings</span>