support search task

This commit is contained in:
MaysWind 2016-05-28 22:20:42 +08:00
parent 2c50e31fbe
commit 8173e5ec27
7 changed files with 107 additions and 67 deletions

View file

@ -34,72 +34,84 @@
</a>
<nav class="navbar navbar-static-top" role="navigation">
<ul class="nav navbar-nav">
<li>
<a class="toolbar" title="{{'New' | translate}}">
<i class="fa fa-plus"></i>
<span translate>New</span>
</a>
</li>
<li>
<a class="toolbar" title="{{'Start' | translate}}">
<i class="fa fa-play"></i>
</a>
</li>
<li>
<a class="toolbar" title="{{'Pause' | translate}}">
<i class="fa fa-pause"></i>
</a>
</li>
<li>
<a class="toolbar" title="{{'Delete' | translate}}">
<i class="fa fa-trash-o"></i>
</a>
</li>
<li>
<a class="toolbar dropdown-toggle" data-toggle="dropdown" title="{{'Display Order' | translate}}">
<i class="fa fa-sort-alpha-asc"></i>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('default:asc')">
<span translate>Default</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('default')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('name:asc')">
<span translate>By File Name</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('name')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('size:asc')">
<span translate>By File Size</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('size')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('percent:desc')">
<span translate>By Completed Percent</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('percent')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('remain:asc')">
<span translate>By Remain Time</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('remain')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('dspeed:desc')">
<span translate>By Download Speed</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('dspeed')}"></i>
</a>
</li>
</ul>
</li>
</ul>
<div class="navbar-toolbar">
<ul class="nav navbar-nav">
<li>
<a class="toolbar" title="{{'New' | translate}}">
<i class="fa fa-plus"></i>
<span translate>New</span>
</a>
</li>
<li>
<a class="toolbar" title="{{'Start' | translate}}">
<i class="fa fa-play"></i>
</a>
</li>
<li>
<a class="toolbar" title="{{'Pause' | translate}}">
<i class="fa fa-pause"></i>
</a>
</li>
<li>
<a class="toolbar" title="{{'Delete' | translate}}">
<i class="fa fa-trash-o"></i>
</a>
</li>
<li>
<a class="toolbar dropdown-toggle" data-toggle="dropdown" title="{{'Display Order' | translate}}">
<i class="fa fa-sort-alpha-asc"></i>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('default:asc')">
<span translate>Default</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('default')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('name:asc')">
<span translate>By File Name</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('name')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('size:asc')">
<span translate>By File Size</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('size')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('percent:desc')">
<span translate>By Completed Percent</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('percent')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('remain:asc')">
<span translate>By Remain Time</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('remain')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('dspeed:desc')">
<span translate>By Download Speed</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('dspeed')}"></i>
</a>
</li>
</ul>
</li>
</ul>
</div>
<div class="navbar-searchbar hidden-xs">
<ul class="nav navbar-nav">
<li>
<input class="form-control" placeholder="{{('Search' | translate)}}" ng-model="searchContext.text" />
<div class="form-control-icon">
<span class="fa fa-search form-control-feedback"></span>
</div>
</li>
</ul>
</div>
</nav>
</header>

View file

@ -12,6 +12,7 @@
"Pause": "暂停下载任务",
"Delete": "删除下载任务",
"Display Order": "显示顺序",
"Search": "搜索",
"Default": "默认",
"By File Name": "按文件名",
"By File Size": "按文件大小",

View file

@ -85,6 +85,18 @@
$scope.titleWidth = getTitleWidth();
$scope.filterByTaskName = function (task) {
if (!task || !angular.isString(task.taskName)) {
return false;
}
if (!$scope.searchContext || !$scope.searchContext.text) {
return true;
}
return (task.taskName.toLowerCase().indexOf($scope.searchContext.text.toLowerCase()) >= 0);
};
$scope.getOrderType = function () {
return ariaNgSettingService.getDisplayOrder();
};

View file

@ -26,6 +26,10 @@
refreshGlobalStat();
$scope.searchContext = {
text: ''
};
$scope.changeDisplayOrder = function (type, autoSetReverse) {
var oldType = utils.parseOrderType(ariaNgSettingService.getDisplayOrder());
var newType = utils.parseOrderType(type);

View file

@ -16,6 +16,7 @@
'Pause': 'Pause',
'Delete': 'Delete',
'Display Order': 'Display Order',
'Search': 'Search',
'Default': 'Default',
'By File Name': 'By File Name',
'By File Size': 'By File Size',

View file

@ -43,6 +43,16 @@
color: #0080ff;
}
.skin-aria-ng .main-header .navbar .navbar-searchbar {
padding-top: 8px;
padding-right: 20px;
float: right;
}
.skin-aria-ng .main-header .navbar .navbar-searchbar .form-control-icon {
color: #999999;
}
@media (max-width: 767px) {
.skin-aria-ng .main-header .navbar {
padding-left: 20px;

View file

@ -35,7 +35,7 @@
</div>
</div>
<div class="task-table-body">
<div class="row" ng-repeat="task in downloadTasks | taskOrderBy: getOrderType()" data-gid="{{task.gid}}">
<div class="row" ng-repeat="task in downloadTasks | filter: filterByTaskName | taskOrderBy: getOrderType()" data-gid="{{task.gid}}">
<div class="col-sm-8">
<span class="task-name" ng-bind="task.taskName | substring: (titleWidth / 20)" title="{{task.taskName}}"></span>
<div class="task-files">