TSK-739 - Fix task list filtering

This commit is contained in:
Jose Ignacio Recuerda Cambil 2018-11-22 12:00:36 +01:00 committed by Martin Rojas Miguel Angel
parent 6d455e29cc
commit 12b5fb1f0a
7 changed files with 64 additions and 16 deletions

View File

@ -63,7 +63,9 @@ public class TaskController extends AbstractPagingController {
private static final String STATE_VALUE_READY = "READY"; private static final String STATE_VALUE_READY = "READY";
private static final String PRIORITY = "priority"; private static final String PRIORITY = "priority";
private static final String NAME = "name"; private static final String NAME = "name";
private static final String NAME_LIKE = "name-like";
private static final String OWNER = "owner"; private static final String OWNER = "owner";
private static final String OWNER_LIKE = "owner-like";
private static final String DOMAIN = "domain"; private static final String DOMAIN = "domain";
private static final String WORKBASKET_ID = "workbasket-id"; private static final String WORKBASKET_ID = "workbasket-id";
private static final String WORKBASKET_KEY = "workbasket-key"; private static final String WORKBASKET_KEY = "workbasket-key";
@ -219,6 +221,10 @@ public class TaskController extends AbstractPagingController {
taskQuery.nameIn(names); taskQuery.nameIn(names);
params.remove(NAME); params.remove(NAME);
} }
if (params.containsKey(NAME_LIKE)) {
taskQuery.nameLike(LIKE + params.get(NAME_LIKE).get(0) + LIKE);
params.remove(NAME_LIKE);
}
if (params.containsKey(PRIORITY)) { if (params.containsKey(PRIORITY)) {
String[] prioritiesInString = extractCommaSeparatedFields(params.get(PRIORITY)); String[] prioritiesInString = extractCommaSeparatedFields(params.get(PRIORITY));
int[] priorities = extractPriorities(prioritiesInString); int[] priorities = extractPriorities(prioritiesInString);
@ -262,6 +268,10 @@ public class TaskController extends AbstractPagingController {
taskQuery.ownerIn(owners); taskQuery.ownerIn(owners);
params.remove(OWNER); params.remove(OWNER);
} }
if (params.containsKey(OWNER_LIKE)) {
taskQuery.ownerLike(LIKE + params.get(OWNER_LIKE).get(0) + LIKE);
params.remove(OWNER_LIKE);
}
if (params.containsKey(POR_COMPANY)) { if (params.containsKey(POR_COMPANY)) {
String[] companies = extractCommaSeparatedFields(params.get(POR_COMPANY)); String[] companies = extractCommaSeparatedFields(params.get(POR_COMPANY));
taskQuery.primaryObjectReferenceCompanyIn(companies); taskQuery.primaryObjectReferenceCompanyIn(companies);

View File

@ -65,14 +65,24 @@
</button> </button>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-4 col-xs-offset-2"> <div class="dropdown col-xs-2 col-xs-offset-2">
<input type="text" [(ngModel)]="filter.filterParams.state" (keyup.enter)="search()" class="form-control" id="display-owner-state" <button class="btn btn-default" data-toggle="dropdown" type="button" data-toggle="dropdown"
placeholder="Filter status"> aria-haspopup="true" aria-expanded="true" title="State: {{filter.filterParams.state ? filter.filterParams?.state : 'All'}}">
<span>{{filter.filterParams.state ? filter.filterParams?.state : 'All'}}</span>
</button>
<ul class="dropdown-menu dropdown-menu-users" role="menu">
<li>
<a *ngFor="let state of allStates | mapValues" type="button" (click)="selectState(state.key); search()"
data-toggle="tooltip" [title]="state.value">
<label class="blue">{{state.value}}</label>
</a>
</li>
</ul>
</div> </div>
<button (click)="search()" type="button" class="btn btn-default pull-right margin-right" data-toggle="tooltip" <button (click)="search()" type="button" class="btn btn-default pull-right margin-right" data-toggle="tooltip"
title="Search"> title="Search">
<span class="material-icons md-20 blue ">search</span> <span class="material-icons md-20 blue">search</span>
</button> </button>
</div> </div>
</ng-template> </ng-template>
</div> </div>

View File

@ -23,3 +23,11 @@ row.padding {
.filter-list > li { .filter-list > li {
padding-top: 5px; padding-top: 5px;
} }
.blue {
color: #2e9eca;
}
button.btn.btn-default.pull-right.margin-right {
margin-top: 1px;
}

View File

@ -13,6 +13,9 @@ export class FilterComponent implements OnInit {
@Input() allTypes: Map<string, string> = new Map([['ALL', 'All'], ['PERSONAL', 'Personal'], ['GROUP', 'Group'], @Input() allTypes: Map<string, string> = new Map([['ALL', 'All'], ['PERSONAL', 'Personal'], ['GROUP', 'Group'],
['CLEARANCE', 'Clearance'], ['TOPIC', 'Topic']]); ['CLEARANCE', 'Clearance'], ['TOPIC', 'Topic']]);
@Input() allStates: Map<string, string> = new Map([['ALL', 'All'], ['READY', 'Ready'], ['CLAIMED', 'Claimed'],
['COMPLETED', 'Completed']]);
@Input() filterParams = { name: '', key: '', type: '', description: '', owner: '' }; @Input() filterParams = { name: '', key: '', type: '', description: '', owner: '' };
@Input() filterType = TaskanaType.WORKBASKETS; @Input() filterType = TaskanaType.WORKBASKETS;
@ -24,9 +27,6 @@ export class FilterComponent implements OnInit {
lastFilterKey: string; lastFilterKey: string;
toggleDropDown = false; toggleDropDown = false;
constructor() {
}
ngOnInit(): void { ngOnInit(): void {
this.initializeFilterModel(); this.initializeFilterModel();
if (this.filterParams) { if (this.filterParams) {
@ -39,6 +39,10 @@ export class FilterComponent implements OnInit {
this.filter.filterParams.type = (type === ICONTYPES.ALL) ? '' : type; this.filter.filterParams.type = (type === ICONTYPES.ALL) ? '' : type;
} }
selectState(state: ICONTYPES) {
this.filter.filterParams.state = (state === 'ALL') ? '' : state;
}
clear() { clear() {
for (const key of Object.keys(this.filterParams)) { for (const key of Object.keys(this.filterParams)) {
this.filterParams[key] = ''; this.filterParams[key] = '';

View File

@ -14,7 +14,7 @@ export class TaskanaQueryParameters {
static WORKBASKET_KEY = 'workbasket-key'; static WORKBASKET_KEY = 'workbasket-key';
static KEYLIKE = 'key-like'; static KEYLIKE = 'key-like';
static PRIORITY = 'priority'; static PRIORITY = 'priority';
static STATELIKE = 'state-like'; static STATE = 'state';
static WORKBASKET_ID = 'workbasket-id'; static WORKBASKET_ID = 'workbasket-id';
static TASK_PRIMARY_OBJ_REF_TYPE_LIKE = 'por.type'; static TASK_PRIMARY_OBJ_REF_TYPE_LIKE = 'por.type';
static TASK_PRIMARY_OBJ_REF_VALUE_LIKE = 'por.value'; static TASK_PRIMARY_OBJ_REF_VALUE_LIKE = 'por.value';
@ -54,9 +54,9 @@ export class TaskanaQueryParameters {
workbasketKeyLike: string = undefined, workbasketKeyLike: string = undefined,
basketId: string = undefined, basketId: string = undefined,
priority: string = undefined, priority: string = undefined,
stateLike: string = undefined, state: string = undefined,
objRefTypeLike: string = undefined, objRefTypeLike: string = undefined,
objRefValueLike: string = undefined, objRefValueLike: string = undefined
): string { ): string {
let query = '?'; let query = '?';
query += sortBy ? `${this.SORTBY}=${sortBy}&` : ''; query += sortBy ? `${this.SORTBY}=${sortBy}&` : '';
@ -68,7 +68,7 @@ export class TaskanaQueryParameters {
query += ownerLike ? `${this.OWNERLIKE}=${ownerLike}&` : ''; query += ownerLike ? `${this.OWNERLIKE}=${ownerLike}&` : '';
query += basketId ? `${this.WORKBASKET_ID}=${basketId}&` : ''; query += basketId ? `${this.WORKBASKET_ID}=${basketId}&` : '';
query += priority ? `${this.PRIORITY}=${priority}&` : ''; query += priority ? `${this.PRIORITY}=${priority}&` : '';
query += stateLike ? `${this.STATELIKE}=${stateLike}&` : ''; query += state ? `${this.STATE}=${state}&` : '';
query += type ? `${this.TYPE}=${type}&` : ''; query += type ? `${this.TYPE}=${type}&` : '';
query += key ? `${this.KEY}=${key}&` : ''; query += key ? `${this.KEY}=${key}&` : '';
query += keyLike ? `${this.KEYLIKE}=${keyLike}&` : ''; query += keyLike ? `${this.KEYLIKE}=${keyLike}&` : '';

View File

@ -9,10 +9,10 @@
<input [(ngModel)]="resultName" *ngIf="searchSelected === search.byWorkbasket" [typeahead]="workbasketNames" <input [(ngModel)]="resultName" *ngIf="searchSelected === search.byWorkbasket" [typeahead]="workbasketNames"
class="form-control" (typeaheadOnSelect)="searchBasket()" (typeaheadNoResults)="workbasketSelected = false" class="form-control" (typeaheadOnSelect)="searchBasket()" (typeaheadNoResults)="workbasketSelected = false"
placeholder="Search for Workbasket ..." /> placeholder="Search for Workbasket ..." />
<div class="input-group" style="margin-bottom: 1px;" *ngIf="searchSelected === search.byTypeAndValue"> <div class="input-group" *ngIf="searchSelected === search.byTypeAndValue">
<input [(ngModel)]="resultType" class="form-control" (keyup.enter)="searchBasket()" placeholder="Search by type ..." /> <input [(ngModel)]="resultType" class="form-control" (keyup.enter)="searchBasket()" placeholder="Search by type ..." />
<span _ngcontent-c10="" class="input-group-btn"> <span _ngcontent-c10="" class="input-group-btn">
<button _ngcontent-c10="" class="btn btn-primary" style="height: 34px;" type="button" (click)="searchBasket()"> <button _ngcontent-c10="" class="btn btn-primary" type="button" (click)="searchBasket()">
<span class="material-icons md-20 white">search</span> <span class="material-icons md-20 white">search</span>
</button> </button>
</span> </span>
@ -37,13 +37,13 @@
<h5 class="bold-blue align-center">Search by</h5> <h5 class="bold-blue align-center">Search by</h5>
</div> </div>
<div role="separator" class="divider"></div> <div role="separator" class="divider"></div>
<ul style="padding: 15px;"> <ul>
<li data-toggle="tooltip" title="Workbasket"> <li data-toggle="tooltip" title="Workbasket">
<a class="dropdown-item" (click)="selectSearch(search.byWorkbasket)"> <a class="dropdown-item" (click)="selectSearch(search.byWorkbasket)">
<label> <label>
<span class="material-icons md-20 blue margin-right" aria-hidden="true">{{ searchSelected === search.byWorkbasket ? 'check_box': 'check_box_outline_blank' }}</span> <span class="material-icons md-20 blue margin-right" aria-hidden="true">{{ searchSelected === search.byWorkbasket ? 'check_box': 'check_box_outline_blank' }}</span>
<svg-icon class="margin-right" src="./assets/icons/wb-empty.svg"></svg-icon> <svg-icon class="margin-right" src="./assets/icons/wb-empty.svg"></svg-icon>
<small class="margin-right blue-font" style="margin-left: 4px;">Workbasket</small> <small class="margin-right blue-font">Workbasket</small>
</label> </label>
</a> </a>
</li> </li>

View File

@ -44,3 +44,19 @@ svg-icon.blue {
padding-right: 5px; padding-right: 5px;
} }
} }
small.margin-right.blue-font {
margin-left: 4px;
}
div.dropdown-menu ul {
padding: 15px;
}
div.input-group {
margin-bottom: 1px;
}
button.btn.btn-primary {
height: 34px;
}