Deposit: Use Autocomplete in search Organization| add access mode icos| Add access mode in search results & in pubs/data Landing pages
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44862 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
04dae0c3f6
commit
f1af290005
|
@ -34,7 +34,15 @@ import {SearchOrganizationsService} from '../services/searchOrganizations.servic
|
||||||
<h3>Locate data provider via your institution</h3>
|
<h3>Locate data provider via your institution</h3>
|
||||||
|
|
||||||
<form>
|
<form>
|
||||||
|
<div class="form-group form-inline">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
|
<entities-autocomplete [entityType]="'organization'" [depositType]=compatibility [selectedValue]=selectedId [showSelected]=true
|
||||||
|
[placeHolderMessage] = "'Search for Organizations'" [title] = "Organizations" [multipleSelections]=false
|
||||||
|
(selectedValueChanged)="valueChanged($event)" ></entities-autocomplete>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-default" type="submit" (click)="organizationSelected(selectedId)" >Next</button>
|
||||||
|
</div>
|
||||||
|
<!--div class="input-group">
|
||||||
<span class="input-group-addon" id="sizing-addon2">Filter</span>
|
<span class="input-group-addon" id="sizing-addon2">Filter</span>
|
||||||
<span>
|
<span>
|
||||||
<input type="text" class="form-control" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
<input type="text" class="form-control" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
||||||
|
@ -42,7 +50,9 @@ import {SearchOrganizationsService} from '../services/searchOrganizations.servic
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button (click)="keywordChanged()" type="submit" class="btn btn-default">SELECT</button>
|
<button (click)="keywordChanged()" type="submit" class="btn btn-default">SELECT</button>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ul class="list-group" >
|
<ul class="list-group" >
|
||||||
<li class="list-group-item" *ngIf="status == errorCodes.LOADING">
|
<li class="list-group-item" *ngIf="status == errorCodes.LOADING">
|
||||||
|
@ -64,7 +74,7 @@ import {SearchOrganizationsService} from '../services/searchOrganizations.servic
|
||||||
<a style="cursor:pointer;" (click)="organizationSelected(item.id)">{{item.name}}</a>
|
<a style="cursor:pointer;" (click)="organizationSelected(item.id)">{{item.name}}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div-->
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -85,6 +95,7 @@ export class DepositComponent {
|
||||||
|
|
||||||
public status: number;
|
public status: number;
|
||||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
|
public selectedId = "";
|
||||||
|
|
||||||
constructor (private _router: Router,
|
constructor (private _router: Router,
|
||||||
private _searchOrganizationsService: SearchOrganizationsService) {
|
private _searchOrganizationsService: SearchOrganizationsService) {
|
||||||
|
@ -122,11 +133,19 @@ export class DepositComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
organizationSelected(id: string) {
|
organizationSelected(id: string) {
|
||||||
if(this.requestFor == "Publications") {
|
if(id && id.length > 0){
|
||||||
this._router.navigate( ['deposit-publications-result'], { queryParams: { "organizationId": id } } );
|
|
||||||
} else if(this.requestFor == "Datasets") {
|
|
||||||
console.info("call deposit result for datasets")
|
if(this.requestFor == "Publications") {
|
||||||
this._router.navigate( ['deposit-datasets-result'], { queryParams: { "organizationId": id } } );
|
this._router.navigate( ['deposit-publications-result'], { queryParams: { "organizationId": id } } );
|
||||||
|
} else if(this.requestFor == "Datasets") {
|
||||||
|
console.info("call deposit result for datasets")
|
||||||
|
this._router.navigate( ['deposit-datasets-result'], { queryParams: { "organizationId": id } } );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
valueChanged($event){
|
||||||
|
this.selectedId = $event.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {Component, Input} from '@angular/core';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'showTitle',
|
selector: 'showTitle',
|
||||||
template: `
|
template: `
|
||||||
<h2 *ngIf="title != undefined">
|
<h2 *ngIf="title != undefined" [class] = "title['accessMode']" [title] = "title['accessMode']" >
|
||||||
<div *ngIf="title['url'] != undefined">
|
<div *ngIf="title['url'] != undefined">
|
||||||
<a class="custom-external" href="{{title['url']}}" target="_blank">
|
<a class="custom-external" href="{{title['url']}}" target="_blank">
|
||||||
<div [innerHTML]="title['name']"></div>
|
<div [innerHTML]="title['name']"></div>
|
||||||
|
@ -15,7 +15,7 @@ import {Component, Input} from '@angular/core';
|
||||||
</div>
|
</div>
|
||||||
</h2>
|
</h2>
|
||||||
`
|
`
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export class ShowTitleComponent {
|
export class ShowTitleComponent {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
<div *ngIf="status == errorCodes.NOT_AVAILABLE" class="alert alert-danger" role="alert">Service not available</div>
|
<div *ngIf="status == errorCodes.NOT_AVAILABLE" class="alert alert-danger" role="alert">Service not available</div>
|
||||||
|
|
||||||
<li *ngFor="let result of results">
|
<li *ngFor="let result of results">
|
||||||
<h4>
|
<h4 [class] = result.title.accessMode [title] = result.title.accessMode >
|
||||||
<a href="{{result['title'].url}}">
|
<a href="{{result['title'].url}}">
|
||||||
<p *ngIf="result['title'].name != undefined && result['title'].name != ''"
|
<p *ngIf="result['title'].name != undefined && result['title'].name != ''"
|
||||||
[innerHTML]="result['title'].name">
|
[innerHTML]="result['title'].name">
|
||||||
|
|
|
@ -66,9 +66,11 @@ export class DatasetService {
|
||||||
}
|
}
|
||||||
this.datasetInfo.embargoEndDate = data[0].embargoenddate;
|
this.datasetInfo.embargoEndDate = data[0].embargoenddate;
|
||||||
}
|
}
|
||||||
|
this.datasetInfo.title = {"name": "", "url": "", "accessMode": ""};
|
||||||
|
if(data[0]['bestlicense'].hasOwnProperty("classid")) {
|
||||||
|
this.datasetInfo.title.accessMode = data[0]['bestlicense'].classid;
|
||||||
|
}
|
||||||
if(data[1] != null) {
|
if(data[1] != null) {
|
||||||
this.datasetInfo.title = {"name": "", "url": "", "accessMode": ""};
|
|
||||||
if(Array.isArray(data[1])) {
|
if(Array.isArray(data[1])) {
|
||||||
this.datasetInfo.title['name'] = data[1][0].content;
|
this.datasetInfo.title['name'] = data[1][0].content;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -22,6 +22,33 @@ export class EntitiesSearchService {
|
||||||
return this.parse(request,"oaf:project","project");
|
return this.parse(request,"oaf:project","project");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
searchByDepositType(keyword:string, DepositType:string):any {
|
||||||
|
console.info("In searchOrganizationsforDeposit");
|
||||||
|
|
||||||
|
let link = OpenaireProperties.getSearchResourcesAPIURL();
|
||||||
|
|
||||||
|
let url = link+"?query=";
|
||||||
|
if(keyword!= null && keyword != '' ) {
|
||||||
|
url += "((oaftype exact organization and deletedbyinference=false and "+
|
||||||
|
"(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=*))"+
|
||||||
|
" and ((organizationlegalname all "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " +
|
||||||
|
// "and " + this.quote(params) + " " +
|
||||||
|
"and (collectedfromdatasourcename exact "+DepositType+")) "
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
url += "&page=0&size=10";
|
||||||
|
url += "&format=json";
|
||||||
|
|
||||||
|
// let url = OpenaireProperties. getSearchAPIURLLast()+"projects?"+((keyword && keyword.length > 0)?("q=" +keyword):"")+((funderId && funderId.length > 0 )?"&fq=funderid exact " + '"'+funderId+ '"':"")+"&size=10&page=0&format=json";
|
||||||
|
return this.http.get(url).toPromise()
|
||||||
|
.then(request =>
|
||||||
|
{
|
||||||
|
request = request.json().results;
|
||||||
|
console.log(request);
|
||||||
|
return this.parse(request,"oaf:organization","organization");
|
||||||
|
});
|
||||||
|
}
|
||||||
searchByType(keyword:string,type:string){
|
searchByType(keyword:string,type:string){
|
||||||
if (type == "project"){
|
if (type == "project"){
|
||||||
return this.searchEntity(keyword,"projects","oaf:project","project");
|
return this.searchEntity(keyword,"projects","oaf:project","project");
|
||||||
|
@ -91,24 +118,7 @@ private fetch (link,id,oafEntityType,type){
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// private search (link,keyword,oafEntityType,type){
|
|
||||||
// let url = link+"?";
|
|
||||||
// if(keyword!= null && keyword != '' ) {
|
|
||||||
// url += "q="+ keyword;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// url += "&page=0&size="+10+"&format=json";
|
|
||||||
// return this.http.get(url)
|
|
||||||
// .map(res => <any> res.json().results)
|
|
||||||
// .map(res => <any> this.parse(res,oafEntityType,type));
|
|
||||||
// // .then(request =>
|
|
||||||
// // {
|
|
||||||
// // request = request.json().results;
|
|
||||||
// // return this.parse(request,oafEntityType,type);
|
|
||||||
// // });
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
private parse(data: any,oafEntityType:string, type:string){
|
private parse(data: any,oafEntityType:string, type:string){
|
||||||
var array:any =[]
|
var array:any =[]
|
||||||
let length = Array.isArray(data) ? data.length : 1;
|
let length = Array.isArray(data) ? data.length : 1;
|
||||||
|
@ -130,13 +140,16 @@ private fetch (link,id,oafEntityType,type){
|
||||||
value.label = resData["fullname"];
|
value.label = resData["fullname"];
|
||||||
}
|
}
|
||||||
}else if(resData["legalname"]){
|
}else if(resData["legalname"]){
|
||||||
|
|
||||||
if(Array.isArray(resData["legalname"])) {
|
if(Array.isArray(resData["legalname"])) {
|
||||||
value.label = resData["legalname"][0];
|
value.label = resData["legalname"][0];
|
||||||
} else {
|
} else {
|
||||||
value.label = resData["legalname"];
|
value.label = resData["legalname"];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
value.id = length > 1 ? 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"){
|
if(type=="project"){
|
||||||
value.projectAcronym = resData['acronym'];
|
value.projectAcronym = resData['acronym'];
|
||||||
value.projectName = value.label;
|
value.projectName = value.label;
|
||||||
|
@ -152,6 +165,7 @@ private fetch (link,id,oafEntityType,type){
|
||||||
}
|
}
|
||||||
array.push(value);
|
array.push(value);
|
||||||
}
|
}
|
||||||
|
console.info("Parsing results.... Size:"+array.length);
|
||||||
|
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,8 +64,11 @@ export class PublicationService {
|
||||||
this.publicationInfo.embargoEndDate = data[0].embargoenddate;
|
this.publicationInfo.embargoEndDate = data[0].embargoenddate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.publicationInfo.title = {"name": "", "url": "", "accessMode": ""};
|
||||||
|
if(data[0]['bestlicense'].hasOwnProperty("classid")) {
|
||||||
|
this.publicationInfo.title.accessMode = data[0]['bestlicense'].classid;
|
||||||
|
}
|
||||||
if(data[1] != null) {
|
if(data[1] != null) {
|
||||||
this.publicationInfo.title = {"name": "", "url": "", "accessMode": ""};
|
|
||||||
|
|
||||||
if(Array.isArray(data[1])) {
|
if(Array.isArray(data[1])) {
|
||||||
this.publicationInfo.title['name'] = data[1][0].content;
|
this.publicationInfo.title['name'] = data[1][0].content;
|
||||||
|
|
|
@ -25,7 +25,7 @@ import {EntitiesSearchService} from '../services/entitySearch.service';
|
||||||
<div *ngIf = "keyword != null && keyword.length > 0 " class="suggestions" >
|
<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>
|
<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" >
|
<ul class="list-group" >
|
||||||
<li *ngIf = "filtered.length > 0 " class="list-group-item" >
|
<li *ngIf = "numFilteredResults > 0 " class="list-group-item" >
|
||||||
Select:
|
Select:
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item" *ngFor=" let item of filtered | async">
|
<li class="list-group-item" *ngFor=" let item of filtered | async">
|
||||||
|
@ -35,7 +35,7 @@ import {EntitiesSearchService} from '../services/entitySearch.service';
|
||||||
</div>
|
</div>
|
||||||
<div class="messages">
|
<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="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 *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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -70,13 +70,17 @@ export class EntitiesAutocompleteComponent {
|
||||||
|
|
||||||
@Input() public funderId:string;
|
@Input() public funderId:string;
|
||||||
@Input() public entityType:string ;
|
@Input() public entityType:string ;
|
||||||
|
@Input() public depositType:string ;
|
||||||
|
|
||||||
constructor (private _search:EntitiesSearchService, private myElement: ElementRef) {
|
constructor (private _search:EntitiesSearchService, private myElement: ElementRef) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
|
console.info("init deposit org" +this.entityType +" "+this.depositType);
|
||||||
|
|
||||||
if(this.entityType == "project" && this.funderId ){
|
if(this.entityType == "project" && this.funderId ){
|
||||||
this.filtered = this.searchTermStream
|
this.filtered = this.searchTermStream
|
||||||
.debounceTime(300).distinctUntilChanged()
|
.debounceTime(300).distinctUntilChanged()
|
||||||
|
@ -86,6 +90,19 @@ export class EntitiesAutocompleteComponent {
|
||||||
this.numFilteredResults = results.length;
|
this.numFilteredResults = results.length;
|
||||||
return results;
|
return results;
|
||||||
});
|
});
|
||||||
|
}else if(this.entityType == "organization" && this.depositType ){
|
||||||
|
console.info("init deposit org")
|
||||||
|
this.filtered = this.searchTermStream
|
||||||
|
.debounceTime(300).distinctUntilChanged()
|
||||||
|
.switchMap((term: string) => {
|
||||||
|
var results = this._search.searchByDepositType(term, this.depositType);
|
||||||
|
this.showLoading = false;
|
||||||
|
this.numFilteredResults = results.length;
|
||||||
|
console.info("deposit org::: Resuults"+results.length)
|
||||||
|
|
||||||
|
return results;
|
||||||
|
});
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
this.filtered = this.searchTermStream
|
this.filtered = this.searchTermStream
|
||||||
|
@ -96,18 +113,7 @@ export class EntitiesAutocompleteComponent {
|
||||||
this.numFilteredResults = results.length;
|
this.numFilteredResults = results.length;
|
||||||
return results;
|
return results;
|
||||||
});
|
});
|
||||||
// this.filtered =
|
|
||||||
// this.searchTermStream
|
|
||||||
// .debounceTime(300).distinctUntilChanged()
|
|
||||||
// .switchMap((term: string) => {
|
|
||||||
// var results = this._search.searchByType(term, this.entityType);
|
|
||||||
// this.showLoading = false;
|
|
||||||
// return results;
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
|
|
||||||
// .subscribe(term => this.wikipediaService.search(term).then(items => this.items = items));
|
|
||||||
// // }
|
|
||||||
this.getSelectedNameFromGivenId();
|
this.getSelectedNameFromGivenId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 22 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
|
@ -23,6 +23,15 @@
|
||||||
.search-form {margin:5px; }
|
.search-form {margin:5px; }
|
||||||
.clickable { cursor:pointer; }
|
.clickable { cursor:pointer; }
|
||||||
|
|
||||||
|
.OPEN {
|
||||||
|
background: rgba(0, 0, 0, 0) url("/assets/openAccess.png") no-repeat scroll right center;
|
||||||
|
padding-right: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.EMBARGO, .CLOSED, .RESTRICTED {
|
||||||
|
background: rgba(0, 0, 0, 0) url("/assets/closedAccess.png") no-repeat scroll right center;
|
||||||
|
padding-right: 18px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<base href="/">
|
<base href="/">
|
||||||
|
|
Loading…
Reference in New Issue