add a vocabulary service, a first draft of publicationsadvanced page, autocomplete for fields from vacabulary, create seperate method in SearchProjectsComponent for just keyword search and full parameters
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44309 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
2f918c3430
commit
5d799b7fe7
|
@ -19,7 +19,7 @@ import { SearchProjectsComponent } from './searchPages/searchProjects.component'
|
||||||
import { SearchDatasetsComponent } from './searchPages/searchDatasets.component';
|
import { SearchDatasetsComponent } from './searchPages/searchDatasets.component';
|
||||||
import { SearchOrganizationsComponent } from './searchPages/searchOrganizations.component';
|
import { SearchOrganizationsComponent } from './searchPages/searchOrganizations.component';
|
||||||
import { SearchPeopleComponent } from './searchPages/searchPeople.component';
|
import { SearchPeopleComponent } from './searchPages/searchPeople.component';
|
||||||
import { AdvancedSearchPublicationsComponent } from './searchPages/advancedSearchPublications.component';
|
import { AdvancedSearchPublicationsComponent } from './searchPages/advanced/advancedSearchPublications.component';
|
||||||
import { DepositComponent } from './deposit/deposit.component';
|
import { DepositComponent } from './deposit/deposit.component';
|
||||||
import { DepositResultComponent } from './deposit/depositResult.component';
|
import { DepositResultComponent } from './deposit/depositResult.component';
|
||||||
import { ErrorPageComponent } from './error/errorPage.component';
|
import { ErrorPageComponent } from './error/errorPage.component';
|
||||||
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
import {Component, Input, ViewChild} from '@angular/core';
|
||||||
|
import {Observable} from 'rxjs/Observable';
|
||||||
|
import { Router, ActivatedRoute} from '@angular/router';
|
||||||
|
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
|
||||||
|
import {SearchPublicationsService} from '../../services/searchPublications.service';
|
||||||
|
import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
|
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
|
|
||||||
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'advanced-search-publications',
|
||||||
|
template: `
|
||||||
|
<advanced-search-page pageTitle="Advanced Search Publications" type="publication"
|
||||||
|
[(results)] = "results" [(totalResults)] = "totalResults"
|
||||||
|
[(page)] = "page" [(size)] = "size" [baseUrl] = "baseUrl"
|
||||||
|
[(fieldIds)]="fieldIds" [(selectedFields)]="selectedFields"
|
||||||
|
(queryChange)="queryChanged($event)">
|
||||||
|
</advanced-search-page>
|
||||||
|
|
||||||
|
`
|
||||||
|
})
|
||||||
|
/*
|
||||||
|
[(filters)] = "filters"
|
||||||
|
[(fields)] = "fields" [(selectedFields)]="selectedFields"
|
||||||
|
[(quantifiers)]="quantifiers" [(selectedQuantifiers)]="selectedQuantifiers"
|
||||||
|
[(keywords)] = "keywords"
|
||||||
|
*/
|
||||||
|
export class AdvancedSearchPublicationsComponent {
|
||||||
|
private results =[];
|
||||||
|
private filters =[];
|
||||||
|
private totalResults:number = 0 ;
|
||||||
|
private page :number = 1;
|
||||||
|
private size :number = 10;
|
||||||
|
public status:number;
|
||||||
|
private baseUrl: string;
|
||||||
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
|
||||||
|
//"all", "title", "author", "date","project",
|
||||||
|
private fieldIds: string[] = ["funder","funderlv0","funderlv1","funderlv2","lang","type"];
|
||||||
|
|
||||||
|
//this.searchFields.ADVANCED_FIELDS_NAMES_IDS[this.fieldIds[0]].type
|
||||||
|
private selectedFields:AdvancedField[] = [new AdvancedField(this.fieldIds[0],this.searchFields.ADVANCED_FIELDS_NAMES_IDS[this.fieldIds[0]].name,"keyword","")];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) {
|
||||||
|
|
||||||
|
this.results =[];
|
||||||
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
|
this.status =errorCodes.LOADING;
|
||||||
|
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
ngOnInit() {
|
||||||
|
console.log(this.fieldIds[0]+" "+this.searchFields.ADVANCED_FIELDS_NAMES_IDS[this.fieldIds[0]].name);
|
||||||
|
// console.log(this.searchFields.ADVANCED_FIELDS_NAMES_IDS[this.fieldIds[0]].type);
|
||||||
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
|
let page = (params['page']=== undefined)?1:+params['page'];
|
||||||
|
// let size = (params['size']=== undefined)?10:+params['size'];
|
||||||
|
this.page = ( page <= 0 ) ? 1 : page;
|
||||||
|
// this.size = ( size <= 0 ) ? 10 : size;
|
||||||
|
//this.keywords = (params['keyword']?params['keyword']:'');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//TODO get the rest parameters to create query
|
||||||
|
}
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.sub.unsubscribe();
|
||||||
|
}
|
||||||
|
sub: any;
|
||||||
|
public getResults(parameters:string, page: number, size: number){
|
||||||
|
console.info("Advanced Search Publications: Execute search query "+parameters);
|
||||||
|
|
||||||
|
this._searchPublicationsService.searchPublications(parameters, page, size, 'searchPage').subscribe(
|
||||||
|
data => {
|
||||||
|
this.totalResults = data[0];
|
||||||
|
console.info("searchPubl total="+this.totalResults);
|
||||||
|
this.results = data[1];
|
||||||
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
|
this.status = errorCodes.DONE;
|
||||||
|
if(this.totalResults == 0 ){
|
||||||
|
this.status = errorCodes.NONE;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
err => {
|
||||||
|
console.error(err);
|
||||||
|
console.info("error");
|
||||||
|
//TODO check erros (service not available, bad request)
|
||||||
|
// if( ){
|
||||||
|
// this.status = ErrorCodes.ERROR;
|
||||||
|
// }
|
||||||
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
|
this.status = errorCodes.NOT_AVAILABLE;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
private setFilters(){
|
||||||
|
//TODO set filters from
|
||||||
|
}
|
||||||
|
|
||||||
|
private queryChanged($event) {
|
||||||
|
var parameters = $event.value;
|
||||||
|
this.getResults(parameters, this.page,this.size);
|
||||||
|
console.info("queryChanged: Execute search query "+parameters);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -198,7 +198,7 @@ export class SearchComponent {
|
||||||
this.activeTab = "projects";
|
this.activeTab = "projects";
|
||||||
if(this.reloadProjects) {
|
if(this.reloadProjects) {
|
||||||
this.reloadProjects = false;
|
this.reloadProjects = false;
|
||||||
this.searchProjectsComponent.getResults(this.keyword, 1, 10);
|
this.searchProjectsComponent.getResults(this.keyword, false, 1, 10);
|
||||||
this.linkToSearchProjects = OpenaireProperties.getLinkToSearchProjects() + this.keyword;
|
this.linkToSearchProjects = OpenaireProperties.getLinkToSearchProjects() + this.keyword;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import {SearchResultComponent} from './searchUtils/searchResult.component';
|
||||||
import {SearchFilterComponent} from './searchUtils/searchFilter.component';
|
import {SearchFilterComponent} from './searchUtils/searchFilter.component';
|
||||||
import {AdvancedSearchFormComponent} from './searchUtils/advancedSearchForm.component';
|
import {AdvancedSearchFormComponent} from './searchUtils/advancedSearchForm.component';
|
||||||
import { SearchPublicationsComponent } from './searchPublications.component';
|
import { SearchPublicationsComponent } from './searchPublications.component';
|
||||||
import { AdvancedSearchPublicationsComponent } from './advancedSearchPublications.component';
|
|
||||||
import { SearchDataprovidersComponent } from './searchDataproviders.component';
|
import { SearchDataprovidersComponent } from './searchDataproviders.component';
|
||||||
import { SearchProjectsComponent } from './searchProjects.component';
|
import { SearchProjectsComponent } from './searchProjects.component';
|
||||||
import {SearchDatasetsComponent} from './searchDatasets.component';
|
import {SearchDatasetsComponent} from './searchDatasets.component';
|
||||||
|
@ -29,7 +28,8 @@ import {SearchPeopleComponent} from './searchPeople.component';
|
||||||
|
|
||||||
import {SearchComponent} from './find/search.component';
|
import {SearchComponent} from './find/search.component';
|
||||||
import {SearchCompatibleDataprovidersComponent} from './dataProviders/compatibleDataProviders.component';
|
import {SearchCompatibleDataprovidersComponent} from './dataProviders/compatibleDataProviders.component';
|
||||||
|
//Advanced
|
||||||
|
import { AdvancedSearchPublicationsComponent } from './advanced/advancedSearchPublications.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
|
|
@ -62,7 +62,7 @@ export class SearchProjectsComponent {
|
||||||
|
|
||||||
|
|
||||||
this.searchPage.getSelectedFiltersFromUrl(params);
|
this.searchPage.getSelectedFiltersFromUrl(params);
|
||||||
this.getResults(this.keyword, this.page, this.size);
|
this.getResults(this.keyword, true, this.page, this.size);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,9 +70,16 @@ export class SearchProjectsComponent {
|
||||||
this.sub.unsubscribe();
|
this.sub.unsubscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getResults(parameters:string, page: number, size: number){
|
public getResults(keyword:string,refine:boolean, page: number, size: number){
|
||||||
|
var parameters = "";
|
||||||
|
if(keyword.length > 0){
|
||||||
|
parameters = "q=" + keyword + "&op=and";
|
||||||
|
}
|
||||||
|
this._getResults(parameters,refine,page,size);
|
||||||
|
}
|
||||||
|
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
||||||
|
|
||||||
this._searchProjectsService.searchProjects(parameters+this.searchPage.getRefineFieldsQuery(), page, size, this.searchPage.getFields()).subscribe(
|
this._searchProjectsService.searchProjects(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.totalResults = data[0];
|
this.totalResults = data[0];
|
||||||
console.info("search Projects: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
|
console.info("search Projects: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
|
||||||
|
@ -101,7 +108,7 @@ export class SearchProjectsComponent {
|
||||||
private queryChanged($event) {
|
private queryChanged($event) {
|
||||||
this.urlParams = undefined;
|
this.urlParams = undefined;
|
||||||
var parameters = $event.value;
|
var parameters = $event.value;
|
||||||
this.getResults(parameters, this.page, this.size);
|
this._getResults(parameters, true, this.page, this.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,151 +2,102 @@ import {Component, Input, Output, EventEmitter} from '@angular/core';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import { Subject } from 'rxjs/Subject';
|
import { Subject } from 'rxjs/Subject';
|
||||||
|
|
||||||
|
import {AdvancedField, OPERATOR} from '../searchUtils/searchHelperClasses.class';
|
||||||
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'advanced-search-form',
|
selector: 'advanced-search-form',
|
||||||
template: `
|
template: `
|
||||||
<form class="form-inline">
|
<form class="">
|
||||||
<div *ngFor="let selectedField of selectedFields; let i = index" class="form-group">
|
<div *ngFor="let selectedField of selectedFields; let i = index" class="form-group form-inline">
|
||||||
|
<div *ngIf = "i != 0" class="input-group">
|
||||||
|
<button [style.width]="'120px'" type="button" id="dropdownMenu1" data-toggle="dropdown" class="btn btn-default dropdown-toggle" aria-haspopup="true" aria-expanded="true">
|
||||||
|
{{selectedField.operatorName}}
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||||
|
<li *ngFor="let op of operators">
|
||||||
|
<a (click)="fieldOperatorChanged(i, op.id, op.name)">{{op.name}}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-btn">
|
<div class="input-group-btn">
|
||||||
<button [style.width]="'120px'" aria-expanded="false" aria-haspopup="true" class="btn btn-info dropdown-toggle" data-toggle="dropdown" id="dropdownMenu1" type="button">
|
<button [style.width]="'120px'" aria-expanded="false" aria-haspopup="true" class="btn btn-default dropdown-toggle" data-toggle="dropdown" id="dropdownMenu1" type="button">
|
||||||
{{selectedField['name']}}
|
{{selectedField.name}}
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||||
<li *ngFor="let field of fields">
|
<li *ngFor="let id of fieldIds">
|
||||||
<a (click)="fieldChanged(i, field)">{{field['name']}}</a>
|
<a (click)="fieldIdsChanged(i, id)">{{searchFields.ADVANCED_FIELDS_NAMES_IDS[id].name}}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<input *ngIf = "searchFields.ADVANCED_FIELDS_NAMES_IDS[selectedField.id].type == 'keyword'" type="text" class="form-control" placeholder="Type keywords..." [(ngModel)]="selectedField.value" name="value[{{i}}]">
|
||||||
|
|
||||||
<input type="text" class="form-control" placeholder="Type keywords..." [(ngModel)]="keywords[i]" name="keywords[{{i}}]">
|
|
||||||
|
|
||||||
<div class="input-group-btn">
|
|
||||||
<button [style.width]="'120px'" type="button" id="dropdownMenu1" data-toggle="dropdown" class="btn btn-info dropdown-toggle" aria-haspopup="true" aria-expanded="true">
|
|
||||||
{{selectedQuantifiers[i]['name']}}
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
|
||||||
<li *ngFor="let quantifier of quantifiers">
|
|
||||||
<a (click)="quantifierChanged(i, quantifier)">{{quantifier['name']}}</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="button" class="btn btn-success" (click)="addFilter()">
|
<div *ngIf = "searchFields.ADVANCED_FIELDS_NAMES_IDS[selectedField.id].type == 'staticAutoComplete'" class="input-group">
|
||||||
|
<static-autocomplete2 [vocabularyId] = selectedField.id [(selectedId)]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" title = "Languages:" [multipleSelections]=false ></static-autocomplete2>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-success" (click)="addField()">
|
||||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-danger" *ngIf="selectedFields.length > 1" (click)="removeFilter(i)">
|
<button type="button" class="btn btn-danger" *ngIf="selectedFields.length > 1" (click)="removeField(i)">
|
||||||
<span class="glyphicon glyphicon-minus" aria-hidden="true"></span>
|
<span class="glyphicon glyphicon-minus" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--div *ngFor="let selectedField of selectedFields; let i = index" class="form-group">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-9 col-sm-9">
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="col-xs-2 col-sm-2">
|
|
||||||
<div class="input-group-btn">
|
|
||||||
<button aria-expanded="false" aria-haspopup="true" class="btn btn-info dropdown-toggle" data-toggle="dropdown" id="dropdownMenu1" type="button">
|
|
||||||
{{selectedField['name']}}
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
|
||||||
<li *ngFor="let field of fields">
|
|
||||||
<a (click)="fieldChanged(i, field)">{{field['name']}}</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-xs-4 col-sm-4">
|
|
||||||
<input type="text" class="form-control" placeholder="Type keywords..." [(ngModel)]="keywords[i]" name="keywords[{{i}}]">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-xs-3 col-sm-3">
|
|
||||||
<div class="input-group-btn">
|
|
||||||
<button type="button" id="dropdownMenu1" data-toggle="dropdown" class="btn btn-info dropdown-toggle" aria-haspopup="true" aria-expanded="true">
|
|
||||||
{{selectedQuantifiers[i]['name']}}
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
|
||||||
<li *ngFor="let quantifier of quantifiers">
|
|
||||||
<a (click)="quantifierChanged(i, quantifier)">{{quantifier['name']}}</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-3 col-sm-3">
|
|
||||||
<button type="button" class="btn btn-success" (click)="addFilter()">
|
|
||||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button type="button" class="btn btn-danger" *ngIf="selectedFields.length > 1" (click)="removeFilter(i)">
|
|
||||||
<span class="glyphicon glyphicon-minus" aria-hidden="true"></span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div-->
|
|
||||||
|
|
||||||
|
|
||||||
|
<button (click)="queryChanged()" type="submit" class="btn btn-default">Search</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<button (click)="keywordsChanged()" type="submit" class="btn btn-default">Search</button>
|
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
|
|
||||||
export class AdvancedSearchFormComponent {
|
export class AdvancedSearchFormComponent {
|
||||||
|
|
||||||
|
@Input() fieldIds: string[];
|
||||||
|
@Input() selectedFields:AdvancedField[];
|
||||||
|
@Output() queryChange = new EventEmitter();
|
||||||
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
|
||||||
@Input() fields: {"name": string, "value": string}[];
|
private operators: [{name:string, id:string}] = [{name:"AND",id:"and"},{name:"OR",id:"or"},{name:"NOT",id:"not"}];
|
||||||
@Input() selectedFields: {"name": string, "value": string}[];
|
|
||||||
|
|
||||||
@Input() quantifiers: {"name": string, "value": string}[];
|
|
||||||
@Input() selectedQuantifiers: {"name": string, "value": string}[];
|
|
||||||
|
|
||||||
@Input() keywords: string[];
|
|
||||||
@Output() keywordsChange = new EventEmitter();
|
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
keywordsChanged() {
|
queryChanged() {
|
||||||
this.keywordsChange.emit({
|
this.queryChange.emit({
|
||||||
selectedFields: this.selectedFields,
|
// selectedFields: this.selectedFields,
|
||||||
selectedQuantifiers: this.selectedQuantifiers,
|
// selectedQuantifiers: this.selectedQuantifiers,
|
||||||
keywords: this.keywords
|
// keywords: this.keywords
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addFilter() {
|
addField() {
|
||||||
console.info("add filter");
|
console.info("add filter"+this.fieldIds[0]+this.searchFields.ADVANCED_FIELDS_NAMES_IDS[this.fieldIds[0]].name+this.searchFields.ADVANCED_FIELDS_NAMES_IDS[this.fieldIds[0]].type);
|
||||||
//this.values.push({"field": this.fields[0].value, "quantifier": this.quantifiers[0].value, "keywords": []});
|
this.selectedFields.push(new AdvancedField(this.fieldIds[0], this.searchFields.ADVANCED_FIELDS_NAMES_IDS[this.fieldIds[0]].name,this.searchFields.ADVANCED_FIELDS_NAMES_IDS[this.fieldIds[0]].type,""));
|
||||||
this.selectedFields.push(this.fields[0]);
|
|
||||||
this.selectedQuantifiers.push(this.quantifiers[0]);
|
|
||||||
this.keywords.push('');
|
|
||||||
console.info(this.keywords);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
removeFilter(index: number) {
|
removeField(index: number) {
|
||||||
console.info("remove filter");
|
console.info("remove filter");
|
||||||
//this.values.splice(index, 1);
|
|
||||||
this.selectedFields.splice(index, 1);
|
this.selectedFields.splice(index, 1);
|
||||||
this.selectedQuantifiers.splice(index, 1);
|
|
||||||
this.keywords.splice(index, 1);
|
|
||||||
console.info(this.keywords);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldChanged(index: number, field: {"name": string, "value": string}) {
|
fieldOperatorChanged(index: number, operatorId: string, operatorName: string) {
|
||||||
this.selectedFields[index] = field;
|
this.selectedFields[index].operatorId = operatorId;
|
||||||
|
this.selectedFields[index].operatorName = operatorName;
|
||||||
}
|
}
|
||||||
|
|
||||||
quantifierChanged(index: number, quantifier: {"name": string, "value": string}) {
|
fieldIdsChanged(index: number,id) {
|
||||||
this.selectedQuantifiers[index] = quantifier;
|
this.selectedFields[index].id = id;
|
||||||
|
this.selectedFields[index].name = this.searchFields.ADVANCED_FIELDS_NAMES_IDS[id].name;
|
||||||
|
this.selectedFields[index].type = this.searchFields.ADVANCED_FIELDS_NAMES_IDS[id].type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core';
|
import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {Location} from '@angular/common';
|
import {Location} from '@angular/common';
|
||||||
import { Filter, Value} from './searchHelperClasses.class';
|
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
|
||||||
import {SearchResult} from '../../utils/entities/searchResult';
|
import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'advanced-search-page',
|
selector: 'advanced-search-page',
|
||||||
|
@ -13,31 +14,33 @@ import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
<h1>{{pageTitle}}</h1>
|
<h1>{{pageTitle}}</h1>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="row row-offcanvas row-offcanvas-right">
|
<!--div class="row row-offcanvas row-offcanvas-right">
|
||||||
<div class="col-xs-12 col-sm-3">
|
<div class="col-xs-12 col-sm-3">
|
||||||
<a *ngIf="isFiltered()" (click)="clearFilters()" > Clear Filters</a>
|
<a *ngIf="isFiltered()" (click)="clearFilters()" > Clear Filters</a>
|
||||||
<p *ngFor="let filter of filters " >
|
<p *ngFor="let filter of filters " >
|
||||||
<search-filter [filter]="filter" (change)="filterChanged($event)"></search-filter>
|
<search-filter [filter]="filter" (change)="filterChanged($event)"></search-filter>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
[(fields)]="fields"
|
||||||
<div class="col-xs-6 col-sm-9 sidebar-offcanvas" id="sidebar">
|
[(selectedFields)]="selectedFields"
|
||||||
<advanced-search-form [(fields)]="fields"
|
[(quantifiers)]="quantifiers"
|
||||||
[(selectedFields)]="selectedFields"
|
[(selectedQuantifiers)]="selectedQuantifiers"
|
||||||
[(quantifiers)]="quantifiers"
|
[(keywords)]="keywords"
|
||||||
[(selectedQuantifiers)]="selectedQuantifiers"
|
<div class="col-xs-6 col-sm-9 sidebar-offcanvas" id="sidebar"-->
|
||||||
[(keywords)]="keywords"
|
<advanced-search-form
|
||||||
(keywordsChange)="keywordsChanged($event)">
|
[(fieldIds)]="fieldIds" [(selectedFields)]="selectedFields"
|
||||||
|
(queryChange)="queryChanged($event)">
|
||||||
</advanced-search-form>
|
</advanced-search-form>
|
||||||
|
|
||||||
<div class="text-right" *ngIf="results && results.length>= size">
|
<div class="text-right" *ngIf="results && results.length>= size">
|
||||||
<paging-no-load [(currentPage)]="page" [totalResults]="totalResults" [size]="size" (pageChange)="pageChanged($event)" > </paging-no-load>
|
<search-paging [(page)] = "page" [(size)] = "size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<search-result [results]="results" [page]="page"></search-result>
|
<search-result [results]="results" [page]="page"></search-result>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<!--/div>
|
||||||
</div>
|
</div-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -46,20 +49,29 @@ import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
export class AdvancedSearchPageComponent {
|
export class AdvancedSearchPageComponent {
|
||||||
@Input() pageTitle = "";
|
@Input() pageTitle = "";
|
||||||
@Input() results = [];
|
@Input() results = [];
|
||||||
@Input() filters = [];
|
// @Input() filters = [];
|
||||||
@Input() type;
|
@Input() type;
|
||||||
@Input() page:number = 1;
|
@Input() page:number = 1;
|
||||||
@Input() size: number = 10;
|
@Input() size: number = 10;
|
||||||
@Input() totalResults: number = 0;
|
@Input() totalResults: number = 0;
|
||||||
|
@Input() fieldIds: string[];
|
||||||
|
@Input() selectedFields:AdvancedField[];
|
||||||
|
@Input() baseUrl:string = '';
|
||||||
|
|
||||||
@Input() fields: {"name": string, "value": string}[];
|
private baseURLWithParameters:string = '';
|
||||||
@Input() selectedFields: {"name": string, "value": string}[];
|
|
||||||
@Input() quantifiers: {"name": string, "value": string}[];
|
|
||||||
@Input() selectedQuantifiers: {"name": string, "value": string}[];
|
|
||||||
@Input() keywords:string[];
|
|
||||||
@Output() keywordsChange = new EventEmitter();
|
|
||||||
|
|
||||||
test= { value: 0};
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
|
||||||
|
|
||||||
|
// @Input() fields: {"name": string, "value": string}[];
|
||||||
|
// @Input() selectedFields: {"name": string, "value": string}[];
|
||||||
|
// @Input() quantifiers: {"name": string, "value": string}[];
|
||||||
|
// @Input() selectedQuantifiers: {"name": string, "value": string}[];
|
||||||
|
// @Input() keywords:string[];
|
||||||
|
//
|
||||||
|
// @Output() keywordsChange = new EventEmitter();
|
||||||
|
//
|
||||||
|
// test= { value: 0};
|
||||||
|
|
||||||
@Output() queryChange = new EventEmitter();
|
@Output() queryChange = new EventEmitter();
|
||||||
constructor (private location: Location) {
|
constructor (private location: Location) {
|
||||||
|
@ -70,113 +82,35 @@ export class AdvancedSearchPageComponent {
|
||||||
this.totalResults = this.results.length;
|
this.totalResults = this.results.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
private createUrlParameters(){
|
private createUrlParameters(includePage:boolean){
|
||||||
var allLimits="";//location.search.slice(1);
|
var params="";
|
||||||
for (let filter of this.filters){
|
if(includePage && this.page != 1){
|
||||||
var filterLimits="";
|
params += "&page="+this.page;
|
||||||
if(filter.countSelectedValues > 0){
|
|
||||||
for (let value of filter.values){
|
|
||||||
if(value.selected == true){
|
|
||||||
filterLimits+=((filterLimits.length == 0)?'':',') + value.id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
allLimits+=((filterLimits.length == 0 )?'':((allLimits.length == 0)?'':'&') +filter.filterId + '='+ filterLimits) ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/*if(this.keywords.length > 0 ){
|
return "";
|
||||||
allLimits+=((allLimits.length == 0)?'':'&') + 'keyword=' + this.keyword;
|
|
||||||
}
|
|
||||||
if(this.page != 1 ){
|
|
||||||
allLimits+=((allLimits.length == 0)?'':'&') + 'page=' + this.page;
|
|
||||||
}*/
|
|
||||||
return allLimits;
|
|
||||||
}
|
}
|
||||||
private createQueryParameters(){
|
private createQueryParameters(){
|
||||||
var allLimits="";
|
var params="";
|
||||||
for (let filter of this.filters){
|
for(var i = 0; i< this.selectedFields.length; i++){
|
||||||
if(filter.countSelectedValues > 0){
|
if(this.searchFields.ADVANCED_FIELDS_NAMES_IDS[this.selectedFields[i].id] != undefined && this.selectedFields[i].value.length > 0){
|
||||||
var filterLimits="";
|
params +="&"+ this.selectedFields[i].id
|
||||||
for (let value of filter.values){
|
+ "="+ this.selectedFields[i].value+"&"+this.searchFields.ADVANCED_FIELDS_NAMES_IDS[this.selectedFields[i].id].operator
|
||||||
if(value.selected == true){
|
+ "=" + this.selectedFields[i].operatorId;
|
||||||
if(filter.filterOperator == 'not') {
|
|
||||||
filterLimits+=((filterLimits.length == 0)?'':' and ') + filter.filterId + '<>'+ value.id;
|
|
||||||
} else {
|
|
||||||
filterLimits+=((filterLimits.length == 0)?'':' '+filter.filterOperator+' ') + filter.filterId + '='+ value.id;
|
|
||||||
}
|
|
||||||
//filterLimits+=((filterLimits.length == 0)?'':' and ') + filter.filterId + '='+ value.id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
allLimits+=((filterLimits.length == 0 )?'':((allLimits.length == 0)?'':' and ')+'('+filterLimits +')') ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.info("Parameter:" + params);
|
||||||
|
return params;
|
||||||
|
|
||||||
for(let i=0; i<this.keywords.length; i++){
|
|
||||||
var keywords = this.keywords[i];
|
|
||||||
if(keywords == '') {
|
|
||||||
if(this.keywords.length > 1) {
|
|
||||||
this.selectedFields.splice(i, 1);
|
|
||||||
this.selectedQuantifiers.splice(i, 1);
|
|
||||||
this.keywords.splice(i, 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let keyword = keywords.split(" ");
|
|
||||||
let keywordLimits="";
|
|
||||||
let numOfKeywordLimits = 0;
|
|
||||||
for(let j=0; j<keyword.length; j++) {
|
|
||||||
numOfKeywordLimits++;
|
|
||||||
if(this.selectedQuantifiers[i].value == "not") {
|
|
||||||
keywordLimits+=((keywordLimits.length == 0)?'':' and')+' ('+this.selectedFields[i].value+' <> "'+keyword[j]+'")';
|
|
||||||
} else {
|
|
||||||
keywordLimits+=((keywordLimits.length == 0)?'':' '+this.selectedQuantifiers[i].value)+' ('+this.selectedFields[i].value+' = "'+keyword[j]+'")';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//... and ((resulttitle = "open") or (resulttitle = "access"))
|
|
||||||
if(numOfKeywordLimits > 1) {
|
|
||||||
allLimits+=((allLimits.length == 0)?'':' and (') + keywordLimits + ' )';
|
|
||||||
} else {
|
|
||||||
allLimits+=((allLimits.length == 0)?'':' and ') + keywordLimits;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.info("QueryParams: "+allLimits);
|
|
||||||
return allLimits;
|
|
||||||
}
|
|
||||||
private isFiltered(){
|
|
||||||
var filtered=false;
|
|
||||||
for (let filter of this.filters){
|
|
||||||
if(filter.countSelectedValues > 0){
|
|
||||||
filtered = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}/*
|
|
||||||
if(this.keywords.length > 0 ){
|
|
||||||
filtered = true;
|
|
||||||
}*/
|
|
||||||
return filtered;
|
|
||||||
}
|
}
|
||||||
clearFilters(){
|
clearFilters(){
|
||||||
for (let filter of this.filters){
|
|
||||||
if(filter.countSelectedValues > 0){
|
|
||||||
for (let value of filter.values){
|
|
||||||
if(value.selected == true){
|
|
||||||
value.selected = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
filter.countSelectedValues = 0;
|
|
||||||
}
|
|
||||||
}/*
|
|
||||||
if(this.keywords.length > 0 ){
|
|
||||||
this.keywords =[''];
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
goTo(page:number = 1){
|
goTo(page:number = 1){
|
||||||
console.info("goto");
|
console.info("goto");
|
||||||
//console.info("keyword: "+this.keyword);
|
//console.info("keyword: "+this.keyword);
|
||||||
this.page = page;
|
this.page = page;
|
||||||
var urlParameters = this.createUrlParameters();
|
var urlParameters = this.createUrlParameters(true);
|
||||||
var queryParameters = this.createQueryParameters();
|
var queryParameters = this.createQueryParameters();
|
||||||
this.location.go(location.pathname,urlParameters);
|
this.location.go(location.pathname,urlParameters);
|
||||||
this.queryChange.emit({
|
this.queryChange.emit({
|
||||||
|
@ -184,22 +118,19 @@ export class AdvancedSearchPageComponent {
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
filterChanged($event){
|
|
||||||
console.info("filterChanged");
|
queryChanged($event) {
|
||||||
this.goTo(1);
|
|
||||||
}
|
|
||||||
keywordsChanged($event) {
|
|
||||||
console.info("keywordsChanged");
|
|
||||||
// this.keyword = $event.value;
|
|
||||||
// console.info("searchPage: keyword= "+this.keyword);
|
|
||||||
this.keywords = $event.keywords;
|
|
||||||
this.selectedFields = $event.selectedFields;
|
|
||||||
this.selectedQuantifiers = $event.selectedQuantifiers;
|
|
||||||
this.goTo(1);
|
this.goTo(1);
|
||||||
}
|
}
|
||||||
pageChanged($event) {
|
pageChanged($event) {
|
||||||
this.page = +$event.value;
|
this.page = +$event.value;
|
||||||
this.goTo(this.page);
|
this.goTo(this.page);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Update the url with proper parameters. This is used as base url in Paging Component
|
||||||
|
*/
|
||||||
|
public updateBaseUrlWithParameters(filters:Filter[]){
|
||||||
|
this.baseURLWithParameters = this.baseUrl + this.createUrlParameters(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,3 +13,33 @@ export class Value{
|
||||||
public number: number = 0;
|
public number: number = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
export class AdvancedField{
|
||||||
|
public id: string; //
|
||||||
|
public name: string; //
|
||||||
|
public type: string = "keyword"; //keyword, static or dynamic
|
||||||
|
public value: string = '';
|
||||||
|
public operatorId: string;
|
||||||
|
public operatorName: string;;
|
||||||
|
|
||||||
|
constructor(id:string,name:string, type:string, value:string){
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.type = type;
|
||||||
|
this.value = value;
|
||||||
|
this.operatorId = OPERATOR.AND;
|
||||||
|
this.operatorName = "AND";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class OPERATOR{
|
||||||
|
public static AND: string ="and";
|
||||||
|
public static OR: string ="or";
|
||||||
|
public static NOT: string ="not";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export class AutoCompleteValue{
|
||||||
|
public id: string;
|
||||||
|
public label: string;
|
||||||
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ export class SearchPageComponent {
|
||||||
@Input() showResultCount:boolean = true;
|
@Input() showResultCount:boolean = true;
|
||||||
@Input() showRefine:boolean = true;
|
@Input() showRefine:boolean = true;
|
||||||
@Input() refineFields = [];
|
@Input() refineFields = [];
|
||||||
|
|
||||||
private searchFieldsHelper:SearchFields = new SearchFields();
|
private searchFieldsHelper:SearchFields = new SearchFields();
|
||||||
private queryParameters: Map<string, string> = new Map<string,string>();
|
private queryParameters: Map<string, string> = new Map<string,string>();
|
||||||
private baseURLWithParameters:string = '';
|
private baseURLWithParameters:string = '';
|
||||||
|
@ -164,7 +165,7 @@ export class SearchPageComponent {
|
||||||
// if(this.keyword.length > 0 ){
|
// if(this.keyword.length > 0 ){
|
||||||
// allLimits= this.keyword + allLimits /*+ ' keyword=' */;
|
// allLimits= this.keyword + allLimits /*+ ' keyword=' */;
|
||||||
// }
|
// }
|
||||||
return (this.keyword.length > 0?'q='+this.keyword:'')+allLimits;
|
return (this.keyword.length > 0?'q='+this.keyword+"op=and":'')+allLimits;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
private isFiltered(){
|
private isFiltered(){
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
import {Injectable} from '@angular/core';
|
||||||
|
import {Http, Response} from '@angular/http';
|
||||||
|
import {Observable} from 'rxjs/Observable';
|
||||||
|
import {AutoCompleteValue} from '../searchPages/searchUtils/searchHelperClasses.class';
|
||||||
|
@Injectable()
|
||||||
|
export class ISVocabulariesService {
|
||||||
|
|
||||||
|
constructor(private http: Http) {}
|
||||||
|
|
||||||
|
getVocabularyByType(type:string){
|
||||||
|
if( type = "lang"){
|
||||||
|
return this.getLanguagesJsonFile();
|
||||||
|
}else if ( type == "type"){
|
||||||
|
return this.getPublicationTypesJsonFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getLanguages ():any {
|
||||||
|
console.info("Get Languages from IS");
|
||||||
|
let url = "https://beta.services.openaire.eu/provision/mvc/vocabularies/dnet:languages.json";
|
||||||
|
return this.http.get(url)
|
||||||
|
.map(res => <any> res.json())
|
||||||
|
.map(res => res['terms'])
|
||||||
|
.map(res => this.parse(res));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getLanguagesJsonFile ():any {
|
||||||
|
console.info("Get Languages from json");
|
||||||
|
var lang = JSON.parse(JSON.stringify(require('../utils/vocabularies/languages.json')));
|
||||||
|
return this.parse(lang["terms"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getPublicationTypes ():any {
|
||||||
|
console.info("Get Languages from IS");
|
||||||
|
let url = "https://beta.services.openaire.eu/provision/mvc/vocabularies/dnet:publication_resource.json";
|
||||||
|
return this.http.get(url)
|
||||||
|
.map(res => <any> res.json())
|
||||||
|
.map(res => res['terms'])
|
||||||
|
.map(res => this.parse(res));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getPublicationTypesJsonFile ():any {
|
||||||
|
console.info("Get Languages from json");
|
||||||
|
var lang = JSON.parse(JSON.stringify(require('../utils/vocabularies/publicationTypes.json')));
|
||||||
|
return this.parse(lang["terms"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
parse (data: any):AutoCompleteValue[] {
|
||||||
|
var array:AutoCompleteValue[] =[]
|
||||||
|
for(var i = 0; i < data.length; i++){
|
||||||
|
var value:AutoCompleteValue = new AutoCompleteValue();
|
||||||
|
value.id = data[i].code;
|
||||||
|
value.label = data[i].englishName;
|
||||||
|
array.push(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private handleError (error: Response) {
|
||||||
|
// in a real world app, we may send the error to some remote logging infrastructure
|
||||||
|
// instead of just logging it to the console
|
||||||
|
console.error(error);
|
||||||
|
return Observable.throw(error || 'Server error');
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,18 +11,21 @@ export class SearchProjectsService {
|
||||||
|
|
||||||
constructor(private http: Http) {}
|
constructor(private http: Http) {}
|
||||||
|
|
||||||
searchProjects (params: string, page: number, size: number, refineFields:string[] ):any {
|
searchProjects (params: string, refineParams:string, page: number, size: number, refineFields:string[] ):any {
|
||||||
|
|
||||||
console.info("In searchProjects");
|
console.info("In searchProjects");
|
||||||
|
|
||||||
let link = OpenaireProperties.getSearchAPIURL()+"projects";
|
let link = OpenaireProperties.getSearchAPIURL()+"projects";
|
||||||
|
|
||||||
let url = link+"?";
|
let url = link+"?";
|
||||||
if(params != '') {
|
if(params!= null && params != '' ) {
|
||||||
url += params+"&page="+page+"&size="+size;
|
url += params;
|
||||||
} else {
|
|
||||||
url += "page="+page+"&size="+size;
|
|
||||||
}
|
}
|
||||||
|
if(refineParams!= null && params != '' ) {
|
||||||
|
url += refineParams;
|
||||||
|
}
|
||||||
|
url += "&page="+page+"&size="+size;
|
||||||
|
|
||||||
|
|
||||||
return this.http.get(url)
|
return this.http.get(url)
|
||||||
.map(res => <any> res.json())
|
.map(res => <any> res.json())
|
||||||
|
|
|
@ -24,6 +24,8 @@ import {SearchPeopleService} from './searchPeople.service';
|
||||||
import {SearchProjectsService} from './searchProjects.service';
|
import {SearchProjectsService} from './searchProjects.service';
|
||||||
import {RefineResultsService} from './servicesUtils/refineResuts.service';
|
import {RefineResultsService} from './servicesUtils/refineResuts.service';
|
||||||
|
|
||||||
|
import {ISVocabulariesService} from './ISVocabularies.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -38,7 +40,7 @@ import {RefineResultsService} from './servicesUtils/refineResuts.service';
|
||||||
SearchCrossrefService, SearchDataciteService, SearchOrcidService,
|
SearchCrossrefService, SearchDataciteService, SearchOrcidService,
|
||||||
SearchPublicationsService, SearchDataprovidersService, DataProviderService,
|
SearchPublicationsService, SearchDataprovidersService, DataProviderService,
|
||||||
SearchProjectsService, SearchDatasetsService, SearchOrganizationsService,
|
SearchProjectsService, SearchDatasetsService, SearchOrganizationsService,
|
||||||
SearchPeopleService,RefineResultsService
|
SearchPeopleService,RefineResultsService, ISVocabulariesService
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
]
|
]
|
||||||
|
|
|
@ -8,24 +8,27 @@ export class RefineResultsUtils {
|
||||||
|
|
||||||
public static parse (data, fields:string[]):Filter[] {
|
public static parse (data, fields:string[]):Filter[] {
|
||||||
// var data = this.json.refineReuslts;
|
// var data = this.json.refineReuslts;
|
||||||
|
|
||||||
var searchFields:SearchFields = new SearchFields();
|
var searchFields:SearchFields = new SearchFields();
|
||||||
var filters:Filter[] = [];
|
var filters:Filter[] = [];
|
||||||
for(let j=0; j<fields.length; j++) {
|
if(data){
|
||||||
|
for(let j=0; j<fields.length; j++) {
|
||||||
|
|
||||||
var filter:Filter = new Filter();
|
var filter:Filter = new Filter();
|
||||||
filter.title = searchFields.FIELDS_NAMES[fields[j]];
|
filter.title = searchFields.FIELDS_NAMES[fields[j]];
|
||||||
filter.filterId = fields[j];
|
filter.filterId = fields[j];
|
||||||
filter.originalFilterId = fields[j];
|
filter.originalFilterId = fields[j];
|
||||||
let field = data[fields[j]];
|
let field = data[fields[j]];
|
||||||
for(let i=0; i<field.length; i++) {
|
for(let i=0; i<field.length; i++) {
|
||||||
var value:Value = new Value();
|
var value:Value = new Value();
|
||||||
value.name = field[i].name;
|
value.name = field[i].name;
|
||||||
value.number = field[i].count;
|
value.number = field[i].count;
|
||||||
value.id = field[i].id;
|
value.id = field[i].id;
|
||||||
filter.values.push(value);
|
filter.values.push(value);
|
||||||
|
|
||||||
}
|
}
|
||||||
filters.push(filter);
|
filters.push(filter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,16 @@ import {Component, ElementRef} from '@angular/core';
|
||||||
import { Subject } from 'rxjs/Subject';
|
import { Subject } from 'rxjs/Subject';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {OpenaireProjectsService} from '../services/openaireProjects.service';
|
import {OpenaireProjectsService} from '../services/openaireProjects.service';
|
||||||
|
import {ISVocabulariesService} from '../services/ISVocabularies.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'test',
|
selector: 'test',
|
||||||
template: `
|
template: `
|
||||||
<!--i-frame url="https://google.com" width="30%" height="250"></i-frame-->
|
<!--i-frame url="https://google.com" width="30%" height="250"></i-frame-->
|
||||||
|
<div style ="width:30%; height:250px;" >
|
||||||
|
<static-autocomplete2 [(list)]=lan [(filtered)] =filtered [(selected)] =selected [showSelected]=true placeHolderMessage = "Search for languages" title = "Languages:" [multipleSelections]=false ></static-autocomplete2>
|
||||||
|
<div>
|
||||||
<div style ="width:30%; height:250px;" >
|
<div style ="width:30%; height:250px;" >
|
||||||
<static-autocomplete [(filtered)] =filtered [(selected)] =selected [showSelected]=true placeHolderMessage = "Search for countries" title = "Countries:" (keywordChange)="keywordChanged($event)" ></static-autocomplete>
|
<static-autocomplete [(filtered)] =filtered [(selected)] =selected [showSelected]=true placeHolderMessage = "Search for countries" title = "Countries:" (keywordChange)="keywordChanged($event)" ></static-autocomplete>
|
||||||
<div>
|
<div>
|
||||||
|
@ -30,7 +34,16 @@ export class TestComponent {
|
||||||
filteredObs: Observable<{}> = this.searchTermStream
|
filteredObs: Observable<{}> = this.searchTermStream
|
||||||
.debounceTime(300).distinctUntilChanged()
|
.debounceTime(300).distinctUntilChanged()
|
||||||
.switchMap((term: string) => this.service(term));
|
.switchMap((term: string) => this.service(term));
|
||||||
|
private lan;
|
||||||
|
private types;
|
||||||
|
constructor(private _projectService: OpenaireProjectsService, private _vocabulariesService: ISVocabulariesService) {
|
||||||
|
// this.elementRef = myElement;
|
||||||
|
}
|
||||||
|
ngOnInit() {
|
||||||
|
// this.lan = this._vocabulariesService.getLanguages();
|
||||||
|
this.lan = this._vocabulariesService.getLanguagesJsonFile();
|
||||||
|
this.types = this._vocabulariesService.getPublicationTypesJsonFile();
|
||||||
|
}
|
||||||
service(term) {
|
service(term) {
|
||||||
var projects = this._projectService.searchForProjectsObs(term, "this.selectedFunderId");
|
var projects = this._projectService.searchForProjectsObs(term, "this.selectedFunderId");
|
||||||
console.info("Results: "+ projects);
|
console.info("Results: "+ projects);
|
||||||
|
@ -39,16 +52,13 @@ export class TestComponent {
|
||||||
}
|
}
|
||||||
return projects;
|
return projects;
|
||||||
}
|
}
|
||||||
constructor(private _projectService: OpenaireProjectsService) {
|
|
||||||
// this.elementRef = myElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
private filtered = [];
|
private filtered = [];
|
||||||
private selected = [];
|
private selected = [];
|
||||||
keywordChanged($event) {
|
keywordChanged($event) {
|
||||||
console.log("keyword Changed");
|
console.log("keyword Changed"+this.lan.length+" "+this.lan[0].id+"-"+this.lan[0].label);
|
||||||
var keyword = $event.value;
|
var keyword = $event.value;
|
||||||
this.filtered = this.countries.filter(function(el){
|
this.filtered = this.types.filter(function(el){
|
||||||
return el.label.toLowerCase().indexOf(keyword.toLowerCase()) > -1;
|
return el.label.toLowerCase().indexOf(keyword.toLowerCase()) > -1;
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,24 @@
|
||||||
.auto-complete-box{
|
.auto-complete-box{
|
||||||
}
|
}
|
||||||
|
.custom-autocomplete{
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
.custom-autocomplete .suggestions,.custom-autocomplete .messages{
|
||||||
|
position:absolute;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
.auto-complete-choice .remove {
|
.auto-complete-choice .remove {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.auto-complete-choice{
|
.auto-complete-choice{
|
||||||
background: grey none repeat scroll 0 0;
|
background: white none repeat scroll 0 0;
|
||||||
border-color: grey;
|
border-color: gray;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
color: white;
|
border-width: thin;
|
||||||
|
color: grey;
|
||||||
margin: 3px;
|
margin: 3px;
|
||||||
padding: 1px;
|
padding: 7px;
|
||||||
}
|
}
|
||||||
.auto-complete-input {
|
.auto-complete-input {
|
||||||
border-radius:0;
|
border-radius:0;
|
||||||
|
|
|
@ -8,12 +8,15 @@ export class OpenaireProperties {
|
||||||
private static searchLinkToDataset = "search/dataset?datasetId=";
|
private static searchLinkToDataset = "search/dataset?datasetId=";
|
||||||
private static searchLinkToOrganization = "search/organization?organizationId=";
|
private static searchLinkToOrganization = "search/organization?organizationId=";
|
||||||
//Search pages
|
//Search pages
|
||||||
private static searchLinkToPublications = "search/find/publications?keyword=";
|
private static searchLinkToPublications = "search/find/publications";
|
||||||
private static searchLinkToDataProviders = "search/find/dataproviders?keyword=";
|
private static searchLinkToDataProviders = "search/find/dataproviders";
|
||||||
private static searchLinkToProjects = "search/find/projects?keyword=";
|
private static searchLinkToProjects = "search/find/projects";
|
||||||
private static searchLinkToDatasets = "search/find/datasets?keyword=";
|
private static searchLinkToDatasets = "search/find/datasets";
|
||||||
private static searchLinkToOrganizations = "search/find/organizations?keyword=";
|
private static searchLinkToOrganizations = "search/find/organizations";
|
||||||
private static searchLinkToPeople = "search/find/people?keyword=";
|
private static searchLinkToPeople = "search/find/people";
|
||||||
|
//Advanced Search pages
|
||||||
|
private static searchLinkToAdvancedPublications = "search/advanced/publications";
|
||||||
|
|
||||||
|
|
||||||
// Services - APIs
|
// Services - APIs
|
||||||
|
|
||||||
|
@ -95,6 +98,10 @@ export class OpenaireProperties {
|
||||||
public static getLinkToSearchPeople():string{
|
public static getLinkToSearchPeople():string{
|
||||||
return this.baseSearchLink + this.searchLinkToPeople;
|
return this.baseSearchLink + this.searchLinkToPeople;
|
||||||
}
|
}
|
||||||
|
//Advanced Search Pages
|
||||||
|
public static getLinkToSearchAdvancedPublications(){
|
||||||
|
return this.baseSearchLink + this.searchLinkToAdvancedPublications;
|
||||||
|
}
|
||||||
|
|
||||||
// Services - APIs' getters
|
// Services - APIs' getters
|
||||||
public static getSearchAPIURL():string{
|
public static getSearchAPIURL():string{
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
export class SearchFields {
|
export class SearchFields {
|
||||||
//main Entities
|
//main Entities
|
||||||
public PUBLICATION_FIELDS:string[] = ["instancetypenameid", "resultlanguageid", "communityid", "relfunderid",
|
public PUBLICATION_FIELDS:string[] = ["instancetypenameid", "resultlanguageid", "communityid", "relfunderid",
|
||||||
"relfundinglevel0_id","relfundinglevel1_id,relfundinglevel2_id",
|
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
|
||||||
"resultacceptanceyear","resultbestlicense","resulthostingdatasourceid","collectedfromdatasourceid"];
|
"resultacceptanceyear","resultbestlicense","resulthostingdatasourceid","collectedfromdatasourceid"];
|
||||||
public DATASET_FIELDS:string[] = ["instancetypenameid", "resultlanguageid", "relfunderid",
|
public DATASET_FIELDS:string[] = ["instancetypenameid", "resultlanguageid", "relfunderid",
|
||||||
"relfundinglevel0_id","relfundinglevel1_id,relfundinglevel2_id",
|
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
|
||||||
"resultacceptanceyear","resultbestlicense","resulthostingdatasourceid","collectedfromdatasourceid"];
|
"resultacceptanceyear","resultbestlicense","resulthostingdatasourceid","collectedfromdatasourceid"];
|
||||||
public DATAPROVIDER_FIELDS:string[] = ["datasourcetypeuiid", "datasourceodlanguages", "datasourceodcontenttypes", "datasourcecompatibilityid"];
|
public DATAPROVIDER_FIELDS:string[] = ["datasourcetypeuiid", "datasourceodlanguages", "datasourceodcontenttypes", "datasourcecompatibilityid"];
|
||||||
public ORGANIZATION_FIELDS:string[] = ["organizationcountryid","organizationeclegalbody"];
|
public ORGANIZATION_FIELDS:string[] = ["organizationcountryid","organizationeclegalbody"];
|
||||||
|
@ -32,9 +32,29 @@ export class SearchFields {
|
||||||
["collectedfromdatasourceid"]:"Collected from", ["datasourcetypeuiid"]:"Compatibility Type", ["datasourceodlanguages"]:"Language",
|
["collectedfromdatasourceid"]:"Collected from", ["datasourcetypeuiid"]:"Compatibility Type", ["datasourceodlanguages"]:"Language",
|
||||||
["datasourceodcontenttypes"]: "Type", ["datasourcecompatibilityid"]:"Compatibility Type", ["organizationcountryid"]:"Country",
|
["datasourceodcontenttypes"]: "Type", ["datasourcecompatibilityid"]:"Compatibility Type", ["organizationcountryid"]:"Country",
|
||||||
["organizationeclegalbody"]:"Type",["projectstartyear"]:"Start Year",["projectendyear"]:"End Year",["projectecsc39"]:"Special Clause 39"};
|
["organizationeclegalbody"]:"Type",["projectstartyear"]:"Start Year",["projectendyear"]:"End Year",["projectecsc39"]:"Special Clause 39"};
|
||||||
|
|
||||||
|
public ADVANCED_FIELDS:string[] = ["instancetypenameid", "resultlanguageid", "communityid", "relfunderid",
|
||||||
|
"relfundinglevel0_id","relfundinglevel1_id,relfundinglevel2_id",
|
||||||
|
"resultacceptanceyear","resultbestlicense","resulthostingdatasourceid","collectedfromdatasourceid"];
|
||||||
|
public ADVANCED_SEARCH_PUBLICATIONS_FIELDS:string[] = ["all","title","author","publisher","type", "lan", "funder", "funderlv0",
|
||||||
|
"funderlv1","funderlv2"];
|
||||||
|
public ADVANCED_FIELDS_NAMES_IDS: { [key:string]:{ name:string, operator:string, type:string }} =
|
||||||
|
{["funder"]:{name:"Funder",operator:"fn", type:"keyword"},
|
||||||
|
["funderlv0"]:{name:"Funding Level 0",operator:"fn0", type:"keyword"},
|
||||||
|
["funderlv1"]:{name:"Funding Level 1",operator:"fn1", type:"keyword"}, ["funderlv2"]:{name:"Funding Level 2",operator:"fn2", type:"keyword"},
|
||||||
|
["type"]:{name:"Type",operator:"tp", type:"staticAutoComplete"},["lang"]: {name:"Language",operator:"ln", type:"staticAutoComplete"}};
|
||||||
|
// ,["communityid"]: "Context",["resultacceptanceyear"]:"Year",
|
||||||
|
// ["resultbestlicense"]:"Access Mode",["resulthostingdatasourceid"]:"Hosting Data provider",
|
||||||
|
// ["collectedfromdatasourceid"]:"Collected from", ["datasourcetypeuiid"]:"Compatibility Type", ["datasourceodlanguages"]:"Language",
|
||||||
|
// ["datasourceodcontenttypes"]: "Type", ["datasourcecompatibilityid"]:"Compatibility Type", ["organizationcountryid"]:"Country",
|
||||||
|
// ["organizationeclegalbody"]:"Type",["projectstartyear"]:"Start Year",["projectendyear"]:"End Year",["projectecsc39"]:"Special Clause 39"};
|
||||||
|
|
||||||
|
|
||||||
public getPROJECT_FIELDS(){
|
public getPROJECT_FIELDS(){
|
||||||
return this.PROJECT_FIELDS;
|
return this.PROJECT_FIELDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
constructor (){
|
constructor (){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,12 @@ export class StaticAutocompleteComponent {
|
||||||
@Input() title = "Autocomplete";
|
@Input() title = "Autocomplete";
|
||||||
@Output() keywordChange = new EventEmitter(); // when changed a method for filtering will be called
|
@Output() keywordChange = new EventEmitter(); // when changed a method for filtering will be called
|
||||||
@Output() addNew = new EventEmitter(); // when changed a method for filtering will be called
|
@Output() addNew = new EventEmitter(); // when changed a method for filtering will be called
|
||||||
|
@Input() public list = []; // the entries resulted after filtering function
|
||||||
@Input() public filtered = []; // the entries resulted after filtering function
|
@Input() public filtered = []; // the entries resulted after filtering function
|
||||||
@Input() public selected = []; // the entries selected from user
|
@Input() public selected = []; // the entries selected from user
|
||||||
@Input() public keywordlimit = 3; // the minimum length of keyword
|
@Input() public keywordlimit = 3; // the minimum length of keyword
|
||||||
@Input() public showSelected = true; // the minimum length of keyword
|
@Input() public showSelected = true; // the minimum length of keyword
|
||||||
|
@Input() public multipleSelections:boolean = true;
|
||||||
@Input() public keyword = '';
|
@Input() public keyword = '';
|
||||||
@Input() public type = 'search' //search, result, context, project
|
@Input() public type = 'search' //search, result, context, project
|
||||||
private warningMessage = "";
|
private warningMessage = "";
|
||||||
|
|
|
@ -0,0 +1,172 @@
|
||||||
|
import {Component, ElementRef, Input, Output, EventEmitter} from '@angular/core';
|
||||||
|
import {Value} from '../searchPages/searchUtils/searchHelperClasses.class';
|
||||||
|
import {ISVocabulariesService} from '../services/ISVocabularies.service';
|
||||||
|
|
||||||
|
//Usage example
|
||||||
|
//<static-autocomplete [(filtered)] =filtered [(selected)] =selected placeHolderMessage = "Search for countries" title = "Countries:" (keywordChange)="keywordChanged($event)"></static-autocomplete>
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'static-autocomplete2',
|
||||||
|
styleUrls: ['autoComplete.component.css'],
|
||||||
|
template: `
|
||||||
|
<div class="custom-autocomplete">
|
||||||
|
<span *ngIf = "showSelected">
|
||||||
|
<span class="row-fluid show-grid auto-complete-choice" *ngFor="let item of selected" >
|
||||||
|
<span >{{showItem(item)}} </span>
|
||||||
|
<span (click)="remove(item)" aria-hidden="true" title="Remove selection" class=" remove glyphicon glyphicon-remove"></span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<input *ngIf = "showInput" type="text" class="auto-complete-input validate filter-input input-sm form-control " [placeholder]=placeHolderMessage [(ngModel)]=keyword (keyup)=filter() >
|
||||||
|
<div class="suggestions" *ngIf="filtered.length > 0">
|
||||||
|
<ul class="list-group" >
|
||||||
|
<li class="list-group-item" *ngFor=" let item of filtered">
|
||||||
|
<a (click)="select(item)">{{showItem(item)}}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="messages">
|
||||||
|
<div *ngIf="warningMessage.length > 0" class="alert alert-warning row-fluid " role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>{{warningMessage}}</div>
|
||||||
|
<div *ngIf="filtered.length == 0 && keyword.length >=3 " class="alert alert-info row-fluid " role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>No results found</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
`
|
||||||
|
})
|
||||||
|
export class StaticAutocomplete2Component {
|
||||||
|
@Input() placeHolderMessage = "Search for entries";
|
||||||
|
@Input() title = "Autocomplete";
|
||||||
|
// @Output() keywordChange = new EventEmitter(); // when changed a method for filtering will be called
|
||||||
|
// @Output() addNew = new EventEmitter(); // when changed a method for filtering will be called
|
||||||
|
@Input() public list = []; // the entries resulted after filtering function
|
||||||
|
@Input() public filtered = []; // the entries resulted after filtering function
|
||||||
|
@Input() public selected = []; // the entries selected from user
|
||||||
|
@Input() public keywordlimit = 3; // the minimum length of keyword
|
||||||
|
@Input() public showSelected = true; // the minimum length of keyword
|
||||||
|
@Input() public multipleSelections:boolean = true;
|
||||||
|
@Input() public selectedId:string = '';
|
||||||
|
@Input() public vocabularyId:string = '';
|
||||||
|
|
||||||
|
@Input() public keyword = '';
|
||||||
|
@Input() public type = 'search' //search, result, context, project
|
||||||
|
private warningMessage = "";
|
||||||
|
private infoMessage = "";
|
||||||
|
|
||||||
|
private tries = 0;
|
||||||
|
private showInput = true;
|
||||||
|
|
||||||
|
constructor ( private _vocabulariesService: ISVocabulariesService) {
|
||||||
|
console.info("Type"+this.type);
|
||||||
|
}
|
||||||
|
ngOnInit () {
|
||||||
|
if(this.vocabularyId){
|
||||||
|
this.list = this._vocabulariesService.getVocabularyByType(this.vocabularyId);
|
||||||
|
}
|
||||||
|
if(this.list.length == 0){
|
||||||
|
this.warningMessage = "There are no results"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filter() {
|
||||||
|
this.infoMessage = "";
|
||||||
|
this.filtered = [];
|
||||||
|
if(this.keyword == ""){
|
||||||
|
this.tries = 0;
|
||||||
|
this.warningMessage = "";
|
||||||
|
} else if(this.keyword && this.keyword.length < this.keywordlimit){
|
||||||
|
this.tries++;
|
||||||
|
if(this.tries == this.keywordlimit -1 ){
|
||||||
|
this.warningMessage = "Type at least " + this.keywordlimit + " characters";
|
||||||
|
this.tries = 0;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.tries = 0;
|
||||||
|
this.warningMessage = "";
|
||||||
|
console.log("keyword Changed"+this.list.length+" "+this.list[0].id+"-"+this.list[0].label);
|
||||||
|
this.filtered = this.list.filter(function(el){
|
||||||
|
return el.label.toLowerCase().indexOf(this.keyword.toLowerCase()) > -1;
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
remove(item:any){
|
||||||
|
var index:number =this.checkIfExists(item,this.selected);
|
||||||
|
if (index > -1) {
|
||||||
|
this.selected.splice(index, 1);
|
||||||
|
}
|
||||||
|
if(!this.multipleSelections && this.selected.length == 0 ){
|
||||||
|
this.showInput = true;
|
||||||
|
this.selectedId = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
select(item:any){
|
||||||
|
if(this.multipleSelections){
|
||||||
|
var index:number =this.checkIfExists(item,this.selected);
|
||||||
|
if (index > -1) {
|
||||||
|
this.keyword = "";
|
||||||
|
this.filtered.splice(0, this.filtered.length);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.selected.push(item);
|
||||||
|
this.keyword = "";
|
||||||
|
this.filtered.splice(0, this.filtered.length);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.selected.splice(0, this.selected.length);
|
||||||
|
this.selected.push(item);
|
||||||
|
this.filtered.splice(0, this.filtered.length);
|
||||||
|
this.keyword = "";
|
||||||
|
this.showInput = false;
|
||||||
|
this.selectedId = item.id;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private checkIfExists(item:any,list):number{
|
||||||
|
|
||||||
|
if(item.concept && item.concept.id ){
|
||||||
|
console.log("context");
|
||||||
|
|
||||||
|
for (var _i = 0; _i < list.length; _i++) {
|
||||||
|
let itemInList = list[_i];
|
||||||
|
if(item.concept.id == itemInList.concept.id){
|
||||||
|
return _i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if(item.id){
|
||||||
|
for (var _i = 0; _i < list.length; _i++) {
|
||||||
|
let itemInList = list[_i];
|
||||||
|
if(item.id == itemInList.id){
|
||||||
|
return _i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
}
|
||||||
|
showItem(item:any):string{
|
||||||
|
|
||||||
|
if (item.name){ //search
|
||||||
|
return item.name;
|
||||||
|
}else if( item.concept && item.concept.label){ //context
|
||||||
|
return item.concept.label;
|
||||||
|
}else if (item.label){ //simple
|
||||||
|
return item.label;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// handleClick(event){
|
||||||
|
// var clickedComponent = event.target;
|
||||||
|
// var inside = false;
|
||||||
|
// do {
|
||||||
|
// if (clickedComponent === this.elementRef.nativeElement) {
|
||||||
|
// inside = true;
|
||||||
|
// }
|
||||||
|
// clickedComponent = clickedComponent.parentNode;
|
||||||
|
// } while (clickedComponent);
|
||||||
|
// if(!inside){
|
||||||
|
// this.filteredList = [];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ import {ProjectTitleFormatter} from './projectTitleFormatter.component';
|
||||||
import {PublicationTitleFormatter} from './publicationTitleFormatter.component';
|
import {PublicationTitleFormatter} from './publicationTitleFormatter.component';
|
||||||
import {PagingFormatter} from './pagingFormatter.component';
|
import {PagingFormatter} from './pagingFormatter.component';
|
||||||
import {StaticAutocompleteComponent} from './staticAutoComplete.component';
|
import {StaticAutocompleteComponent} from './staticAutoComplete.component';
|
||||||
|
import {StaticAutocomplete2Component} from './staticAutoComplete2.component';
|
||||||
import {DynamicAutocompleteComponent} from './dynamicAutoComplete.component';
|
import {DynamicAutocompleteComponent} from './dynamicAutoComplete.component';
|
||||||
import {ShowDataProvidersComponent} from './showDataProviders.component';
|
import {ShowDataProvidersComponent} from './showDataProviders.component';
|
||||||
import {ExportCSVComponent} from './exportCSV.component';
|
import {ExportCSVComponent} from './exportCSV.component';
|
||||||
|
@ -27,6 +28,7 @@ import {ModalLoading} from './modal/loading.component';
|
||||||
PublicationTitleFormatter,
|
PublicationTitleFormatter,
|
||||||
PagingFormatter,
|
PagingFormatter,
|
||||||
StaticAutocompleteComponent,
|
StaticAutocompleteComponent,
|
||||||
|
StaticAutocomplete2Component,
|
||||||
DynamicAutocompleteComponent,
|
DynamicAutocompleteComponent,
|
||||||
ShowDataProvidersComponent,
|
ShowDataProvidersComponent,
|
||||||
ExportCSVComponent,
|
ExportCSVComponent,
|
||||||
|
@ -40,6 +42,7 @@ import {ModalLoading} from './modal/loading.component';
|
||||||
PagingFormatter,
|
PagingFormatter,
|
||||||
AlertModal, ModalLoading,
|
AlertModal, ModalLoading,
|
||||||
StaticAutocompleteComponent,
|
StaticAutocompleteComponent,
|
||||||
|
StaticAutocomplete2Component,
|
||||||
DynamicAutocompleteComponent,
|
DynamicAutocompleteComponent,
|
||||||
ShowDataProvidersComponent,
|
ShowDataProvidersComponent,
|
||||||
ExportCSVComponent,
|
ExportCSVComponent,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,188 @@
|
||||||
|
{
|
||||||
|
"id":"66daaedb-c0de-48d3-a1ff-60bf5756c9be_Vm9jYWJ1bGFyeURTUmVzb3VyY2VzL1ZvY2FidWxhcnlEU1Jlc291cmNlVHlwZQ==",
|
||||||
|
"name":"dnet:publication_resource",
|
||||||
|
"description":"dnet:publication_resource",
|
||||||
|
"code":"dnet:publication_resource",
|
||||||
|
"terms":[
|
||||||
|
{
|
||||||
|
"englishName":"Annotation",
|
||||||
|
"nativeName":"Annotation",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0018"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Article",
|
||||||
|
"nativeName":"Article",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Bachelor thesis",
|
||||||
|
"nativeName":"Bachelor thesis",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0008"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Book",
|
||||||
|
"nativeName":"Book",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0002"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Collection",
|
||||||
|
"nativeName":"Collection",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0022"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Conference object",
|
||||||
|
"nativeName":"Conference object",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0004"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Contribution for newspaper or weekly magazine",
|
||||||
|
"nativeName":"Contribution for newspaper or weekly magazine",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0005"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Dataset",
|
||||||
|
"nativeName":"Dataset",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0021"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Doctoral thesis",
|
||||||
|
"nativeName":"Doctoral thesis",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0006"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Event",
|
||||||
|
"nativeName":"Event",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0023"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"External research report",
|
||||||
|
"nativeName":"External research report",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0009"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Film",
|
||||||
|
"nativeName":"Film",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0024"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Image",
|
||||||
|
"nativeName":"Image",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0025"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"InteractiveResource",
|
||||||
|
"nativeName":"InteractiveResource",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0026"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Internal report",
|
||||||
|
"nativeName":"Internal report",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0011"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Lecture",
|
||||||
|
"nativeName":"Lecture",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0010"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Master thesis",
|
||||||
|
"nativeName":"Master thesis",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0007"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Model",
|
||||||
|
"nativeName":"Model",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0027"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Newsletter",
|
||||||
|
"nativeName":"Newsletter",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0012"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Other",
|
||||||
|
"nativeName":"Other",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0020"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Part of book or chapter of book",
|
||||||
|
"nativeName":"Part of book or chapter of book",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0013"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Patent",
|
||||||
|
"nativeName":"Patent",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0019"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"PhysicalObject",
|
||||||
|
"nativeName":"PhysicalObject",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0028"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Preprint",
|
||||||
|
"nativeName":"Preprint",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0016"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Report",
|
||||||
|
"nativeName":"Report",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0017"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Research",
|
||||||
|
"nativeName":"Research",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0014"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Review",
|
||||||
|
"nativeName":"Review",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0015"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Software",
|
||||||
|
"nativeName":"Software",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0029"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Sound",
|
||||||
|
"nativeName":"Sound",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0030"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"englishName":"Unknown",
|
||||||
|
"nativeName":"Unknown",
|
||||||
|
"encoding":"OPENAIRE",
|
||||||
|
"code":"0000"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue