update for advanced-search options.

This commit is contained in:
kunw 2016-07-04 19:09:19 +08:00
parent ed08eb1c16
commit ae3bfba3c8
5 changed files with 37 additions and 16 deletions

View File

@ -46,7 +46,7 @@
<div class="col-xs-2 col-md-2">
<form>
<div class="form-group" style="margin-top: 40%;">
<button type="button" class="btn btn-primary" ng-click="vm.search({op: vm.op})">// 'search' | tr //</button>
<button type="button" class="btn btn-primary" ng-click="vm.doSearch({op: vm.op})">// 'search' | tr //</button>
</div>
</form>
</div>

View File

@ -16,6 +16,8 @@
vm.opAll = true;
vm.doSearch = doSearch;
$scope.$watch('vm.op', function(current) {
if(current && vm.op[0] === 'all') {
vm.opCreate = true;
@ -23,7 +25,6 @@
vm.opPush = true;
vm.opDelete = true;
vm.opOthers = true;
vm.others = "";
}
}, true);
@ -38,13 +39,14 @@
vm.toDate = current;
}
});
vm.opCreate = true;
vm.opPull = true;
vm.opPush = true;
vm.opDelete = true;
vm.opOthers = true;
vm.others = "";
vm.others = '';
vm.op = [];
vm.op.push('all');
@ -56,26 +58,25 @@
vm.opDelete = vm.opAll;
vm.opOthers = vm.opAll;
}else {
vm.op = [];
vm.opAll = false;
}
vm.op = [];
if(vm.opCreate) {
vm.op.push('create');
}
if(vm.opPull) {
vm.op.push('pull');
vm.op.push('pull');
}
if(vm.opPush) {
vm.op.push('push');
vm.op.push('push');
}
if(vm.opDelete) {
vm.op.push('delete');
vm.op.push('delete');
}
if(vm.opOthers && $.trim(vm.others) !== '') {
vm.op.push($.trim(vm.others));
}
if(vm.opOthers && vm.others !== "") {
vm.op.push(vm.others);
}
}
vm.pickUp = pickUp;
@ -100,6 +101,13 @@
vm.others = '';
vm.isOpen = false;
}
function doSearch (e){
if(vm.opOthers && $.trim(vm.others) !== '') {
e.op.push(vm.others);
}
vm.search(e);
}
}
function advancedSearch() {
@ -109,6 +117,7 @@
'scope': {
'isOpen': '=',
'op': '=',
'opOthers': '=',
'others': '=',
'fromDate': '=',
'toDate': '=',

View File

@ -11,7 +11,7 @@
</span>
</div>
</div>
<advanced-search ng-show="vm.isOpen" is-open="vm.isOpen" op="vm.op" others="vm.others" search='vm.search({op: vm.op, username: vm.username})' from-date="vm.fromDate" to-date="vm.toDate"></advanced-search>
<advanced-search ng-show="vm.isOpen" is-open="vm.isOpen" op="vm.op" others="vm.others" search='vm.search({op: vm.op, username: vm.username})' from-date="vm.fromDate" to-date="vm.toDate" op-others="vm.opOthers"></advanced-search>
<div class="pane">
<div class="sub-pane">
<div class="table-head-container">

View File

@ -24,7 +24,8 @@
vm.username = "";
vm.op = [];
vm.opOthers = true;
vm.search = search;
vm.showAdvancedSearch = showAdvancedSearch;
@ -52,9 +53,18 @@
function search(e) {
if(e.op[0] === 'all') {
vm.queryParams.keywords = '';
if(vm.opOthers && $.trim(vm.others) !== '') {
e.op = [];
e.op.push(vm.others);
vm.queryParams.keywords = e.op.join('/');
}else{
vm.queryParams.keywords = '';
}
}else {
vm.queryParams.keywords = e.op.join('/') ;
if(vm.opOthers && $.trim(vm.others) !== '') {
e.op.push(vm.others);
}
vm.queryParams.keywords = e.op.join('/');
}
vm.queryParams.username = e.username;
@ -92,6 +102,7 @@
vm.fromDate = '';
vm.toDate = '';
vm.others = '';
vm.opOthers = true;
vm.isOpen = false;
}
function listLogFailed(response){

View File

@ -36,6 +36,7 @@
$scope.$on('$locationChangeSuccess', function() {
vm.projectId = getParameterByName('project_id', $location.absUrl());
vm.filterInput = '';
vm.retrieve();
});