support setting rpc list display order

This commit is contained in:
MaysWind 2018-08-14 21:56:02 +08:00
parent 766761d2f0
commit a30f530996
7 changed files with 50 additions and 0 deletions

View file

@ -154,6 +154,9 @@ Action After Creating New Tasks=创建新任务后执行操作
Removing Old Task After Restarting=重试任务后删除原任务
Navigate to Task List Page=转到任务列表页面
Navigate to Task Detail Page=转到任务详情页面
RPC List Display Order=RPC 列表显示顺序
Recently Used=最近使用
RPC Alias=RPC 别名
Supported Placeholder=支持的占位符
AriaNg Title=AriaNg 标题
Downloading Count=正在下载数量

View file

@ -154,6 +154,9 @@ Action After Creating New Tasks=建立新工作後執行操作
Removing Old Task After Restarting=重試工作後刪除原工作
Navigate to Task List Page=轉到工作清單頁面
Navigate to Task Detail Page=轉到工作詳情頁面
RPC List Display Order=RPC 清單顯示順序
Recently Used=最近使用
RPC Alias=RPC 別名
Supported Placeholder=支援的預留位置
AriaNg Title=AriaNg 標題
Downloading Count=正在下載數量

View file

@ -35,6 +35,7 @@
extendRpcServers: [],
globalStatRefreshInterval: 1000,
downloadTaskRefreshInterval: 1000,
rpcListDisplayOrder: 'recentlyUsed',
afterCreatingNewTask: 'task-list',
removeOldTaskAfterRestarting: false
});

View file

@ -158,6 +158,9 @@
'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',
'RPC List Display Order': 'RPC List Display Order',
'Recently Used': 'Recently Used',
'RPC Alias': 'RPC Alias',
'Supported Placeholder': 'Supported Placeholder',
'AriaNg Title': 'AriaNg Title',
'Downloading Count': 'Downloading Count',

View file

@ -107,6 +107,11 @@
$scope.updateTitlePreview();
};
$scope.setRPCListDisplayOrder = function (value) {
setNeedRefreshPage();
ariaNgSettingService.setRPCListDisplayOrder(value);
};
$scope.setAfterCreatingNewTask = function (value) {
ariaNgSettingService.setAfterCreatingNewTask(value);
};

View file

@ -239,6 +239,22 @@
}
}
var displayOrder = this.getRPCListDisplayOrder();
if (displayOrder === 'recentlyUsed') {
// Do Nothing
} else if (displayOrder === 'rpcAlias') {
result.sort(function (rpc1, rpc2) {
if (rpc1.rpcAlias < rpc2.rpcAlias) {
return -1;
} else if (rpc1.rpcAlias > rpc2.rpcAlias) {
return 1;
} else {
return 0;
}
});
}
return result;
},
getAllSessionOptions: function () {
@ -277,6 +293,12 @@
setTitleRefreshInterval: function (value) {
setOption('titleRefreshInterval', Math.max(parseInt(value), 0));
},
getRPCListDisplayOrder: function () {
return getOption('rpcListDisplayOrder');
},
setRPCListDisplayOrder: function (value) {
setOption('rpcListDisplayOrder', value);
},
getAfterCreatingNewTask: function () {
return getOption('afterCreatingNewTask');
},

View file

@ -115,6 +115,19 @@
</select>
</div>
</div>
<div class="row">
<div class="setting-key setting-key-without-desc col-sm-4">
<span translate>RPC List Display Order</span>
<span class="asterisk">*</span>
</div>
<div class="setting-value col-sm-8">
<select class="form-control" style="width: 100%;" ng-model="context.settings.rpcListDisplayOrder"
ng-change="setRPCListDisplayOrder(context.settings.rpcListDisplayOrder)">
<option value="recentlyUsed" translate>Recently Used</option>
<option value="rpcAlias" translate>RPC Alias</option>
</select>
</div>
</div>
<div class="row">
<div class="setting-key setting-key-without-desc col-sm-4">
<span translate>Action After Creating New Tasks</span>