Fixing some issues for ngfactory compilation

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44881 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2016-12-08 12:27:27 +00:00
parent f1af290005
commit c0e4e1818d
24 changed files with 106 additions and 310 deletions

View File

@ -1,10 +1,11 @@
import {Component, Input,Output, ElementRef, EventEmitter, ViewChild} from '@angular/core';
import {Component, Input,Output, EventEmitter, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ContextsService} from '../../services/contexts.service';
import {ClaimContext} from '../../utils/entities/claimEntities.class';
import { StaticAutoCompleteComponent } from '../../utils/staticAutoComplete.component';
@Component({
// moduleId: module.id,
selector: 'claim-contexts',
template: `
<div class="panel-body" *ngIf="!inline">
@ -81,8 +82,6 @@ export class ClaimContextComponent {
public query = '';
public filteredList = [];
public elementRef;
public communities:string[];
public selectedCommunityLabel:string = "Community:";
@ -95,8 +94,8 @@ public infoMessage = "";
ngOnInit() {
this.getCommunities();
}
constructor(private _contextService: ContextsService,myElement: ElementRef) {
this.elementRef = myElement;
constructor(private _contextService: ContextsService) {
}
select($event){

View File

@ -1,5 +1,4 @@
import { Component, Input, Output, EventEmitter} from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { SearchDataciteService } from '../../services/searchDatacite.service';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {ClaimResult} from '../../utils/entities/claimEntities.class';
@ -98,7 +97,8 @@ export class ClaimDatasetComponent {
public errorCodes:ErrorCodes = new ErrorCodes();
dataciteResults=[];
dataciteResultsNum : Observable<number> = null;
dataciteResultsNum:number = null;
// dataciteResultsNum : Observable<number> = null;
dataciteStatus = this.errorCodes.NONE;
datacitePage : number = 1;

View File

@ -1,5 +1,4 @@
import {Component, Input, Output, EventEmitter} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import { ActivatedRoute } from '@angular/router';
import {SearchCrossrefService} from '../../services/searchCrossref.service';
import {SearchOrcidService} from '../../services/searchOrcid.service';
@ -23,10 +22,6 @@ export class ClaimPublicationComponent {
}
ngOnInit() {
this.sub = this.route.params.subscribe(params => {
// let page = +params['page'];
// let size = +params['size'];
// this.page = ( page <= 0 ) ? 1 : page;
// this.size = ( size <= 0 ) ? 10 : size;
if(this.keyword !=null && this.keyword.length > 0){
this.search(this.keyword);
}
@ -47,7 +42,7 @@ ngOnDestroy() {
errorCodes:ErrorCodes = new ErrorCodes();
crossrefResults=[];
crossrefResultsNum : Observable<number> ;
crossrefResultsNum : number = null;
crossrefPage : number = 1;
crossrefStatus:number = this.errorCodes.NONE;

View File

@ -1,5 +1,4 @@
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ClaimPublicationComponent} from './claimPublication.component';
import {ClaimDatasetComponent} from './claimDataset.component';
import {SearchDataciteService} from '../../services/searchDatacite.service';

View File

@ -55,7 +55,7 @@ import { ClaimRoutingModule } from './claim-routing.module';
ClaimsAdminComponent, MyClaimsComponent, ClaimComponent, ClaimsComponent,
BulkLinkingComponent, LinkingComponent, LinkingHomeComponent, LinkingGenericComponent,
InlineClaimContextComponent, InlineClaimProjectComponent, InlineClaimResultComponent, ClaimSelectedComponent,
ClaimContextComponent, ClaimContextComponent, ClaimSelectedContextsComponent, ClaimInsertComponent, ClaimProjectsComponent, ClaimSelectedProjectsComponent,
ClaimContextComponent, ClaimSelectedContextsComponent, ClaimInsertComponent, ClaimProjectsComponent, ClaimSelectedProjectsComponent,
ClaimResultComponent, ClaimSelectedPublicationsComponent, ClaimSelectedDatasetsComponent, ClaimSelectedResultsComponent, ClaimPublicationComponent,
ClaimDatasetComponent, BulkClaimComponent,
ClaimEntityFormatter

View File

@ -1,8 +1,4 @@
import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core';
import {Observable} from 'rxjs/Observable';
// import {ClaimContextComponent} from '../linking/claimContext/claimContext.component';
// import {ClaimSelectedContextsComponent} from '../linking/selected/selectedContexts.component';
import {ClaimInsertComponent} from '../linking/insertClaim/insertClaim.component';
@Component({

View File

@ -4,9 +4,9 @@ import {ClaimProject} from '../../../utils/entities/claimEntities.class';
@Component({
selector: 'claim-selected-projects',
template: `
<div [class]="componentClass" >
<!-- Projects -->
<div *ngIf=" !(inline && hideType == 'project') && projects " class="projects" >
<div> <!-- [class]="componentClass" >
Projects -->
<div *ngIf=" !(inline && hideType == 'project') && projects.length > 0 " class="projects" >
<ul class="list-group">
<li class="list-group-item list-group-item-info">Selected Projects ({{(projects.length)}})
<span *ngIf=" !inline " title="Add More Projects" (click)="showType('project')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></span>

View File

@ -8,7 +8,7 @@ import {ClaimResult} from '../../../utils/entities/claimEntities.class';
<!-- Results -->
<div *ngIf=" !(inline && (hideType == 'publication' || hideType == 'dataset' )) && (datasets || publications)" class="publications" >
<div *ngIf=" !(inline && (hideType == 'publication' || hideType == 'dataset' )) && (datasets.length > 0 || publications.length > 0)" class="publications" >
<ul class="list-group">
<li class="list-group-item panel-footer "> Research Results ({{(datasets.length+publications.length)}})
<span *ngIf=" !inline && linkToResults " title="Add More Research Results" (click)="showType('result')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></span>

View File

@ -37,44 +37,12 @@ import {SearchOrganizationsService} from '../services/searchOrganizations.servic
<div class="form-group form-inline">
<div class="input-group">
<entities-autocomplete [entityType]="'organization'" [depositType]=compatibility [selectedValue]=selectedId [showSelected]=true
[placeHolderMessage] = "'Search for Organizations'" [title] = "Organizations" [multipleSelections]=false
[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>
<input type="text" class="form-control" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
</span>
<span class="input-group-btn">
<button (click)="keywordChanged()" type="submit" class="btn btn-default">SELECT</button>
</span>
</div>
<div>
<ul class="list-group" >
<li class="list-group-item" *ngIf="status == errorCodes.LOADING">
<div class="alert alert-info" role="alert">
Loading...
</div>
</li>
<li class="list-group-item" *ngIf="status == errorCodes.NONE">
<div class="alert alert-warning" role="alert">
No organizations found
</div>
</li>
<li class="list-group-item" *ngIf="status == errorCodes.ERROR">
<div class="alert alert-danger" role="alert">
Sorry! Organizations are not currently available
</div>
</li>
<li class="list-group-item" *ngFor=" let item of organizations">
<a style="cursor:pointer;" (click)="organizationSelected(item.id)">{{item.name}}</a>
</li>
</ul>
</div-->
</form>
</div>
</div>
@ -97,9 +65,7 @@ export class DepositComponent {
public errorCodes:ErrorCodes = new ErrorCodes();
public selectedId = "";
constructor (private _router: Router,
private _searchOrganizationsService: SearchOrganizationsService) {
console.info("constructor deposit");
constructor (private _router: Router, private _searchOrganizationsService: SearchOrganizationsService) {
this.openAccess = OpenaireProperties.getOpenAccess();
this.openAccessRepo = OpenaireProperties.getOpenAccessRepo();
@ -109,33 +75,11 @@ export class DepositComponent {
this.helpdesk = OpenaireProperties.getHelpdesk();
}
keywordChanged() {
console.info("keywordChanged: "+this.keyword);
this.status = this.errorCodes.LOADING;
this.organizations = [];
this._searchOrganizationsService.searchOrganizationsForDeposit(this.keyword, this.compatibility, 1, 10).subscribe(
data => {
this.organizations = data;
this.status = this.errorCodes.DONE;
if(this.organizations.length == 0) {
this.status = this.errorCodes.NONE;
}
},
err => {
console.error(err);
this.status = this.errorCodes.ERROR;
console.info("error");
}
);
}
organizationSelected(id: string) {
if(id && id.length > 0){
if(this.requestFor == "Publications") {
this._router.navigate( ['deposit-publications-result'], { queryParams: { "organizationId": id } } );
} else if(this.requestFor == "Datasets") {

View File

@ -17,7 +17,7 @@ import {OrganizationService} from '../services/organization.service';
<h2>Deposit {{requestFor}}</h2>
</div>
<div *ngIf="status == errorCodes.LOADING || (status == errorCodes.LOADING && searchDataprovidersComponent.status == errorCodes.LOADING)"
<div *ngIf="status == errorCodes.LOADING || (status == errorCodes.LOADING && searchDataprovidersComponent.searchUtils.status == errorCodes.LOADING)"
class="alert alert-info" role="alert">
Loading...
</div>
@ -37,7 +37,7 @@ import {OrganizationService} from '../services/organization.service';
<p>Please use the information/contacts shown below to deposit your publications.</p>
<!--showDataProviders [dataProviders]=dataProviders></showDataProviders-->
<div class = "text-right" *ngIf = "searchDataprovidersComponent.searchUtils.totalResults > 10" ><a [href] = "linkToSearchDataproviders" >View all {{searchDataprovidersComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchDataprovidersComponent.results" [(status)]= "searchDataprovidersComponent.status"></search-result>
<search-result [(results)]="searchDataprovidersComponent.results" [(status)]= "searchDataprovidersComponent.searchUtils.status"></search-result>
</div>
<div *ngIf="(searchDataprovidersComponent.searchUtils.totalResults == 0 && status == errorCodes.DONE)

View File

@ -52,7 +52,7 @@ export class DataProviderComponent {
}
sub: any;
datasourceId: string;
private dataProviderInfo: DataProviderInfo;
public dataProviderInfo: DataProviderInfo;
private showAllReferences: boolean = false;
private showAllRelResData: boolean = false;

View File

@ -29,7 +29,7 @@ export class DatasetComponent {
}
private datasetInfo: DatasetInfo;
public datasetInfo: DatasetInfo;
private showStyle: boolean = false;
private showAllReferences: boolean = false;

View File

@ -45,7 +45,7 @@ import { LandingRoutingModule } from './landing-routing.module';
],
declarations: [
TabPagingComponent, TabTableComponent, ShowTitleComponent, ShowAuthorsComponent, ShowAuthorsComponent, ShowIdentifiersComponent, ShowIdentifiersComponent,ShowSubjectsComponent,
TabPagingComponent, TabTableComponent, ShowTitleComponent, ShowAuthorsComponent,ShowIdentifiersComponent,ShowSubjectsComponent,
PublicationsTabComponent, DatasetsTabComponent, StatisticsTabComponent, ProjectsTabComponent, DatasourcesTabComponent, OrganizationsTabComponent, TabsComponent,
DataProviderComponent, PersonComponent, ProjectComponent, PublicationComponent, OrganizationComponent, DatasetComponent,
],

View File

@ -21,7 +21,7 @@ export class ProjectComponent{
private projectId : string ;
private projectInfo: ProjectInfo;
public projectInfo: ProjectInfo;
private project ;

View File

@ -60,7 +60,7 @@ ngAfterViewChecked() {
}
sub: any;
articleId: string;
private publicationInfo: PublicationInfo;
public publicationInfo: PublicationInfo;
public showAllReferences: boolean = false;
public showAllRelResData: boolean = false;

View File

@ -243,7 +243,7 @@ public subPub;public subData;public subProjects;public subOrg;public subPeople;
}
}
private keywordChanged($event){
public keywordChanged($event){
this.keyword = $event.value;
console.info("Search Find: search with keyword \"" + this.keyword + "\"" );
if(location.pathname.indexOf("search/find") ==-1){

View File

@ -25,14 +25,6 @@ import {SearchFields} from '../../utils/properties/searchFields';
<button class="btn btn-default btn-disabled" type="button">
{{selectedField.name}}
</button>
<!--button aria-expanded="false" aria-haspopup="true" class="btn btn-default dropdown-toggle" data-toggle="dropdown" id="dropdownMenu1" type="button">
{{selectedField.name}}
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li *ngFor="let id of fieldIds">
<a (click)="fieldIdsChanged(i, id)">{{fieldIdsMap[id].name}}</a>
</li>
</ul-->
</div>
<input *ngIf = "fieldIdsMap[selectedField.id].type == 'keyword'" type="text" class="form-control" placeholder="Type keywords..." [(ngModel)]="selectedField.value" name="value[{{i}}]">
@ -44,7 +36,6 @@ import {SearchFields} from '../../utils/properties/searchFields';
<static-autocomplete [(list)] = this.fieldList[selectedField.id] [entityName] = "entityType" [fieldName] = [selectedField.id] [selectedValue]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete>
</div>
<div *ngIf = "fieldIdsMap[selectedField.id].type == 'entity'" class="input-group">
<!--static-autocomplete [(list)] = this.fieldList[selectedField.id] [entityName] = "entityType" [fieldName] = fieldIdsMap[selectedField.id].indexField [selectedValue]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete-->
<entities-autocomplete [entityType]=selectedField.param [selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false
(selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"
@ -62,10 +53,6 @@ import {SearchFields} from '../../utils/properties/searchFields';
</div>
</div>
<!--entities-autocomplete [entityType]="person" [selectedValue]="" [showSelected]=true
[placeHolderMessage] = "'Search for persooon'" [title] = "Person" [multipleSelections]=false
></entities-autocomplete-->
<button type="button" class="btn btn-danger" *ngIf="selectedFields.length > 1" (click)="removeField(i)">
<span class="glyphicon glyphicon-minus" aria-hidden="true"></span>
</button>
@ -100,7 +87,6 @@ export class AdvancedSearchFormComponent {
@Input() entityType;
@Input() fieldIds: string[];
@Input() fieldIdsMap;
//:{ [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ;
@Input() selectedFields:AdvancedField[];
@Output() queryChange = new EventEmitter();
newFieldId:string;

View File

@ -25,16 +25,16 @@ import {DOI} from '../../utils/string-utils.class';
})
export class SearchDatasetsComponent {
public results =[];
private filters: Filter[] =[];
public filters: Filter[] =[];
// public totalResults:number = 0 ;
private baseUrl:string;
public baseUrl:string;
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any;
private subResults: any;
private searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.RESULT_REFINE_FIELDS;
public fieldIdsMap=this.searchFields.RESULT_FIELDS;
public fieldIdsMap=this.searchFields.RESULT_FIELDS;
private urlParams : Map<string, string>;
private _location:Location;

View File

@ -9,153 +9,90 @@ import { CacheService } from '../shared/cache.service';
@Injectable()
export class ISVocabulariesService {
private api ="https://beta.services.openaire.eu/provision/mvc/vocabularies/";
// private api ="https://beta.services.openaire.eu/provision/mvc/vocabularies/";
private api = "http://api.openaire.eu/vocabularies/"
constructor(private http: Http, public _cache: CacheService) {}
getVocabularyByType(field:string,entity:string):AutoCompleteValue[]{
console.log("getVocabulary field: "+ field + " for entity: "+ entity);
var file = "";
var vocabulary = "";
if( field == "lang"){
return this.getLanguagesJsonFile();
file="languages.json";
return this.getVocabularyFromFile(file);
// vocabulary = "dnet:languages.json";
// return this.getVocabularyFromService(vocabulary);
}else if ( field == "type" && (entity == "publication")){
return this.getPublicationTypesJsonFile();
file = "publicationTypes.json";
return this.getVocabularyFromFile(file);
// vocabulary = "dnet:publication_resource.json";
// return this.getVocabularyFromService(vocabulary);
}else if ( field == "type" && (entity == "dataset")){
return this.getDatasetTypesJsonFile();
file = "dnet:dataCite_resource.json";
return this.getVocabularyFromFile(file);
// vocabulary = "dnet:dataCite_resource.json";
// return this.getVocabularyFromService(vocabulary);
}else if( field == "access" && (entity == "publication" || entity == "dataset")){
return this.getAccessModeJsonFile();
file= "accessMode.json";
return this.getVocabularyFromFile(file);
// vocabulary = "dnet:access_modes.json";
// return this.getVocabularyFromService(vocabulary);
} else if( (field == "datasourcetype") && (entity == "dataprovider")){
return this.getDataProviderTypesJsonFile();
file = "dataProviderType.json";
return this.getVocabularyFromFile(file);
// vocabulary = "dnet:datasource_typologies.json";
// return this.getVocabularyFromService(vocabulary);
} else if( field == "compatibility" && (entity == "dataprovider")){
return this.getDataProviderCompatibilityJsonFile();
file = "dataProviderCompatibility.json";
return this.getVocabularyFromFile(file);
// vocabulary = "dnet:datasourceCompatibilityLevel.json";
// return this.getVocabularyFromService(vocabulary);
} else if( field == "country" ){
return this.getCountryJsonFile();
file = "countries.json";
return this.getVocabularyFromFile(file);
// vocabulary = "dnet:countries.json";
// return this.getVocabularyFromService(vocabulary);
}
return null;
}
getLanguages ():any {
let url = this.api+"dnet:languages.json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res['terms'])
.map(res => this.parse(res))
.do(res => {
this._cache.set(key, res);
});
}
getLanguagesJsonFile ():AutoCompleteValue[] {
var lang = JSON.parse(JSON.stringify(require('../utils/vocabularies/languages.json')));
getVocabularyFromFile (file:string):AutoCompleteValue[] {
var lang = JSON.parse(JSON.stringify(require('../utils/vocabularies/'+file)));
return this.parse(lang["terms"]);
}
getVocabularyFromService (vocabularyName:string):any {
let url = this.api + vocabularyName;
console.log(url);
// let key = url;
// if (this._cache.has(key)) {
// return Observable.of(this._cache.get(key));
// }
return this.http.get(url).toPromise()
.then(request =>
{
request = request.json()['terms'];
var results:AutoCompleteValue[] = this.parse(request);
console.log("Get vocabulary : "+ vocabularyName+ " - get " +results.length+ "results");
return results;
});
// return this.http.get(url)
// .do(res => console.log(res))
// .map(res => <any> res.json())
// .map(res => res['terms'])
// .do(res => console.log(res))
// .map(res => this.parse(res))
// .do(res => console.log(res))
// .catch(this.handleError);
// // .do(res => {
// // this._cache.set(key, res);
// // });
getPublicationTypes ():any {
let url = this.api+"dnet:publication_resource.json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res['terms'])
.map(res => this.parse(res))
.do(res => {
this._cache.set(key, res);
});
}
getPublicationTypesJsonFile ():any {
var lang = JSON.parse(JSON.stringify(require('../utils/vocabularies/publicationTypes.json')));
return this.parse(lang["terms"]);
}
getDatasetTypes ():any {
let url = this.api+"dnet:dataCite_resource.json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res['terms'])
.map(res => this.parse(res))
.do(res => {
this._cache.set(key, res);
});
}
getDatasetTypesJsonFile ():any {
var lang = JSON.parse(JSON.stringify(require('../utils/vocabularies/dnet:dataCite_resource.json')));
return this.parse(lang["terms"]);
}
getAccessMode ():any {
console.info("Get AccessMode from IS");
let url = this.api+"dnet:access_modes.json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res['terms'])
.map(res => this.parse(res))
.do(res => {
this._cache.set(key, res);
});
}
getAccessModeJsonFile ():any {
var lang = JSON.parse(JSON.stringify(require('../utils/vocabularies/accessMode.json')));
return this.parse(lang["terms"]);
}
getDataProviderTypes ():any {
let url = this.api+"dnet:datasource_typologies.json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res['terms'])
.map(res => this.parse(res))
.do(res => {
this._cache.set(key, res);
});
}
getDataProviderTypesJsonFile ():any {
var lang = JSON.parse(JSON.stringify(require('../utils/vocabularies/dataProviderType.json')));
return this.parse(lang["terms"]);
}
getDataProviderCompatibility ():any {
let url = this.api+"dnet:datasourceCompatibilityLevel.json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res['terms'])
.map(res => this.parse(res))
.do(res => {
this._cache.set(key, res);
});
}
getDataProviderCompatibilityJsonFile ():any {
var lang = JSON.parse(JSON.stringify(require('../utils/vocabularies/dataProviderCompatibility.json')));
return this.parse(lang["terms"]);
}
parse (data: any):AutoCompleteValue[] {
@ -170,31 +107,10 @@ export class ISVocabulariesService {
return array;
}
getCountryCompatibility ():any {
let url = this.api+"dnet:countries.json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res['terms'])
.map(res => this.parse(res))
.do(res => {
this._cache.set(key, res);
});
}
getCountryJsonFile ():any {
var lang = JSON.parse(JSON.stringify(require('../utils/vocabularies/countries.json')));
return this.parse(lang["terms"]);
}
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);
console.log(error);
return Observable.throw(error || 'Server error');
}
}

View File

@ -14,46 +14,6 @@ export class SearchOrganizationsService {
constructor(private http: Http, public _cache: CacheService) {}
searchOrganizationsForDeposit (params: string, collectedFrom: string, page: number, size: number):any {
console.info("In searchOrganizationsforDeposit");
let link = OpenaireProperties.getSearchResourcesAPIURL();
let url = link+"?query=";
if(params!= null && params != '' ) {
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 "+this.quote(params)+") or (organizationlegalshortname all "+this.quote(params)+")) " +
// "and " + this.quote(params) + " " +
"and (collectedfromdatasourcename exact "+collectedFrom+")) "
}
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.do(res => console.info(res))
.map(res => this.parseResultsForDeposit(res['results']))
.do(res => {
this._cache.set(key, res);
});
//.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "organization")]);
}
quote(params: string):string {
return encodeURIComponent('"'+params+'"');
//return '"'+params+'"';
}
parseResultsForDeposit(data: any): {"name": string, "id": string}[] {
let results: {"name": string, "id": string}[] = [];

View File

@ -69,10 +69,14 @@ export class TestComponent {
}
ngOnInit() {
// this.lan = this._vocabulariesService.getLanguages();
this.lan = this._vocabulariesService.getLanguagesJsonFile();
this.types = this._vocabulariesService.getPublicationTypesJsonFile();
this.user.email = localStorage.getItem("email");
this.user.password = localStorage.getItem("password");
this.lan = this._vocabulariesService.getVocabularyFromService("dnet:languages.json");
this.countries = this._vocabulariesService.getVocabularyFromService("dnet:countries.json");
if( typeof localStorage !== 'undefined') {
this.user.email = localStorage.getItem("email");
this.user.password = localStorage.getItem("password");
}
//&collectedFrom=openaire____::4a39de251a65e801bb88d3e75b47623f&cl=and
this._searchDataService.searchDatasets('&fq=collectedfromdatasourceid exact "openaire____::fdb035c8b3e0540a8d9a561a6c44f4de"' ,"&refine=true&fields=resulthostingdatasourceid", 1, 0, ["resulthostingdatasourceid"]).subscribe(
data => {
@ -143,7 +147,7 @@ export class TestComponent {
}
}
login(){
localStorage.setItem("email",this.user.email);
localStorage.setItem("password",this.user.password);

View File

@ -91,15 +91,12 @@ export class EntitiesAutocompleteComponent {
return results;
});
}else if(this.entityType == "organization" && this.depositType ){
console.info("init deposit org")
this.filtered = this.searchTermStream
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;
});
@ -233,7 +230,7 @@ export class EntitiesAutocompleteComponent {
this.selected.push( data[0]);
this.showInput = false;
},
err => console.error("An error occured"));
err => console.log("An error occured"));
}
}

View File

@ -11,12 +11,12 @@ export class Open {
public isExpanded:boolean = true;
@Input()
private set open(value:boolean) {
public set open(value:boolean) {
this.isExpanded = value;
this.toggle();
}
private get open():boolean {
public get open():boolean {
return this.isExpanded;
}

View File

@ -7,7 +7,7 @@ import {OpenaireProperties} from '../utils/properties/openaireProperties';
selector: 'project-title',
template: `
<div class="project-title">
<h5 ><a target="_blank" [href]="url" >{{project.name}} ({{project.funderName}})</a></h5>
<h5 ><a target="_blank" [href]="url" >{{project['name']}} ({{project['funderName']}})</a></h5>
</div>
`
})