add remove button in rpc setting tab, modify rpc setting tab style

This commit is contained in:
MaysWind 2017-03-25 13:06:55 +08:00
parent 9055c7549e
commit c13c41d6f0
7 changed files with 44 additions and 10 deletions

View file

@ -138,7 +138,7 @@ Aria2 RPC Address=Aria2 RPC 地址
Set Default=设为默认
Delete RPC Setting=删除 RPC 设置
Add New RPC Setting=添加新 RPC 配置
Are you sure you want to remove this rpc setting?=您是否要删除当前 RPC 设置?
Are you sure you want to remove rpc setting "{{rpcName}}"?=您是否要删除 RPC 设置 "{{rpcName}}"?
Global Stat Refresh Interval=全局状态刷新间隔
Download Task Refresh Interval=下载任务刷新间隔
Supported Placeholder=支持的占位符

View file

@ -142,7 +142,7 @@
'Set Default': 'Set Default',
'Delete RPC Setting': 'Delete RPC Setting',
'Add New RPC Setting': 'Add New RPC Setting',
'Are you sure you want to remove this rpc setting?': 'Are you sure you want to remove this rpc setting?',
'Are you sure you want to remove rpc setting "{{rpcName}}"?': 'Are you sure you want to remove rpc setting "{{rpcName}}"?',
'Global Stat Refresh Interval': 'Global Stat Refresh Interval',
'Download Task Refresh Interval': 'Download Task Refresh Interval',
'Supported Placeholder': 'Supported Placeholder',

View file

@ -129,7 +129,9 @@
};
$scope.removeRpcSetting = function (setting) {
ariaNgCommonService.confirm('Confirm Remove', 'Are you sure you want to remove this rpc setting?', 'warning', function () {
var rpcName = (setting.rpcAlias ? setting.rpcAlias : setting.rpcHost + ':' + setting.rpcPort);
ariaNgCommonService.confirm('Confirm Remove', 'Are you sure you want to remove rpc setting "{{rpcName}}"?', 'warning', function () {
var index = $scope.context.rpcSettings.indexOf(setting);
ariaNgSettingService.removeRpcSetting(setting);
$scope.context.rpcSettings.splice(index, 1);
@ -137,6 +139,10 @@
if (index >= $scope.context.rpcSettings.length) {
$scope.changeRpcTab($scope.context.rpcSettings.length - 1);
}
}, false, {
textParams: {
rpcName: rpcName
}
});
};

View file

@ -25,10 +25,10 @@
showOperationSucceeded: function (text) {
this.showDialog('Operation Succeeded', text, 'success');
},
confirm: function (title, text, type, callback, notClose) {
confirm: function (title, text, type, callback, notClose, extendSettings) {
var options = {
title: $translate.instant(title),
text: $translate.instant(text),
text: $translate.instant(text, (extendSettings !== null ? extendSettings.textParams : null)),
type: type,
showCancelButton: true,
showLoaderOnConfirm: !!notClose,

View file

@ -3,6 +3,22 @@
padding: 0 4px 0 4px;
}
.nav-tabs-custom .nav-tabs > li > a {
display: inline-block;
}
.nav-tabs-custom .nav-tabs > li > a.nav-tab-close {
padding-left: 0;
margin-left: -12px;
}
.nav-tabs-custom .nav-tabs > li.nav-tab-title-rpcname > a {
max-width: 180px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* font-awesome extend */
.fa-half {
font-size: 0.5em;

View file

@ -343,6 +343,16 @@
color: #208fe5;
}
.skin-aria-ng .nav-tabs-custom > .nav-tabs > li > a.nav-tab-close:hover {
color: #dd4b39 !important;
margin-left: -14px;
}
.skin-aria-ng .nav-tabs-custom > .nav-tabs > li > a.nav-tab-close:hover > .fa-times:before {
content:"\f057"; /* The same as .fa-times-circle:before */
font-size: 1.1em;
}
.skin-aria-ng .nav-tabs-custom > .nav-tabs > li > div.btn-group {
padding-top: 5px;
padding-bottom: 5px;

View file

@ -4,8 +4,13 @@
<li ng-class="{'active': isCurrentGlobalTab()}">
<a class="pointer-cursor" ng-click="changeGlobalTab()" translate>Global</a>
</li>
<li ng-repeat="setting in context.rpcSettings" ng-class="{'active': isCurrentRpcTab($index)}">
<a class="pointer-cursor" ng-click="changeRpcTab($index)" ng-bind="'RPC' + (setting.rpcAlias || setting.rpcHost ? '-' + (setting.rpcAlias ? setting.rpcAlias : setting.rpcHost + ':' + setting.rpcPort) : '')">RPC</a>
<li class="nav-tab-title-rpcname" ng-repeat="setting in context.rpcSettings" ng-class="{'active': isCurrentRpcTab($index)}">
<a class="pointer-cursor" ng-click="changeRpcTab($index)">
<span class="nav-tab-rpcname" ng-bind="'RPC' + (setting.rpcAlias || setting.rpcHost ? '(' + (setting.rpcAlias ? setting.rpcAlias : setting.rpcHost + ':' + setting.rpcPort) + ')' : '')" title="{{(setting.rpcAlias ? setting.rpcAlias : setting.rpcHost + ':' + setting.rpcPort)}}">RPC</span>
</a>
<a class="pointer-cursor nav-tab-close" ng-if="!setting.isDefault" title="{{'Delete RPC Setting' | translate}}">
<i class="fa fa-times" ng-click="removeRpcSetting(setting)"></i>
</a>
</li>
<li class="slim">
<a class="pointer-cursor" ng-click="addNewRpcSetting()" title="{{'Add New RPC Setting' | translate}}">
@ -212,9 +217,6 @@
<button class="btn btn-xs btn-default" ng-disabled="setting.isDefault" ng-click="setDefaultRpcSetting(setting)">
<span translate>Set Default</span>
</button>
<button class="btn btn-xs btn-danger" ng-if="!setting.isDefault" ng-disabled="setting.isDefault" ng-click="removeRpcSetting(setting)">
<span translate>Delete RPC Setting</span>
</button>
</div>
</div>
</div>