Change autocomplete for entities to work for dataproviders
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44890 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
b4b9767a31
commit
b933586b83
|
@ -56,7 +56,7 @@ export class EntitiesSearchService {
|
|||
return this.searchEntity(keyword,"people","oaf:person","person");
|
||||
}else if (type == "dataset"){
|
||||
return this.searchEntity(keyword,"datasets","oaf:result","dataset");
|
||||
}else if (type == "datasource"){
|
||||
}else if (type == "datasource" || type == "hostedBy" || type== "collectedFrom"){
|
||||
return this.searchEntity(keyword,"datasources","oaf:datasource","datasource");
|
||||
}else if (type == "publication"){
|
||||
return this.searchEntity(keyword,"publications","oaf:result","publication");
|
||||
|
@ -73,7 +73,7 @@ export class EntitiesSearchService {
|
|||
return this.fetchEntity(id,"people","oaf:person","person");
|
||||
}else if (type == "dataset"){
|
||||
return this.fetchEntity(id,"datasets","oaf:result","dataset");
|
||||
}else if (type == "datasource"){
|
||||
}else if (type == "datasource" || type == "hostedBy" || type== "collectedFrom"){
|
||||
return this.fetchEntity(id,"datasources","oaf:datasource","datasource");
|
||||
}else if (type == "publication"){
|
||||
return this.fetchEntity(id,"publications","oaf:result","publication");
|
||||
|
@ -147,8 +147,16 @@ private fetch (link,id,oafEntityType,type){
|
|||
value.label = resData["legalname"];
|
||||
}
|
||||
|
||||
}else if(resData["officialname"]){
|
||||
|
||||
if(Array.isArray(resData["officialname"])) {
|
||||
value.label = resData["officialname"][0];
|
||||
} else {
|
||||
value.label = resData["officialname"];
|
||||
}
|
||||
}
|
||||
value.id = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||
|
||||
value.id = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||
|
||||
if(type=="project"){
|
||||
value.projectAcronym = resData['acronym'];
|
||||
|
|
|
@ -54,8 +54,8 @@ export class TestComponent {
|
|||
public lan;
|
||||
public types;
|
||||
public projectId:string = "arc_________::000dc863f894b1664a9d5f868b7bde9f";
|
||||
// public url =('http://vaggelas.athenarc.gr/stats/merge.php?com=query&data=[{"table":"project_stats_monthly","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"id","agg":"sum"},"group":"month","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":0,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"untitled","yaxisheaders":["sum of views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"id","values":["'+this.projectId+'"],"to":"-1"}]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true');
|
||||
public url = 'https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"projScient","projTitle":"'+this.projectId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "spline", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Publications"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}';
|
||||
public url =('http://vaggelas.athenarc.gr/stats/merge.php?com=query&data=[{"table":"project_stats_monthly","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"id","agg":"sum"},"group":"month","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":0,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"untitled","yaxisheaders":["sum of views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"id","values":["'+this.projectId+'"],"to":"-1"}]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true');
|
||||
// public url = 'https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"projScient","projTitle":"'+this.projectId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "spline", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Publications"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}';
|
||||
public user:{password:string,email:string} = {password:"",email:""};
|
||||
constructor(private _projectService: OpenaireProjectsService,private _searchProjectsService:SearchProjectsService,private _searchPubService:SearchPublicationsService,private _searchDataService:SearchDatasetsService, private _vocabulariesService: ISVocabulariesService) {
|
||||
}
|
||||
|
|
|
@ -25,9 +25,9 @@ import {EntitiesSearchService} from '../services/entitySearch.service';
|
|||
<div *ngIf = "keyword != null && keyword.length > 0 " class="suggestions" >
|
||||
<div *ngIf="showLoading" class="alert alert-info row-fluid " role="alert">Loading... <span class="glyphicon glyphicon-repeat" aria-hidden="true"></span></div>
|
||||
<ul class="list-group" >
|
||||
<li *ngIf = "numFilteredResults > 0 " class="list-group-item" >
|
||||
<!--li *ngIf = "numFilteredResults > 0 " class="list-group-item" >
|
||||
Select:
|
||||
</li>
|
||||
</li-->
|
||||
<li class="list-group-item" *ngFor=" let item of filtered | async">
|
||||
<a (click)="select(item)">{{showItem(item)}}</a>
|
||||
</li>
|
||||
|
@ -35,7 +35,7 @@ import {EntitiesSearchService} from '../services/entitySearch.service';
|
|||
</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="numFilteredResults == 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 *ngIf="numFilteredResults == 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>
|
||||
|
||||
|
@ -66,7 +66,7 @@ export class EntitiesAutocompleteComponent {
|
|||
public showLoading:boolean = false;
|
||||
public searchTermStream = new Subject<string>();
|
||||
filtered: Observable<{}> ;
|
||||
public numFilteredResults:number = 0;
|
||||
// public numFilteredResults:number = 0;
|
||||
|
||||
@Input() public funderId:string;
|
||||
@Input() public entityType:string ;
|
||||
|
@ -87,7 +87,7 @@ export class EntitiesAutocompleteComponent {
|
|||
.switchMap((term: string) => {
|
||||
var results = this._search.searchProjectsByFunder(term, (this.funderId == "0"?"":this.funderId));
|
||||
this.showLoading = false;
|
||||
this.numFilteredResults = results.length;
|
||||
// this.numFilteredResults = results.length;
|
||||
return results;
|
||||
});
|
||||
}else if(this.entityType == "organization" && this.depositType ){
|
||||
|
@ -96,18 +96,19 @@ export class EntitiesAutocompleteComponent {
|
|||
.switchMap((term: string) => {
|
||||
var results = this._search.searchByDepositType(term, this.depositType);
|
||||
this.showLoading = false;
|
||||
this.numFilteredResults = results.length;
|
||||
// this.numFilteredResults = results.length;
|
||||
return results;
|
||||
});
|
||||
|
||||
}else{
|
||||
|
||||
this.filtered = this.searchTermStream
|
||||
.debounceTime(300).distinctUntilChanged()
|
||||
.debounceTime(300)
|
||||
.distinctUntilChanged()
|
||||
.switchMap((term: string) => {
|
||||
var results = this._search.searchByType(term, this.entityType);
|
||||
this.showLoading = false;
|
||||
this.numFilteredResults = results.length;
|
||||
// this.numFilteredResults = results.length;
|
||||
return results;
|
||||
});
|
||||
|
||||
|
@ -137,9 +138,9 @@ export class EntitiesAutocompleteComponent {
|
|||
this.tries = 0;
|
||||
this.warningMessage = "";
|
||||
this.searchTermStream.next(this.keyword);
|
||||
if(this.numFilteredResults ==0){
|
||||
// if(this.numFilteredResults ==0){
|
||||
this.showLoading = true;
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -245,7 +246,7 @@ export class EntitiesAutocompleteComponent {
|
|||
} while (clickedComponent);
|
||||
if(!inside){
|
||||
this.keyword = "";
|
||||
this.numFilteredResults = 0;
|
||||
// this.numFilteredResults = 0;
|
||||
this.searchTermStream.next(this.keyword);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ export class SearchFields {
|
|||
["resultbestlicense"]:{name:"Access Mode", type:"refine", param:"access", equalityOperator: " exact "},
|
||||
["resultbestlicenseid"]:{name:"Access Mode", type:"vocabulary", param:"access", equalityOperator: " exact "},
|
||||
["collectedfrom"]:{name:"Datasource", type:"refine", param:"datasource", equalityOperator: " exact "},
|
||||
["collectedfromdatasourceid"]:{name:"Collected from Datasource", type:"enity", param:"collectedFrom", equalityOperator: " exact "}
|
||||
["collectedfromdatasourceid"]:{name:"Collected from Datasource", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
|
||||
};
|
||||
|
||||
//PROJECT
|
||||
|
|
Loading…
Reference in New Issue