Compare commits
3 Commits
10c70ad1da
...
261670e79b
Author | SHA1 | Date |
---|---|---|
argirok | 261670e79b | |
argirok | a0df132a6b | |
argirok | 0067239cb6 |
|
@ -10,21 +10,20 @@
|
|||
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
|
||||
[texts]="pageContents['top']"></helper>
|
||||
|
||||
<form class="">
|
||||
<form *ngIf="filterForm" class="">
|
||||
<div class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
|
||||
<div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false" placeholder="Search links"
|
||||
[selected]="inputkeyword" (closeEmitter)="onSearchClose()" (resetEmitter)="resetInput()"
|
||||
[bordered]="true" colorClass="uk-text-secondary"></div>
|
||||
<div #searchInputComponent search-input [searchControl]="filterForm.controls.keyword" placeholder="Search links"
|
||||
(searchEmitter)="changekeyword()" [expandable]="true"></div>
|
||||
</div>
|
||||
<div class=" uk-grid uk-flex-middle">
|
||||
<div class="">Filter by: </div>
|
||||
<div class="uk-width-medium uk-padding-remove uk-margin-small-left" dashboard-input
|
||||
<div class="uk-width-medium uk-padding-remove uk-margin-small-left" input
|
||||
[formInput]="filterForm.get('entities')"
|
||||
placeholder="Search by entities"
|
||||
type="chips" [options]="allOptions" chipLabel="label">
|
||||
</div>
|
||||
<div class="">Sort by: </div>
|
||||
<div class="uk-width-medium uk-padding-remove uk-margin-small-left" dashboard-input
|
||||
<div class="uk-width-medium uk-padding-remove uk-margin-small-left" input
|
||||
[formInput]="filterForm.get('sort')"
|
||||
type="select"
|
||||
[options]="sortOptions">
|
||||
|
|
|
@ -17,9 +17,10 @@ import {HelperService} from '../../../utils/helper/helper.service';
|
|||
import {Meta, Title} from '@angular/platform-browser';
|
||||
import {PiwikService} from '../../../utils/piwik/piwik.service';
|
||||
import {properties} from '../../../../../environments/environment';
|
||||
import {FormArray, FormBuilder, FormGroup} from '@angular/forms';
|
||||
import {FormArray, FormBuilder, FormControl, FormGroup} from '@angular/forms';
|
||||
import {Option} from '../../../sharedComponents/input/input.component';
|
||||
import {SearchInputComponent} from '../../../sharedComponents/search-input/search-input.component';
|
||||
import {OpenaireEntities} from "../../../utils/properties/searchFields";
|
||||
|
||||
declare var UIkit;
|
||||
@Component({
|
||||
|
@ -62,9 +63,8 @@ export class DisplayClaimsComponent {
|
|||
public filterForm: FormGroup;
|
||||
public entitiesCtrl: FormArray;
|
||||
|
||||
allOptions: Option[] = [{label: "Projects", value: {id:"project", label: "Projects"}},{label: "Publications", value:{id:"publication", label: "Publications"}},{label: "Research data", value: {id:"dataset", label: "Research data"}},
|
||||
{label: "Software", value: {id:"software", label: "Software"}},{label: "Other reserch products", value: {id:"other", label: "Other reserch products"}},{label: "Communities", value: {id:"context", label: "Communities"}}];
|
||||
|
||||
allOptions: Option[] = [{label: OpenaireEntities.PROJECTS, value: "project"},{label: OpenaireEntities.PUBLICATIONS, value:"publication"},{label: OpenaireEntities.DATASETS, value: "dataset"},
|
||||
{label: OpenaireEntities.SOFTWARE, value: "software"},{label: OpenaireEntities.OTHER, value: "other"},{label: OpenaireEntities.COMMUNITIES, value: "context"}];
|
||||
sortOptions: Option[] = [
|
||||
{label:"Date (recent) ", value:{ sort: "date", descending: true }}, {label:"Date (oldest) ", value:{ sort: "date",descending:false }},
|
||||
// {label:"User (desc) ", value:{ sort: "user",descending: true }}, {label:"User (asc) ", value:{ sort: "user",descending:false }},
|
||||
|
@ -148,7 +148,7 @@ export class DisplayClaimsComponent {
|
|||
this.page = (page <= 0) ? 1 : page;
|
||||
this.size = (size <= 0) ? this.defaultSize : size;
|
||||
this.entityTypes = [];//(params['types']?params['types']:[]);
|
||||
// this.setTypes(params['types']); // check the appropriate checkboxes
|
||||
this.setTypes(params['types']); // check the appropriate checkboxes
|
||||
this.setSortby(params['sort']);
|
||||
this.getClaims();
|
||||
this.subscriptions.push(this.searchTermStream
|
||||
|
@ -161,9 +161,6 @@ export class DisplayClaimsComponent {
|
|||
this.subscriptions.push(this.filterForm.get('entities').valueChanges.subscribe(value => {
|
||||
this.goTo();
|
||||
}));
|
||||
this.subscriptions.push(this.filterForm.get('keyword').valueChanges.subscribe(value => {
|
||||
this.changekeyword();
|
||||
}));
|
||||
this.subscriptions.push(this.filterForm.get('sort').valueChanges.subscribe(value => {
|
||||
this.goTo();
|
||||
}));
|
||||
|
@ -196,7 +193,7 @@ export class DisplayClaimsComponent {
|
|||
this.showErrorMessage = false;
|
||||
this.showForbiddenMessage = false;
|
||||
for (let type of this.entitiesCtrl.getRawValue()) {
|
||||
types += (this.entitiesCtrl.getRawValue().length > 0 ? '&' : '') + "types=" + type.id;
|
||||
types += (types.length > 0 ? '&' : '') + "types=" + type;
|
||||
}
|
||||
this.pageLoading = true;
|
||||
if(this.subResults){
|
||||
|
@ -305,7 +302,7 @@ export class DisplayClaimsComponent {
|
|||
params += (this.size == 10 ? "" : (params.length > 0 ? '&' : '') + "size=" + this.size);
|
||||
let types = "";
|
||||
for (let type of this.entitiesCtrl.getRawValue()) {
|
||||
types += (this.entitiesCtrl.getRawValue().length > 0 ? ',' : '') + type.id;
|
||||
types += (types.length > 0 ? ',' : '') + type;
|
||||
}
|
||||
params += (this.entitiesCtrl.getRawValue().length > 0) ? (params.length > 0 ? '&' : '') + "types=" + types : "";
|
||||
if (this.isAdmin) {
|
||||
|
@ -332,9 +329,14 @@ export class DisplayClaimsComponent {
|
|||
this.filterForm.get("sort").setValue(option?option.value:this.sortOptions[0].value);
|
||||
}
|
||||
|
||||
changekeyword() {
|
||||
setTypes(typesParam: string) {
|
||||
for(let type of typesParam?typesParam.split(','):[]){
|
||||
this.entitiesCtrl.push(new FormControl(type));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.filterForm.get("keyword").value.length >= 3 || this.filterForm.get("keyword").value.length == 0) {
|
||||
changekeyword() {
|
||||
if (this.filterForm.get("keyword") && (this.filterForm.get("keyword").value.length >= 3 || this.filterForm.get("keyword").value.length == 0)) {
|
||||
this.searchTermStream.next(this.filterForm.get("keyword").value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,31 +13,31 @@ export class ClaimsService {
|
|||
return this.http.get(url, CustomOptions.getAuthOptions());
|
||||
}
|
||||
getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string):any {
|
||||
let url = apiUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
||||
let url = apiUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types);
|
||||
return this.getClaimRequest(size,page,url,true);
|
||||
|
||||
}
|
||||
getClaimsByUser( size : number, page : number, user:string, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string):any {
|
||||
//console.info('ClaimsService: getClaims for user : '+user);
|
||||
let url = apiUrl +"users/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
||||
let url = apiUrl +"users/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types);
|
||||
return this.getClaimRequest(size,page,url,false);
|
||||
|
||||
}
|
||||
getClaimsBycontext( size : number, page : number, contextId:string, keyword:string, sortby: string, descending: boolean, types: string , apiUrl:string):any {
|
||||
//console.info('ClaimsService: getClaims for context : '+contextId);
|
||||
let url = apiUrl +"contexts/"+contextId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
||||
let url = apiUrl +"contexts/"+contextId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types);
|
||||
return this.getClaimRequest(size,page,url,true);
|
||||
|
||||
}
|
||||
getClaimsByResult( size : number, page : number, resultId:string, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string ):any {
|
||||
//console.info('ClaimsService: getClaims for entity : '+resultId);
|
||||
let url = apiUrl +"results/"+resultId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
||||
let url = apiUrl +"results/"+resultId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types);
|
||||
return this.getClaimRequest(size,page,url,true);
|
||||
|
||||
}
|
||||
getClaimsByProject( size : number, page : number, projectId:string, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string ):any {
|
||||
//console.info('ClaimsService: getClaims for project : '+projectId);
|
||||
let url = apiUrl +"projects/"+projectId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
||||
let url = apiUrl +"projects/"+projectId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types);
|
||||
return this.getClaimRequest(size,page,url,true);
|
||||
}
|
||||
|
||||
|
|
|
@ -463,7 +463,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
|
|||
}
|
||||
|
||||
getLabel(value: any) {
|
||||
let option = this.filteredOptions.find(option => HelperFunctions.equals(option.value, value));
|
||||
let option = this.optionsArray.find(option => HelperFunctions.equals(option.value, value));
|
||||
return (option) ? option.label : (value);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue