login through AAI - claims API uses AAI authentication | remove cookies locally when logout is clicked | use images for the search forms | fix issue with org landing page where projects tab didn't reload
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@48552 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
f81fe6515e
commit
997e3b5020
|
@ -30,7 +30,6 @@ export class XLargeDirective {
|
||||||
|
|
||||||
|
|
||||||
<div id="tm-main" class=" uk-section uk-margin-large-top tm-middle custom-main-content" >
|
<div id="tm-main" class=" uk-section uk-margin-large-top tm-middle custom-main-content" >
|
||||||
<div class="uk-container ">
|
|
||||||
<div uk-grid uk-grid>
|
<div uk-grid uk-grid>
|
||||||
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
|
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
|
||||||
|
|
||||||
|
@ -49,7 +48,6 @@ export class XLargeDirective {
|
||||||
<!-- end of sidebar -->
|
<!-- end of sidebar -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<cookie-law *ngIf= "isClient" position="bottom">
|
<cookie-law *ngIf= "isClient" position="bottom">
|
||||||
OpenAIRE uses cookies in order to function properly.<br>
|
OpenAIRE uses cookies in order to function properly.<br>
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {SharedComponentsModule} from './sharedComponents/sharedComponents.module
|
||||||
import { ErrorModule } from './error/error.module';
|
import { ErrorModule } from './error/error.module';
|
||||||
import { CacheService } from './shared/cache.service';
|
import { CacheService } from './shared/cache.service';
|
||||||
import { CookieLawModule } from './sharedComponents/cookie-law/cookie-law.module';
|
import { CookieLawModule } from './sharedComponents/cookie-law/cookie-law.module';
|
||||||
|
import { XSRFStrategy, CookieXSRFStrategy, RequestOptions } from '@angular/http';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [ AppComponent, XLargeDirective ],
|
declarations: [ AppComponent, XLargeDirective ],
|
||||||
|
@ -22,10 +23,19 @@ import { CookieLawModule } from './sharedComponents/cookie-law/cookie-law.module
|
||||||
CookieLawModule,
|
CookieLawModule,
|
||||||
|
|
||||||
], exports:[],
|
], exports:[],
|
||||||
providers:[CacheService]
|
providers:[CacheService,
|
||||||
|
// { provide: XSRFStrategy, useFactory: cookieStrategy },
|
||||||
|
// { provide: RequestOptions, useClass: ExRequestOptions}
|
||||||
|
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
})
|
})
|
||||||
export class AppModule {
|
export class AppModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
export { AppComponent } from './app.component';
|
export { AppComponent } from './app.component';
|
||||||
|
export function cookieStrategy() {
|
||||||
|
// return new CookieXSRFStrategy('X-Csrf-Token','X-XSRF-TOKEN');
|
||||||
|
// return new CookieXSRFStrategy('lalala','lalala');
|
||||||
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import {ErrorCodes} from '../../login/utils/guardHelper.class';
|
||||||
<td >
|
<td >
|
||||||
<select class="custom-select-mini" name="select_funder" >
|
<select class="custom-select-mini" name="select_funder" >
|
||||||
<option value="0" (click)="communityChanged('0','Community:')">Select Community:</option>
|
<option value="0" (click)="communityChanged('0','Community:')">Select Community:</option>
|
||||||
<option *ngIf="communities" (click)="communityChanged(communities.id, communities.label)" [value]="communities.id" >{{communities.label}}</option>
|
<option *ngFor="let community of communities" (click)="communityChanged(community.id, community.label)" [value]="community.id" >{{community.label}}</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td *ngIf="selectedCommunityId != '0' && categories.length > 0"><select class="custom-select-mini" name="select_funder" >
|
<td *ngIf="selectedCommunityId != '0' && categories.length > 0"><select class="custom-select-mini" name="select_funder" >
|
||||||
|
@ -181,9 +181,10 @@ getCommunities () {
|
||||||
}else{
|
}else{
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
var token=Session.getUserJwt();
|
var token=Session.getUserJwt();
|
||||||
this._contextService.getCommunities(token).subscribe(
|
this._contextService.getCommunities().subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.communities = data.communities;
|
this.communities = data.communities;
|
||||||
|
console.log(this.communities);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
|
@ -204,7 +205,7 @@ getCommunities () {
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
var token=Session.getUserJwt();
|
var token=Session.getUserJwt();
|
||||||
this._contextService.getCategories(this.selectedCommunityId, token).subscribe(
|
this._contextService.getCategories(this.selectedCommunityId).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.categories = data.category;
|
this.categories = data.category;
|
||||||
this.concepts = [];
|
this.concepts = [];
|
||||||
|
@ -233,7 +234,7 @@ getCommunities () {
|
||||||
this.concepts = [];
|
this.concepts = [];
|
||||||
this.addCommunityInConcepts();
|
this.addCommunityInConcepts();
|
||||||
var token=Session.getUserJwt();
|
var token=Session.getUserJwt();
|
||||||
this._contextService.getConcepts(this.selectedCategoryId, "",token,true).subscribe(
|
this._contextService.getConcepts(this.selectedCategoryId, "",true).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.concepts = data;
|
this.concepts = data;
|
||||||
this.addCommunityInConcepts();
|
this.addCommunityInConcepts();
|
||||||
|
@ -277,7 +278,7 @@ getCommunities () {
|
||||||
this.conceptsClass[categoryId] = [];
|
this.conceptsClass[categoryId] = [];
|
||||||
var token=Session.getUserJwt();
|
var token=Session.getUserJwt();
|
||||||
this.conceptsCategoryLoading[categoryId] = true;
|
this.conceptsCategoryLoading[categoryId] = true;
|
||||||
this._contextService.getConcepts(categoryId, "",token,false).subscribe(
|
this._contextService.getConcepts(categoryId, "",false).subscribe(
|
||||||
data => {
|
data => {
|
||||||
for(var i=0;i<data.length; i++){
|
for(var i=0;i<data.length; i++){
|
||||||
console.log("Data"+data[i]);
|
console.log("Data"+data[i]);
|
||||||
|
|
|
@ -108,7 +108,7 @@ export class DisplayClaimsComponent {
|
||||||
types+=(types.length>0?'&':'')+"types="+type;
|
types+=(types.length>0?'&':'')+"types="+type;
|
||||||
}
|
}
|
||||||
if(this.fetchBy =="Project" ){
|
if(this.fetchBy =="Project" ){
|
||||||
this._claimService.getClaimsByProject(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types,token).subscribe(
|
this._claimService.getClaimsByProject(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.claims = data.data;
|
this.claims = data.data;
|
||||||
this.resultsNum= data.total;
|
this.resultsNum= data.total;
|
||||||
|
@ -118,7 +118,7 @@ export class DisplayClaimsComponent {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}else if(this.fetchBy =="User"){
|
}else if(this.fetchBy =="User"){
|
||||||
this._claimService.getClaimsByUser(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types,token).subscribe(
|
this._claimService.getClaimsByUser(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.claims = data.data;
|
this.claims = data.data;
|
||||||
this.resultsNum= data.total;
|
this.resultsNum= data.total;
|
||||||
|
@ -128,7 +128,7 @@ export class DisplayClaimsComponent {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}else if(this.fetchBy =="Result"){
|
}else if(this.fetchBy =="Result"){
|
||||||
this._claimService.getClaimsByResult(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types,token).subscribe(
|
this._claimService.getClaimsByResult(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.claims = data.data;
|
this.claims = data.data;
|
||||||
this.resultsNum= data.total;
|
this.resultsNum= data.total;
|
||||||
|
@ -138,7 +138,7 @@ export class DisplayClaimsComponent {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}else if(this.fetchBy =="Context"){
|
}else if(this.fetchBy =="Context"){
|
||||||
this._claimService.getClaimsBycontext(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types,token).subscribe(
|
this._claimService.getClaimsBycontext(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.claims = data.data;
|
this.claims = data.data;
|
||||||
this.resultsNum= null;
|
this.resultsNum= null;
|
||||||
|
@ -149,7 +149,7 @@ export class DisplayClaimsComponent {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}else{
|
}else{
|
||||||
this._claimService.getClaims(this.size,this.page,this.keyword,this.sortby,this.descending, types,token).subscribe(
|
this._claimService.getClaims(this.size,this.page,this.keyword,this.sortby,this.descending, types).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.claims = data.data;
|
this.claims = data.data;
|
||||||
this.resultsNum = null;
|
this.resultsNum = null;
|
||||||
|
@ -409,7 +409,7 @@ handleErrors(err){
|
||||||
var token=Session.getUserJwt();
|
var token=Session.getUserJwt();
|
||||||
console.log("Deleting claim with id:"+id);
|
console.log("Deleting claim with id:"+id);
|
||||||
// this._claimService.deleteClaimById(id);
|
// this._claimService.deleteClaimById(id);
|
||||||
this._claimService.deleteClaimById(id,token).subscribe(
|
this._claimService.deleteClaimById(id).subscribe(
|
||||||
res => {
|
res => {
|
||||||
console.log('Delete response'+res.code );
|
console.log('Delete response'+res.code );
|
||||||
console.log("Deleted claim with id:"+ id);
|
console.log("Deleted claim with id:"+ id);
|
||||||
|
@ -441,7 +441,7 @@ handleErrors(err){
|
||||||
}else{
|
}else{
|
||||||
var token=Session.getUserJwt();
|
var token=Session.getUserJwt();
|
||||||
console.warn("Deleting claim with ids:"+ids);
|
console.warn("Deleting claim with ids:"+ids);
|
||||||
this._claimService.deleteBulk(ids,token).subscribe(
|
this._claimService.deleteBulk(ids).subscribe(
|
||||||
res => {
|
res => {
|
||||||
console.info('Delete response'+res.code );
|
console.info('Delete response'+res.code );
|
||||||
console.warn("Deleted ids:"+ res.deletedIds);
|
console.warn("Deleted ids:"+ res.deletedIds);
|
||||||
|
@ -471,6 +471,11 @@ handleErrors(err){
|
||||||
if(res.notFoundIds.length>0){
|
if(res.notFoundIds.length>0){
|
||||||
this.deleteMessage=this.deleteMessage+'<div class = "uk-alert uk-alert-warning " >'+res.notFoundIds.length+' claim(s) couldn\'t be deleted.</div>';
|
this.deleteMessage=this.deleteMessage+'<div class = "uk-alert uk-alert-warning " >'+res.notFoundIds.length+' claim(s) couldn\'t be deleted.</div>';
|
||||||
}
|
}
|
||||||
|
}, err => {
|
||||||
|
console.log(err);
|
||||||
|
this.showErrorMessage = true;
|
||||||
|
this.loading.close();
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {Jsonp, URLSearchParams,ResponseOptions, RequestOptions, Headers} from '@angular/http';
|
import {Jsonp, URLSearchParams } from '@angular/http';
|
||||||
import {Http, Response} from '@angular/http';
|
import {Http, Response} from '@angular/http';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
// import {Claim} from '../claim';
|
// import {Claim} from '../claim';
|
||||||
|
@ -8,7 +8,7 @@ import 'rxjs/add/observable/of';
|
||||||
import 'rxjs/add/operator/do';
|
import 'rxjs/add/operator/do';
|
||||||
import 'rxjs/add/operator/share';
|
import 'rxjs/add/operator/share';
|
||||||
import { CacheService } from '../../../shared/cache.service';
|
import { CacheService } from '../../../shared/cache.service';
|
||||||
|
import { CustomOptions } from './customOptions.class';
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ClaimsService {
|
export class ClaimsService {
|
||||||
private baseUrl;
|
private baseUrl;
|
||||||
|
@ -16,13 +16,13 @@ export class ClaimsService {
|
||||||
this.baseUrl = OpenaireProperties.getClaimsAPIURL();
|
this.baseUrl = OpenaireProperties.getClaimsAPIURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
private getClaimRequest(size : number, page : number, url :string, fromCache:boolean,token:string):any {
|
private getClaimRequest(size : number, page : number, url :string, fromCache:boolean):any {
|
||||||
console.info('ClaimsService: Claims request: '+url);
|
console.info('ClaimsService: Claims request: '+url);
|
||||||
let key = url;
|
let key = url;
|
||||||
if (fromCache && this._cache.has(key)) {
|
if (fromCache && this._cache.has(key)) {
|
||||||
return Observable.of(this._cache.get(key));
|
return Observable.of(this._cache.get(key));
|
||||||
}
|
}
|
||||||
return this.http.get( url+"&token="+token)
|
return this.http.get( url, CustomOptions.getAuthOptions())
|
||||||
.map(request => <any> request.json())
|
.map(request => <any> request.json())
|
||||||
.do(request => console.info("Get claims: offset = "+(size*(page-1)) + " limit ="+size ))
|
.do(request => console.info("Get claims: offset = "+(size*(page-1)) + " limit ="+size ))
|
||||||
.catch(this.handleError)
|
.catch(this.handleError)
|
||||||
|
@ -30,48 +30,48 @@ export class ClaimsService {
|
||||||
this._cache.set(key, res);
|
this._cache.set(key, res);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string,token:string):any {
|
getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string):any {
|
||||||
console.info('ClaimsService: getClaims ' );
|
console.info('ClaimsService: getClaims ' );
|
||||||
console.info('ClaimsService: Types : '+types );
|
console.info('ClaimsService: Types : '+types );
|
||||||
let url = this.baseUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
let url = this.baseUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
||||||
return this.getClaimRequest(size,page,url,true,token);
|
return this.getClaimRequest(size,page,url,true);
|
||||||
|
|
||||||
}
|
}
|
||||||
getClaimsByUser( size : number, page : number, user:string, keyword:string, sortby: string, descending: boolean, types: string,token:string):any {
|
getClaimsByUser( size : number, page : number, user:string, keyword:string, sortby: string, descending: boolean, types: string):any {
|
||||||
console.info('ClaimsService: getClaims for user : '+user);
|
console.info('ClaimsService: getClaims for user : '+user);
|
||||||
let url = this.baseUrl +"users/"+user+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
let url = this.baseUrl +"users/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
||||||
return this.getClaimRequest(size,page,url,false,token);
|
return this.getClaimRequest(size,page,url,false);
|
||||||
|
|
||||||
}
|
}
|
||||||
getClaimsBycontext( size : number, page : number, contextId:string, keyword:string, sortby: string, descending: boolean, types: string,token:string):any {
|
getClaimsBycontext( size : number, page : number, contextId:string, keyword:string, sortby: string, descending: boolean, types: string ):any {
|
||||||
console.info('ClaimsService: getClaims for context : '+contextId);
|
console.info('ClaimsService: getClaims for context : '+contextId);
|
||||||
let url = this.baseUrl +"contexts/"+contextId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
let url = this.baseUrl +"contexts/"+contextId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
||||||
return this.getClaimRequest(size,page,url,true,token);
|
return this.getClaimRequest(size,page,url,true);
|
||||||
|
|
||||||
}
|
}
|
||||||
getClaimsByResult( size : number, page : number, resultId:string, keyword:string, sortby: string, descending: boolean, types: string,token:string):any {
|
getClaimsByResult( size : number, page : number, resultId:string, keyword:string, sortby: string, descending: boolean, types: string ):any {
|
||||||
console.info('ClaimsService: getClaims for result : '+resultId);
|
console.info('ClaimsService: getClaims for result : '+resultId);
|
||||||
let url = this.baseUrl +"results/"+resultId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
let url = this.baseUrl +"results/"+resultId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
||||||
return this.getClaimRequest(size,page,url,true,token);
|
return this.getClaimRequest(size,page,url,true);
|
||||||
|
|
||||||
}
|
}
|
||||||
getClaimsByProject( size : number, page : number, projectId:string, keyword:string, sortby: string, descending: boolean, types: string,token:string):any {
|
getClaimsByProject( size : number, page : number, projectId:string, keyword:string, sortby: string, descending: boolean, types: string ):any {
|
||||||
console.info('ClaimsService: getClaims for project : '+projectId);
|
console.info('ClaimsService: getClaims for project : '+projectId);
|
||||||
let url = this.baseUrl +"projects/"+projectId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
let url = this.baseUrl +"projects/"+projectId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
||||||
return this.getClaimRequest(size,page,url,true,token);
|
return this.getClaimRequest(size,page,url,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteClaimById(claimId:string,token:string):any{
|
deleteClaimById(claimId:string ):any{
|
||||||
console.warn('Trying to delete claim with id : '+claimId);
|
console.warn('Trying to delete claim with id : '+claimId);
|
||||||
let url = this.baseUrl +"claims/"+claimId+"?token="+token;
|
let url = this.baseUrl +"claims/"+claimId;
|
||||||
// let headers = new Headers({ 'Content-Type': 'application/json' });
|
// let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||||
// let options = new RequestOptions({ headers: headers });
|
// let options = new RequestOptions({ headers: headers });
|
||||||
return this.http.delete( url, this.getOptions()).map(request => <any> request.json())
|
return this.http.delete( url, CustomOptions.getAuthOptionsWithBody()).map(request => <any> request.json())
|
||||||
// .do(request => console.info("After delete" ))
|
// .do(request => console.info("After delete" ))
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
|
|
||||||
}
|
}
|
||||||
deleteBulk(claimIds:string[],token:string):any{
|
deleteBulk(claimIds:string[]):any{
|
||||||
|
|
||||||
console.warn('Trying to delete claims with ids : '+claimIds);
|
console.warn('Trying to delete claims with ids : '+claimIds);
|
||||||
var url = "";
|
var url = "";
|
||||||
|
@ -79,47 +79,48 @@ export class ClaimsService {
|
||||||
for(var claimId of claimIds){
|
for(var claimId of claimIds){
|
||||||
url=url+(url.length >0 ?"&":"")+"claimId="+claimId;
|
url=url+(url.length >0 ?"&":"")+"claimId="+claimId;
|
||||||
}
|
}
|
||||||
url= this.baseUrl +"claims/bulk?"+url+"&token="+token;
|
url= this.baseUrl +"claims/bulk?"+url;
|
||||||
|
|
||||||
// let headers = new Headers({ 'Content-Type': 'application/json' });
|
// let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||||
// let options = new RequestOptions({ headers: headers });
|
// let options = new RequestOptions({ headers: headers });
|
||||||
return this.http.delete( url, this.getOptions()).map(request => <any> request.json())
|
return this.http.delete( url, CustomOptions.getAuthOptions()).map(request => <any> request.json())
|
||||||
// .do(request => console.info("After delete" ))
|
// .do(request => console.info("After delete" ))
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
|
|
||||||
}
|
}
|
||||||
insertBulkClaims(claims,token:string):any{
|
insertBulkClaims(claims):any{
|
||||||
console.warn('Trying toinsert claims : '+claims);
|
console.warn('Trying toinsert claims : '+claims);
|
||||||
let url = this.baseUrl +"claims/bulk"+"?token="+token;
|
let url = this.baseUrl +"claims/bulk";
|
||||||
let body = JSON.stringify( claims );
|
let body = JSON.stringify( claims );
|
||||||
console.warn('Json body: : '+body);
|
console.warn('Json body: : '+body);
|
||||||
// let headers = new Headers({ 'Content-Type': 'application/json' });
|
// let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||||
// let options = new RequestOptions({ headers: headers });
|
// let options = new RequestOptions({ headers: headers });
|
||||||
return this.http.post(url, body, this.getOptions())
|
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
|
||||||
.map(res => res.json())
|
.map(res => res.json())
|
||||||
.do(request => console.info("Insert Response:"+request.status) )
|
.do(request => console.info("Insert Response:"+request.status) )
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
|
|
||||||
}
|
}
|
||||||
insertClaim(claim,token:string):any{
|
insertClaim(claim):any{
|
||||||
console.warn('Trying toinsert claim : '+claim);
|
console.warn('Trying toinsert claim : '+claim);
|
||||||
let url = this.baseUrl +"claims"+"?token="+token;
|
let url = this.baseUrl +"claims";
|
||||||
let body = JSON.stringify( claim );
|
let body = JSON.stringify( claim );
|
||||||
// let headers = new Headers({ 'Content-Type': 'application/json' });
|
// let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||||
// let options = new RequestOptions({ headers: headers });
|
// let options = new RequestOptions({ headers: headers });
|
||||||
return this.http.post(url, body, this.getOptions())
|
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
|
||||||
.map(res => res.json())
|
.map(res => res.json())
|
||||||
.do(request => console.info("Insert Response:"+request.status) )
|
.do(request => console.info("Insert Response:"+request.status) )
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
|
|
||||||
}
|
}
|
||||||
insertDirectRecords(records,token:string):any{
|
insertDirectRecords(records):any{
|
||||||
console.warn('Trying to feedrecords : '+records);
|
console.warn('Trying to feedrecords : '+records);
|
||||||
let url = this.baseUrl +"feed/bulk"+"?token="+token;
|
let url = this.baseUrl +"feed/bulk";
|
||||||
let body = JSON.stringify( records );
|
let body = JSON.stringify( records );
|
||||||
console.warn('Json body: : '+body);
|
console.warn('Json body: : '+body);
|
||||||
// let headers = new Headers({ 'Content-Type': 'application/json' });
|
// let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||||
// let options = new RequestOptions({ headers: headers });
|
// let options = new RequestOptions({ headers: headers });
|
||||||
return this.http.post(url, body, this.getOptions())
|
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
|
||||||
.map(res => res.json())
|
.map(res => res.json())
|
||||||
.do(request => console.info("Insert Response:"+request) )
|
.do(request => console.info("Insert Response:"+request) )
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
|
@ -132,8 +133,8 @@ export class ClaimsService {
|
||||||
return Observable.throw(error || 'Server error');
|
return Observable.throw(error || 'Server error');
|
||||||
}
|
}
|
||||||
|
|
||||||
getClaim(id:string,token:string):any {
|
getClaim(id:string):any {
|
||||||
let url = this.baseUrl+"claims/"+id+"?token="+token;
|
let url = this.baseUrl+"claims/"+id;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.http.get(url)
|
this.http.get(url)
|
||||||
.map(res => res.json())
|
.map(res => res.json())
|
||||||
|
@ -149,11 +150,5 @@ export class ClaimsService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private getOptions(){
|
|
||||||
let headers = new Headers();
|
|
||||||
headers.append('Content-Type', 'application/json');
|
|
||||||
let options = new RequestOptions({ headers: headers });
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {Jsonp, URLSearchParams,ResponseOptions} from '@angular/http';
|
import {Jsonp, URLSearchParams, RequestOptions, Headers} from '@angular/http';
|
||||||
import {Http, Response} from '@angular/http';
|
import {Http, Response} from '@angular/http';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {Claim} from '../claim';
|
import {Claim} from '../claim';
|
||||||
|
@ -9,7 +9,7 @@ import 'rxjs/add/observable/of';
|
||||||
import 'rxjs/add/operator/do';
|
import 'rxjs/add/operator/do';
|
||||||
import 'rxjs/add/operator/share';
|
import 'rxjs/add/operator/share';
|
||||||
import { CacheService } from '../../../shared/cache.service';
|
import { CacheService } from '../../../shared/cache.service';
|
||||||
|
import { COOKIE } from '../../../login/utils/helper.class';
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ContextsService {
|
export class ContextsService {
|
||||||
private baseUrl;
|
private baseUrl;
|
||||||
|
@ -17,7 +17,7 @@ export class ContextsService {
|
||||||
this.baseUrl = OpenaireProperties.getClaimsAPIURL();
|
this.baseUrl = OpenaireProperties.getClaimsAPIURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getCommunities(token:string):any {
|
public getCommunities():any {
|
||||||
let url = this.baseUrl + 'communities';
|
let url = this.baseUrl + 'communities';
|
||||||
let key = url;
|
let key = url;
|
||||||
if (this._cache.has(key)) {
|
if (this._cache.has(key)) {
|
||||||
|
@ -25,7 +25,7 @@ export class ContextsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
console.info('ContextsService: request communities '+url);
|
console.info('ContextsService: request communities '+url);
|
||||||
return this.http.get( url+"?token="+token)
|
return this.http.get( url, this.getAuthOptions())
|
||||||
.map(request => <any> request.json().data)
|
.map(request => <any> request.json().data)
|
||||||
// .do(request => console.info("Get claims: offset = "))
|
// .do(request => console.info("Get claims: offset = "))
|
||||||
.catch(this.handleError)
|
.catch(this.handleError)
|
||||||
|
@ -33,7 +33,7 @@ export class ContextsService {
|
||||||
this._cache.set(key, res);
|
this._cache.set(key, res);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public getCategories(communityId :string,token:string):any {
|
public getCategories(communityId :string):any {
|
||||||
console.info('ContextsService: request categories for community with id '+communityId);
|
console.info('ContextsService: request categories for community with id '+communityId);
|
||||||
let url= this.baseUrl + 'communities/' + communityId + '/categories';
|
let url= this.baseUrl + 'communities/' + communityId + '/categories';
|
||||||
let key = url;
|
let key = url;
|
||||||
|
@ -41,7 +41,7 @@ export class ContextsService {
|
||||||
return Observable.of(this._cache.get(key));
|
return Observable.of(this._cache.get(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.http.get( url+"?token="+token)
|
return this.http.get( url, this.getAuthOptions())
|
||||||
.map(request => <any> request.json().data)
|
.map(request => <any> request.json().data)
|
||||||
// .do(request => console.info("Get claims: offset = " ))
|
// .do(request => console.info("Get claims: offset = " ))
|
||||||
.catch(this.handleError)
|
.catch(this.handleError)
|
||||||
|
@ -49,7 +49,7 @@ export class ContextsService {
|
||||||
this._cache.set(key, res);
|
this._cache.set(key, res);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public getConcepts(categoryId :string, keyword: string,token:string,parsing:boolean):any {
|
public getConcepts(categoryId :string, keyword: string, parsing:boolean):any {
|
||||||
console.info('ContextsService: request concept for category with id '+categoryId + ' and keyword '+ keyword);
|
console.info('ContextsService: request concept for category with id '+categoryId + ' and keyword '+ keyword);
|
||||||
let url= this.baseUrl + 'categories/' + categoryId+ "/concepts";
|
let url= this.baseUrl + 'categories/' + categoryId+ "/concepts";
|
||||||
let key = url+"_parsing="+parsing;
|
let key = url+"_parsing="+parsing;
|
||||||
|
@ -57,7 +57,7 @@ export class ContextsService {
|
||||||
return Observable.of(this._cache.get(key));
|
return Observable.of(this._cache.get(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.http.get( url+"?token="+token)
|
return this.http.get( url, this.getAuthOptions())
|
||||||
.map(request => <any> request.json().data)
|
.map(request => <any> request.json().data)
|
||||||
.map(res => (parsing)?this.parse(res.concept):res.concept)
|
.map(res => (parsing)?this.parse(res.concept):res.concept)
|
||||||
.do(res => console.info(res ))
|
.do(res => console.info(res ))
|
||||||
|
@ -85,4 +85,10 @@ export class ContextsService {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return Observable.throw(error || 'Server error');
|
return Observable.throw(error || 'Server error');
|
||||||
}
|
}
|
||||||
|
private getAuthOptions():RequestOptions{
|
||||||
|
let headers = new Headers();
|
||||||
|
headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id));
|
||||||
|
let options = new RequestOptions({ headers: headers, withCredentials:true });
|
||||||
|
return options;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { RequestOptions, Headers} from '@angular/http';
|
||||||
|
import { COOKIE } from '../../../login/utils/helper.class';
|
||||||
|
|
||||||
|
|
||||||
|
export class CustomOptions{
|
||||||
|
public static getAuthOptionsWithBody():RequestOptions{
|
||||||
|
let headers = new Headers();
|
||||||
|
headers.append('Content-Type', 'application/json');
|
||||||
|
headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id));
|
||||||
|
let options = new RequestOptions({ headers: headers, withCredentials:true });
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
public static getAuthOptions():RequestOptions{
|
||||||
|
let headers = new Headers();
|
||||||
|
headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id));
|
||||||
|
let options = new RequestOptions({ headers: headers, withCredentials:true });
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,9 +6,9 @@ import { Meta} from '../../../angular2-meta';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'claims-admin',
|
selector: 'claims-admin',
|
||||||
template: `
|
template: `
|
||||||
<div class="container">
|
<div class="uk-container">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1> Claims Administrator </h1>
|
<h2> Claims Administrator </h2>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="uk-text-right"><a routerLink="/participate/claim">Add more Links?</a></div>
|
<div class="uk-text-right"><a routerLink="/participate/claim">Add more Links?</a></div>
|
||||||
|
|
|
@ -18,7 +18,7 @@ import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'claims-project-manager',
|
selector: 'claims-project-manager',
|
||||||
template: `
|
template: `
|
||||||
|
<div class="uk-container">
|
||||||
<!--div *ngIf="accessStatus=='empty'" class="uk-margin-top uk-width-medium-2-3 uk-container-center">
|
<!--div *ngIf="accessStatus=='empty'" class="uk-margin-top uk-width-medium-2-3 uk-container-center">
|
||||||
<div class="uk-block uk-block-primary uk-block-large uk-contrast uk-text-center">
|
<div class="uk-block uk-block-primary uk-block-large uk-contrast uk-text-center">
|
||||||
<p class="uk-text-large">Please enter your email and then press 'See Claims' button.</p>
|
<p class="uk-text-large">Please enter your email and then press 'See Claims' button.</p>
|
||||||
|
@ -174,6 +174,8 @@ import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe';
|
||||||
<!--modal-select (alertOutput)="curatorSelected($event)"></modal-select-->
|
<!--modal-select (alertOutput)="curatorSelected($event)"></modal-select-->
|
||||||
<modal-loading [message]= "'Loading...'"></modal-loading>
|
<modal-loading [message]= "'Loading...'"></modal-loading>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
`,
|
`,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -367,7 +369,7 @@ public sortByTitle2= (claim: any) => {
|
||||||
console.info("Changes Saved!");
|
console.info("Changes Saved!");
|
||||||
var jwtToken=Session.getUserJwt();
|
var jwtToken=Session.getUserJwt();
|
||||||
|
|
||||||
this.claimsByTokenService.updateClaimsCuration(jwtToken, this.selectedRight, this.selectedWrong).subscribe(
|
this.claimsByTokenService.updateClaimsCuration(this.selectedRight, this.selectedWrong).subscribe(
|
||||||
data => {
|
data => {
|
||||||
console.info(data);
|
console.info(data);
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,6 +5,8 @@ import {Observable} from 'rxjs/Observable';
|
||||||
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
||||||
import 'rxjs/add/operator/do';
|
import 'rxjs/add/operator/do';
|
||||||
import { CacheService } from '../../shared/cache.service';
|
import { CacheService } from '../../shared/cache.service';
|
||||||
|
import { CustomOptions } from '../claim-utils/service/customOptions.class';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ClaimsByTokenService {
|
export class ClaimsByTokenService {
|
||||||
|
|
||||||
|
@ -13,13 +15,13 @@ export class ClaimsByTokenService {
|
||||||
getClaims(token: string, jwtToken: string):any {
|
getClaims(token: string, jwtToken: string):any {
|
||||||
console.info("getClaims in service");
|
console.info("getClaims in service");
|
||||||
|
|
||||||
let url = OpenaireProperties.getClaimsAPIURL()+"project/claims?token="+jwtToken+"&projectToken="+token;
|
let url = OpenaireProperties.getClaimsAPIURL()+"project/claims?projectToken="+token;
|
||||||
|
|
||||||
let key = url;
|
let key = url;
|
||||||
//if (this._cache.has(key)) {
|
//if (this._cache.has(key)) {
|
||||||
// return Observable.of(this._cache.get(key));
|
// return Observable.of(this._cache.get(key));
|
||||||
//}
|
//}
|
||||||
return this.http.get(url)
|
return this.http.get(url, CustomOptions.getAuthOptions())
|
||||||
//.map(res => <any> res.text())
|
//.map(res => <any> res.text())
|
||||||
.map(request => <any> request.json());
|
.map(request => <any> request.json());
|
||||||
//.do(res => {
|
//.do(res => {
|
||||||
|
@ -42,8 +44,8 @@ export class ClaimsByTokenService {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
updateClaimsCuration(jwtToken: string, selectedRight: Set<string>, selectedWrong: Set<string>) {
|
updateClaimsCuration( selectedRight: Set<string>, selectedWrong: Set<string>) {
|
||||||
let url = OpenaireProperties.getClaimsAPIURL() + "curate/bulk?token="+jwtToken;
|
let url = OpenaireProperties.getClaimsAPIURL() + "curate/bulk";
|
||||||
let claimsCurationInfo: any = []; //e.g.: [{"id":"2","approved":true},{"id":"1","approved":true}]
|
let claimsCurationInfo: any = []; //e.g.: [{"id":"2","approved":true},{"id":"1","approved":true}]
|
||||||
|
|
||||||
selectedRight.forEach(function(selected) {
|
selectedRight.forEach(function(selected) {
|
||||||
|
@ -64,7 +66,7 @@ export class ClaimsByTokenService {
|
||||||
console.warn('Json body: : '+body);
|
console.warn('Json body: : '+body);
|
||||||
let headers = new Headers({ 'Content-Type': 'application/json' });
|
let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||||
let options = new RequestOptions({ headers: headers });
|
let options = new RequestOptions({ headers: headers });
|
||||||
return this.http.post(url, body, options)
|
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
|
||||||
.map(res => res.json())
|
.map(res => res.json())
|
||||||
.do(request => console.info("Insert Response:"+request.status) )
|
.do(request => console.info("Insert Response:"+request.status) )
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
|
|
|
@ -10,9 +10,9 @@ import { Meta} from '../../../angular2-meta';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'directLinking',
|
selector: 'directLinking',
|
||||||
template: `
|
template: `
|
||||||
<div class="container uk-margin-top">
|
<div class="uk-container uk-margin-top">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1>Linking</h1>
|
<h2>Linking</h2>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="validInput != null && !validInput" class="uk-alert uk-alert-warning" role="alert">No valid arguments provided in order to start linking openAIRE entities. </div>
|
<div *ngIf="validInput != null && !validInput" class="uk-alert uk-alert-warning" role="alert">No valid arguments provided in order to start linking openAIRE entities. </div>
|
||||||
<div *ngIf="validInput != null && validInput">
|
<div *ngIf="validInput != null && validInput">
|
||||||
|
|
|
@ -87,8 +87,7 @@ private insertActions(){
|
||||||
}else{
|
}else{
|
||||||
this.claiming = true;
|
this.claiming = true;
|
||||||
var user=Session.getUserEmail();
|
var user=Session.getUserEmail();
|
||||||
var token=Session.getUserJwt();
|
this.loading.open();
|
||||||
this.loading.open();
|
|
||||||
var claims = [];
|
var claims = [];
|
||||||
var directclaims = [];
|
var directclaims = [];
|
||||||
if(this.results){
|
if(this.results){
|
||||||
|
@ -122,12 +121,12 @@ private insertActions(){
|
||||||
}
|
}
|
||||||
//first call direct index service - when call is done (success or error) call isertBulkClaims method to insert claims in DB
|
//first call direct index service - when call is done (success or error) call isertBulkClaims method to insert claims in DB
|
||||||
console.info("\n\ndirectclaims: "+directclaims.length+"\n\n");
|
console.info("\n\ndirectclaims: "+directclaims.length+"\n\n");
|
||||||
this.claimService.insertDirectRecords(directclaims,token).subscribe(
|
this.claimService.insertDirectRecords(directclaims).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.insertedRecords = data.insertedIds;
|
this.insertedRecords = data.insertedIds;
|
||||||
|
|
||||||
this.errorInRecords = data.errorInClaims;
|
this.errorInRecords = data.errorInClaims;
|
||||||
this.isertBulkClaims(claims,token);
|
this.isertBulkClaims(claims);
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
err=err.json();
|
err=err.json();
|
||||||
|
@ -137,7 +136,7 @@ private insertActions(){
|
||||||
if(err.errorInClaims && err.errorInClaims.length >0){
|
if(err.errorInClaims && err.errorInClaims.length >0){
|
||||||
this.errorInRecords = err.errorInClaims;
|
this.errorInRecords = err.errorInClaims;
|
||||||
}
|
}
|
||||||
this.isertBulkClaims(claims,token);
|
this.isertBulkClaims(claims);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -145,9 +144,9 @@ private insertActions(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private isertBulkClaims(claims,token){
|
private isertBulkClaims(claims){
|
||||||
console.info("try to insert "+claims.length+" claims");
|
console.info("try to insert "+claims.length+" claims");
|
||||||
this.claimService.insertBulkClaims(claims,token).subscribe(
|
this.claimService.insertBulkClaims(claims).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.insertedClaims = data.insertedIds;
|
this.insertedClaims = data.insertedIds;
|
||||||
this.errorInClaims = data.errorInClaims;
|
this.errorInClaims = data.errorInClaims;
|
||||||
|
|
|
@ -11,7 +11,7 @@ declare var UIkit:any;
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'linking-generic',
|
selector: 'linking-generic',
|
||||||
template: `
|
template: `
|
||||||
<div class="container uk-margin-top">
|
<div class="uk-container uk-margin-top">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1>Linking</h1>
|
<h1>Linking</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,9 +6,9 @@ import { Meta} from '../../../angular2-meta';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-claims',
|
selector: 'my-claims',
|
||||||
template: `
|
template: `
|
||||||
<div class="container uk-margin-top">
|
<div class="uk-container uk-margin-top">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1> My Linked research resutls</h1>
|
<h2> My Linked research resutls</h2>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="uk-text-right"><a routerLink="/participate/claim">Add more Links?</a></div>
|
<div class="uk-text-right"><a routerLink="/participate/claim">Add more Links?</a></div>
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'deposit-by-subject',
|
selector: 'deposit-by-subject',
|
||||||
template: `
|
template: `
|
||||||
<div class="container uk-margin-top">
|
<div class="uk-margin-top">
|
||||||
|
|
||||||
<h3>Or search for Data providers via Classifications</h3>
|
<h3>Or search for Data providers via Classifications</h3>
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {RouterHelper} from '../../utils/routerHelper.class';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'deposit-by-subject-result',
|
selector: 'deposit-by-subject-result',
|
||||||
template: `
|
template: `
|
||||||
<div class="container uk-margin-top">
|
<div class="uk-container uk-margin-top">
|
||||||
<div class="page-header" >
|
<div class="page-header" >
|
||||||
<h2>Deposit {{requestFor}}</h2>
|
<h2>Deposit {{requestFor}}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
@ -28,7 +28,7 @@ import {RouterHelper} from '../../utils/routerHelper.class';
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<div *ngIf="subject.length > 0" class=" uk-text-center ">
|
<div *ngIf="subject.length > 0" class=" uk-text-center ">
|
||||||
<span>Keywords: <span><a class="uk-icon-button" (click) = "subject = ''"><span aria-hidden="true" class=" clickable "><span class="clickable uk-icon">
|
<span>Keywords: {{subject}}<span><a class="uk-icon-button" (click) = "subject = ''"><span aria-hidden="true" class=" clickable "><span class="clickable uk-icon">
|
||||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
||||||
</span></span></a></span>
|
</span></span></a></span>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -3,8 +3,10 @@ import {Component} from '@angular/core';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'deposit-datasets',
|
selector: 'deposit-datasets',
|
||||||
template: `
|
template: `
|
||||||
|
<div class="uk-container">
|
||||||
<deposit [compatibility]="'openaire____::21f8a223b9925c2f87c404096080b046||Registry of Research Data Repository'" [requestFor]="'Research Data'"></deposit>
|
<deposit [compatibility]="'openaire____::21f8a223b9925c2f87c404096080b046||Registry of Research Data Repository'" [requestFor]="'Research Data'"></deposit>
|
||||||
<deposit-by-subject [compatibility]="'openaire____::21f8a223b9925c2f87c404096080b046||Registry of Research Data Repository'" [requestFor]="'Research Data'" ></deposit-by-subject>
|
<deposit-by-subject [compatibility]="'openaire____::21f8a223b9925c2f87c404096080b046||Registry of Research Data Repository'" [requestFor]="'Research Data'" ></deposit-by-subject>
|
||||||
|
<div>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { Meta} from '../../angular2-meta';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'deposit',
|
selector: 'deposit',
|
||||||
template: `
|
template: `
|
||||||
<div class="container uk-margin-top">
|
<div class="uk-margin-top">
|
||||||
<div class="page-header" >
|
<div class="page-header" >
|
||||||
<h2>Deposit {{requestFor}}</h2>
|
<h2>Deposit {{requestFor}}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {RouterHelper} from '../utils/routerHelper.class';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'deposit-result',
|
selector: 'deposit-result',
|
||||||
template: `
|
template: `
|
||||||
<div class="container uk-margin-top">
|
<div class="uk-container uk-margin-top">
|
||||||
<div class="page-header" >
|
<div class="page-header" >
|
||||||
<h2>Deposit {{requestFor}}</h2>
|
<h2>Deposit {{requestFor}}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,11 +3,13 @@ import {Component} from '@angular/core';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'deposit-publications',
|
selector: 'deposit-publications',
|
||||||
template: `
|
template: `
|
||||||
|
<div class="uk-container">
|
||||||
<deposit [compatibility]="'openaire____::47ce9e9f4fad46e732cff06419ecaabb||OpenDOAR'" [requestFor]="'Publications'"></deposit>
|
<deposit [compatibility]="'openaire____::47ce9e9f4fad46e732cff06419ecaabb||OpenDOAR'" [requestFor]="'Publications'"></deposit>
|
||||||
<h3>Or locate data provider in map</h3>
|
<h3>Or locate data provider in map</h3>
|
||||||
<div class="uk-margin-top">
|
<div class="uk-margin-top">
|
||||||
<i-frame [url]="mapUrl"width="100%" height="900"></i-frame>
|
<i-frame [url]="mapUrl"width="100%" height="900"></i-frame>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@ import { Meta} from '../../angular2-meta';
|
||||||
selector: 'error',
|
selector: 'error',
|
||||||
template: `
|
template: `
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>
|
<h2>
|
||||||
Bad karma: we can't find that page!
|
Bad karma: we can't find that page!
|
||||||
</h1>
|
</h2>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -9,14 +9,7 @@
|
||||||
<div class="uk-text-large " *ngIf="organizationInfo.title.name && organizationInfo.title.name != organizationInfo.name ">{{organizationInfo.name}}</div>
|
<div class="uk-text-large " *ngIf="organizationInfo.title.name && organizationInfo.title.name != organizationInfo.name ">{{organizationInfo.name}}</div>
|
||||||
<span class="uk-label custom-label label-blue " title="Type">Organization</span>
|
<span class="uk-label custom-label label-blue " title="Type">Organization</span>
|
||||||
<span *ngIf="organizationInfo.country" class="uk-label custom-label label-grey " title="Country">{{organizationInfo.country}}</span>
|
<span *ngIf="organizationInfo.country" class="uk-label custom-label label-grey " title="Country">{{organizationInfo.country}}</span>
|
||||||
|
|
||||||
<!--dl class="uk-description-list">
|
|
||||||
<dt *ngIf="organizationInfo.name">Name: </dt>
|
|
||||||
<dd *ngIf="organizationInfo.name">{{organizationInfo.name}}</dd>
|
|
||||||
<dt *ngIf="organizationInfo.country">Country: </dt>
|
|
||||||
<dd *ngIf="organizationInfo.country">{{organizationInfo.country}}</dd>
|
|
||||||
</dl-->
|
|
||||||
|
|
||||||
<ul class="uk-tab uk-visible@m" uk-tab="connect: #tab-content">
|
<ul class="uk-tab uk-visible@m" uk-tab="connect: #tab-content">
|
||||||
<li (click)="activeTab='Publications'">
|
<li (click)="activeTab='Publications'">
|
||||||
<a>
|
<a>
|
||||||
|
@ -31,7 +24,7 @@
|
||||||
Projects
|
Projects
|
||||||
<span class="uk-badge uk-badge-notification">
|
<span class="uk-badge uk-badge-notification">
|
||||||
<!--{{(searchingProjectsTabComponent)?searchingProjectsTabComponent.fetchProjects.totalResults:0}}-->
|
<!--{{(searchingProjectsTabComponent)?searchingProjectsTabComponent.fetchProjects.totalResults:0}}-->
|
||||||
{{fetchProjects.totalResults}}
|
{{fetchProjects.searchUtils.totalResultsNoFilters}}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -66,7 +59,7 @@
|
||||||
<a>
|
<a>
|
||||||
Projects
|
Projects
|
||||||
<span class="uk-badge uk-badge-notification">
|
<span class="uk-badge uk-badge-notification">
|
||||||
{{fetchProjects.totalResults}}
|
{{fetchProjects.searchUtils.totalResultsNoFilters}}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -101,7 +94,7 @@
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="uk-animation-fade">
|
<li class="uk-animation-fade">
|
||||||
<searchingProjectsTab *ngIf="projectsClicked" [fetchProjects]="fetchProjects"></searchingProjectsTab>
|
<searchingProjectsTab *ngIf="projectsClicked" [(fetchProjects)]="fetchProjects" [organizationId]="organizationId"></searchingProjectsTab>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="uk-animation-fade">
|
<li class="uk-animation-fade">
|
||||||
|
|
|
@ -88,6 +88,7 @@ export class OrganizationComponent {
|
||||||
this.organizationInfo=null;
|
this.organizationInfo=null;
|
||||||
this.updateTitle("Organization");
|
this.updateTitle("Organization");
|
||||||
this.updateDescription("Organization, country, projects, search, repositories, open access");
|
this.updateDescription("Organization, country, projects, search, repositories, open access");
|
||||||
|
this.projectsClicked = false;
|
||||||
|
|
||||||
this.organizationId = params['organizationId'];
|
this.organizationId = params['organizationId'];
|
||||||
console.info("Id is :"+this.organizationId);
|
console.info("Id is :"+this.organizationId);
|
||||||
|
@ -135,13 +136,8 @@ export class OrganizationComponent {
|
||||||
var refineFields:string [] = ["funderid"];
|
var refineFields:string [] = ["funderid"];
|
||||||
|
|
||||||
this.searchPublications();
|
this.searchPublications();
|
||||||
//this.fetchProjects.getNumForEntity("organization", this.organizationId);
|
|
||||||
this.fetchProjects.getResultsForOrganizations(this.organizationId, "", 1, 0,refineFields);
|
this.fetchProjects.getResultsForOrganizations(this.organizationId, "", 1, 0,refineFields);
|
||||||
if(this.fetchProjects.searchUtils.totalResults > 0) {
|
|
||||||
//this.activeTab = "Projects";
|
|
||||||
} else {
|
|
||||||
//this.searchDataprovidersInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fetchDataproviders.getNumForEntity("organization", this.organizationId);
|
this.fetchDataproviders.getNumForEntity("organization", this.organizationId);
|
||||||
|
|
||||||
|
@ -296,7 +292,7 @@ export class OrganizationComponent {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
title = true;
|
title = true;
|
||||||
|
|
||||||
this._reportsService.getCSVResponse(url).subscribe(
|
this._reportsService.getCSVResponse(url).subscribe(
|
||||||
data =>
|
data =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,10 +20,10 @@ import {RouterHelper} from '../utils/routerHelper.class';
|
||||||
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.LOADING" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">Loading...</div>
|
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.LOADING" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">Loading...</div>
|
||||||
|
|
||||||
<div *ngIf="fetchProjects.searchUtils.totalResults > 0">
|
<div *ngIf="fetchProjects.searchUtils.totalResults > 0">
|
||||||
<div class = "uk-text-right" *ngIf = "fetchProjects.totalResults > 10">
|
<div class = "uk-text-right" *ngIf = "fetchProjects.searchUtils.totalResultsNoFilters > 10">
|
||||||
<a [queryParams]="routerHelper.createQueryParams(['organizationId', 'or'], [organizationId, 'and'])"
|
<a [queryParams]="routerHelper.createQueryParams(['organizationId', 'or'], [organizationId, 'and'])"
|
||||||
routerLinkActive="router-link-active" [routerLink]="linkToSearchProjects">
|
routerLinkActive="router-link-active" [routerLink]="linkToSearchProjects">
|
||||||
View all {{fetchProjects.totalResults}} results
|
View all {{fetchProjects.searchUtils.totalResultsNoFilters}} results
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class= "searchPaging uk-panel uk-margin-top">
|
<div class= "searchPaging uk-panel uk-margin-top">
|
||||||
|
@ -41,7 +41,7 @@ import {RouterHelper} from '../utils/routerHelper.class';
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li *ngIf = "fetchProjects.searchUtils.totalResults !=fetchProjects.totalResults "> Filtered {{fetchProjects.searchUtils.totalResults}} results of {{fetchProjects.totalResults}} total results</li>
|
<li *ngIf = "fetchProjects.searchUtils.totalResults !=fetchProjects.searchUtils.totalResultsNoFilters "> Filtered {{fetchProjects.searchUtils.totalResults}} results of {{fetchProjects.searchUtils.totalResultsNoFilters}} total results</li>
|
||||||
<li></li>
|
<li></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -55,12 +55,11 @@ import {RouterHelper} from '../utils/routerHelper.class';
|
||||||
|
|
||||||
export class SearchingProjectsTabComponent {
|
export class SearchingProjectsTabComponent {
|
||||||
@Input() fetchProjects : FetchProjects;
|
@Input() fetchProjects : FetchProjects;
|
||||||
public organizationId:string = "";
|
@Input() organizationId:string = "";
|
||||||
public page :number = 1;
|
public page :number = 1;
|
||||||
public size :number = 10;
|
public size :number = 10;
|
||||||
public linkToSearchProjects;
|
public linkToSearchProjects;
|
||||||
private filterQuery:string = "";
|
private filterQuery:string = "";
|
||||||
private sub: any;
|
|
||||||
|
|
||||||
public routerHelper:RouterHelper = new RouterHelper();
|
public routerHelper:RouterHelper = new RouterHelper();
|
||||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
|
@ -71,23 +70,15 @@ export class SearchingProjectsTabComponent {
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
|
||||||
this.organizationId = params['organizationId'];
|
|
||||||
|
|
||||||
if(this.organizationId) {
|
if(this.organizationId) {
|
||||||
//this.fetchProjects = new FetchProjects(this._searchProjectsService);
|
|
||||||
|
|
||||||
this.linkToSearchProjects = OpenaireProperties.getLinkToAdvancedSearchProjects();//+"?organization="+this.organizationId+"or=and";;
|
this.linkToSearchProjects = OpenaireProperties.getLinkToAdvancedSearchProjects();//+"?organization="+this.organizationId+"or=and";;
|
||||||
if(this.fetchProjects.searchUtils.totalResults > 0) {
|
if(this.fetchProjects.searchUtils.totalResults > 0) {
|
||||||
this.search(false,"");
|
this.search(false,"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.sub.unsubscribe();
|
|
||||||
}
|
|
||||||
|
|
||||||
search(refine:boolean, filterQuery:string){
|
search(refine:boolean, filterQuery:string){
|
||||||
var refineFields:string [] = ["funderid"];
|
var refineFields:string [] = ["funderid"];
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
import {Injectable} from '@angular/core';
|
|
||||||
import {Http, Response, Headers, RequestOptions, URLSearchParams} from '@angular/http';
|
|
||||||
import {Observable} from 'rxjs/Observable';
|
|
||||||
import 'rxjs/add/observable/of';
|
|
||||||
import 'rxjs/add/operator/do';
|
|
||||||
import 'rxjs/add/operator/share';
|
|
||||||
|
|
||||||
import { CacheService } from '../shared/cache.service';
|
|
||||||
import {OpenaireProperties} from '../utils/properties/openaireProperties';
|
|
||||||
import {User,Session,MyJWT} from './utils/helper.class';
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class LoginService {
|
|
||||||
|
|
||||||
constructor(private http: Http, public _cache: CacheService) {}
|
|
||||||
|
|
||||||
authenticate (username: string, password: string):any {
|
|
||||||
|
|
||||||
|
|
||||||
let headers = new Headers({ 'Content-Type': 'application/json' });
|
|
||||||
let options = new RequestOptions({ headers: headers });
|
|
||||||
let body = JSON.stringify( {"username":username, "password":password} );
|
|
||||||
|
|
||||||
return this.http.post(OpenaireProperties.getLoginAPIURL(), body,options)
|
|
||||||
.map(res => <any> res.json())
|
|
||||||
.map(res =>this.parse(res['data']));
|
|
||||||
|
|
||||||
|
|
||||||
// let url = OpenaireProperties.getLoginAPIURL()+"?username="+username+"&password="+password;
|
|
||||||
// let key = url;
|
|
||||||
// return this.http.get(url)
|
|
||||||
// .map(res => <any> res.json())
|
|
||||||
// .map(res =>this.parse(res['data']));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
parse(data:any){
|
|
||||||
return MyJWT.parseUserInfo(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -13,7 +13,6 @@ export class LoginGuard implements CanActivate {
|
||||||
var user;
|
var user;
|
||||||
var loggedIn = false;
|
var loggedIn = false;
|
||||||
var errorCode = ErrorCodes.NOT_LOGGIN;
|
var errorCode = ErrorCodes.NOT_LOGGIN;
|
||||||
|
|
||||||
if(Session.isLoggedIn()){
|
if(Session.isLoggedIn()){
|
||||||
loggedIn = true;
|
loggedIn = true;
|
||||||
if(!Session.isValidAndRemove()){
|
if(!Session.isValidAndRemove()){
|
||||||
|
|
|
@ -2,10 +2,11 @@ import {Component, ElementRef} from '@angular/core';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
|
|
||||||
import {LoginService} from './login.service';
|
// import {LoginService} from './login.service';
|
||||||
import {User,Session} from './utils/helper.class';
|
import {User,Session} from './utils/helper.class';
|
||||||
import {RouterHelper} from '../utils/routerHelper.class';
|
import {RouterHelper} from '../utils/routerHelper.class';
|
||||||
import { Meta} from '../../angular2-meta';
|
import { Meta} from '../../angular2-meta';
|
||||||
|
import {OpenaireProperties} from '../utils/properties/openaireProperties';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'user',
|
selector: 'user',
|
||||||
|
@ -14,7 +15,7 @@ import { Meta} from '../../angular2-meta';
|
||||||
<div *ngIf="!server" class="uk-margin-top uk-container uk-container-small uk-position-relative">
|
<div *ngIf="!server" class="uk-margin-top uk-container uk-container-small uk-position-relative">
|
||||||
|
|
||||||
|
|
||||||
<form *ngIf="!loggedIn" class=" ">
|
<!--form *ngIf="!loggedIn" class=" ">
|
||||||
|
|
||||||
<h3>Welcome to OpenAIRE's Discover/ Share Portal</h3>
|
<h3>Welcome to OpenAIRE's Discover/ Share Portal</h3>
|
||||||
|
|
||||||
|
@ -32,15 +33,21 @@ import { Meta} from '../../angular2-meta';
|
||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
<button (click)="login()" class=" uk-button uk-button-primary">Login</button>
|
<button (click)="login()" class=" uk-button uk-button-primary">Login</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form-->
|
||||||
<div *ngIf="errorCode == '1'" class="uk-alert uk-alert-warning">
|
<div *ngIf="errorCode == '1'" class="uk-alert uk-alert-warning">
|
||||||
The requested page requires authentication. Please login.
|
The requested page requires authentication. Please sign in.
|
||||||
|
<span *ngIf="!loggedIn">
|
||||||
|
<a class="loginLink" [href]="loginUrl" >Sign in</a>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="errorCode == '2'" class="uk-alert uk-alert-warning">
|
<div *ngIf="errorCode == '2'" class="uk-alert uk-alert-warning">
|
||||||
You are not authorized to use the requested page
|
You are not authorized to use the requested page
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="errorCode == '3'" class="uk-alert uk-alert-warning">
|
<div *ngIf="errorCode == '3'" class="uk-alert uk-alert-warning">
|
||||||
The session has expired. Please log in again or continue <a (click)="redirect();">browsing as a guest</a>.
|
The session has expired. Please sign in again or continue <a (click)="redirect();">browsing as a guest</a>.
|
||||||
|
<span *ngIf="!loggedIn">
|
||||||
|
<a class="loginLink" [href]="loginUrl" >Sign in</a>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!loggedIn && errorMessage.length > 0" class="uk-alert uk-alert-danger">{{errorMessage}}</div>
|
<div *ngIf="!loggedIn && errorMessage.length > 0" class="uk-alert uk-alert-danger">{{errorMessage}}</div>
|
||||||
|
|
||||||
|
@ -65,8 +72,9 @@ export class UserComponent {
|
||||||
public errorCode: string = "";
|
public errorCode: string = "";
|
||||||
public redirectUrl: string = "";
|
public redirectUrl: string = "";
|
||||||
public routerHelper:RouterHelper = new RouterHelper();
|
public routerHelper:RouterHelper = new RouterHelper();
|
||||||
|
public loginUrl= OpenaireProperties.getLoginURL();
|
||||||
|
|
||||||
constructor( private router: Router, private _loginService: LoginService,
|
constructor( private router: Router,
|
||||||
private route: ActivatedRoute, private _meta: Meta ) {
|
private route: ActivatedRoute, private _meta: Meta ) {
|
||||||
this._meta.setTitle("Login | OpenAIRE");
|
this._meta.setTitle("Login | OpenAIRE");
|
||||||
}
|
}
|
||||||
|
@ -128,29 +136,29 @@ export class UserComponent {
|
||||||
this.router.navigate(['/search/find']);
|
this.router.navigate(['/search/find']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
login() {
|
// login() {
|
||||||
this.sublogin =this._loginService.authenticate(/*this.user*/this.username, this.password).subscribe(
|
// this.sublogin =this._loginService.authenticate(/*this.user*/this.username, this.password).subscribe(
|
||||||
data => {
|
// data => {
|
||||||
this.user = data;
|
// this.user = data;
|
||||||
this.loggedIn = true;
|
// this.loggedIn = true;
|
||||||
this.username = "";
|
// this.username = "";
|
||||||
this.password = "";
|
// this.password = "";
|
||||||
this.errorCode = "";
|
// this.errorCode = "";
|
||||||
this.redirect();
|
// this.redirect();
|
||||||
|
//
|
||||||
},
|
// },
|
||||||
err => {
|
// err => {
|
||||||
console.log(err);
|
// console.log(err);
|
||||||
if(err.status == "404") {
|
// if(err.status == "404") {
|
||||||
this.errorMessage = "Wrong username";
|
// this.errorMessage = "Wrong username";
|
||||||
} else if(err.status == "401") {
|
// } else if(err.status == "401") {
|
||||||
this.errorMessage = "Wrong password";
|
// this.errorMessage = "Wrong password";
|
||||||
}
|
// }
|
||||||
this.username = "";
|
// this.username = "";
|
||||||
this.password = "";
|
// this.password = "";
|
||||||
this.errorCode = "";
|
// this.errorCode = "";
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,14 @@ import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
import {UserComponent } from './user.component';
|
import {UserComponent } from './user.component';
|
||||||
import { UserRoutingModule } from './user-routing.module';
|
import { UserRoutingModule } from './user-routing.module';
|
||||||
import {LoginService} from './login.service';
|
// import {LoginService} from './login.service';
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule, FormsModule,
|
CommonModule, FormsModule,
|
||||||
UserRoutingModule
|
UserRoutingModule
|
||||||
|
|
||||||
],
|
],
|
||||||
providers:[LoginService],
|
// providers:[LoginService],
|
||||||
declarations: [
|
declarations: [
|
||||||
UserComponent
|
UserComponent
|
||||||
|
|
||||||
|
|
|
@ -2,17 +2,25 @@ import {Component, ElementRef} from '@angular/core';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {Location} from '@angular/common';
|
import {Location} from '@angular/common';
|
||||||
import {LoginService} from './login.service';
|
// import {LoginService} from './login.service';
|
||||||
import {User,Session} from './utils/helper.class';
|
import {User,Session} from './utils/helper.class';
|
||||||
import {RouterHelper} from '../utils/routerHelper.class';
|
import {RouterHelper} from '../utils/routerHelper.class';
|
||||||
|
import {OpenaireProperties} from '../utils/properties/openaireProperties';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'user-mini',
|
selector: 'user-mini',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<div *ngIf="!server" class=" custom-user-mini-panel uk-margin-top uk-margin-right uk-float-right">
|
<div *ngIf="!server" class=" custom-user-mini-panel uk-margin-top uk-margin-right uk-float-right">
|
||||||
<span *ngIf="loggedIn" ><a (click)="gotoUserPage();" >{{user.fullname}}</a></span>
|
<span *ngIf="loggedIn" >
|
||||||
<a *ngIf="!loggedIn" class="loginLink" (click)="gotoUserPage();" >Sign in</a>
|
<!--a (click)="gotoUserPage();" >{{user.fullname}}</a-->
|
||||||
|
<span>{{user.fullname}}</span> | <a class="loginLink" (click)="logOut();" >Log out</a>
|
||||||
|
</span>
|
||||||
|
<!--a *ngIf="!loggedIn" class="loginLink" (click)="gotoUserPage();" >Sign in</a-->
|
||||||
|
<span *ngIf="!loggedIn">
|
||||||
|
<a class="loginLink" [href]="loginUrl" >Sign in</a>
|
||||||
|
| <a class="loginLink" [href]="loginUrl" >Register</a>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
`
|
`
|
||||||
|
@ -23,6 +31,7 @@ export class UserMiniComponent {
|
||||||
public loggedIn: boolean = false;
|
public loggedIn: boolean = false;
|
||||||
public server: boolean = true;
|
public server: boolean = true;
|
||||||
public routerHelper:RouterHelper = new RouterHelper();
|
public routerHelper:RouterHelper = new RouterHelper();
|
||||||
|
public loginUrl= OpenaireProperties.getLoginURL();
|
||||||
|
|
||||||
public redirectUrl: string = "";
|
public redirectUrl: string = "";
|
||||||
private baseUrl = "user-info";
|
private baseUrl = "user-info";
|
||||||
|
@ -66,5 +75,12 @@ export class UserMiniComponent {
|
||||||
this.router.navigate([this.baseUrl]);
|
this.router.navigate([this.baseUrl]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
logOut(){
|
||||||
|
if(Session.isLoggedIn()){
|
||||||
|
Session.removeUser();
|
||||||
|
}
|
||||||
|
this.loggedIn = false;
|
||||||
|
this.user = new User();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,3 +16,4 @@ export class ErrorCodes {
|
||||||
public static NOT_VALID:number =3;
|
public static NOT_VALID:number =3;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
|
import {StringUtils} from '../../utils/string-utils.class';
|
||||||
|
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
||||||
|
|
||||||
|
|
||||||
export class User {
|
export class User {
|
||||||
email:string;
|
email:string;
|
||||||
username: string;
|
firstname: string;
|
||||||
|
lastname: string;
|
||||||
id: string;
|
id: string;
|
||||||
fullname: string;
|
fullname: string;
|
||||||
expirationDate: number;
|
expirationDate: number;
|
||||||
|
@ -10,16 +15,16 @@ export class User {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Session{
|
export class Session{
|
||||||
public static setUser(user:User): User {
|
// public static setUser(user:User): User {
|
||||||
|
//
|
||||||
localStorage.setItem("user", JSON.stringify(user));
|
// localStorage.setItem("user", JSON.stringify(user));
|
||||||
|
//
|
||||||
return user;
|
// return user;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public static removeUser() {
|
public static removeUser() {
|
||||||
if(Session.isLoggedIn()){
|
if(Session.isLoggedIn()){
|
||||||
localStorage.removeItem("user");
|
localStorage.removeItem("user");
|
||||||
|
COOKIE.deleteCookie(COOKIE.cookieName_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static getUser():User {
|
public static getUser():User {
|
||||||
|
@ -30,24 +35,53 @@ export class Session{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static isLoggedIn(): boolean {
|
public static isLoggedIn(): boolean {
|
||||||
|
|
||||||
var loggedIn:boolean = false;
|
var loggedIn:boolean = false;
|
||||||
var user:User = null;
|
var user:User = null;
|
||||||
|
var cookie= COOKIE.getCookie(COOKIE.cookieName_u);
|
||||||
if( typeof localStorage !== 'undefined') {
|
if( typeof localStorage !== 'undefined') {
|
||||||
if(localStorage.getItem("user")) {
|
if(localStorage.getItem("user")) {
|
||||||
user = JSON.parse(localStorage.getItem("user"));
|
user = JSON.parse(localStorage.getItem("user"));
|
||||||
if(user && user.id){
|
if(user && (user.fullname != null || user.lastname !=null || user.firstname !=null)){
|
||||||
|
|
||||||
loggedIn = true;
|
loggedIn = true;
|
||||||
|
}else if(cookie != null && this.getUserFromCookie()!= null){
|
||||||
|
loggedIn = true
|
||||||
}else{
|
}else{
|
||||||
loggedIn = false;
|
loggedIn = false;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
if(cookie != null && this.getUserFromCookie()!= null){
|
||||||
|
loggedIn = true
|
||||||
|
}else{
|
||||||
loggedIn = false;
|
loggedIn = false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
loggedIn = false;
|
loggedIn = false;
|
||||||
}
|
}
|
||||||
return loggedIn;
|
return loggedIn;
|
||||||
}
|
}
|
||||||
|
public static getUserFromCookie():User{
|
||||||
|
var cookie= COOKIE.getCookie(COOKIE.cookieName_u);
|
||||||
|
if(cookie != null){
|
||||||
|
var user:User = MyJWT.parseUserInfo(cookie);
|
||||||
|
if( typeof localStorage !== 'undefined') {
|
||||||
|
localStorage.setItem("user", JSON.stringify(user));
|
||||||
|
if(user && user.email){
|
||||||
|
COOKIE.deleteCookie(COOKIE.cookieName_u); // delete cookie to avoid transfer through requests
|
||||||
|
return user;
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
public static getUserJwt():string {
|
public static getUserJwt():string {
|
||||||
if(Session.isLoggedIn()){
|
if(Session.isLoggedIn()){
|
||||||
return Session.getUser().jwt;
|
return Session.getUser().jwt;
|
||||||
|
@ -74,7 +108,7 @@ export class Session{
|
||||||
if(Session.isLoggedIn()){
|
if(Session.isLoggedIn()){
|
||||||
var expires = Session.getUser().expirationDate;
|
var expires = Session.getUser().expirationDate;
|
||||||
var now = new Date().getTime() / 1000;
|
var now = new Date().getTime() / 1000;
|
||||||
console.log(" is still valid ? "+(now +0 < expires) +" Remaining:"+ (expires - (now+0))+ " now is:"+now + "expires at:"+expires);
|
// console.log(" is still valid ? "+(now +0 < expires) +" Remaining:"+ (expires - (now+0))+ " now is:"+now + "expires at:"+expires);
|
||||||
return now +0 < expires;
|
return now +0 < expires;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -95,32 +129,65 @@ export class Session{
|
||||||
}
|
}
|
||||||
export class MyJWT{
|
export class MyJWT{
|
||||||
private static validateJWTFormat(data){
|
private static validateJWTFormat(data){
|
||||||
|
if(data != null && (data.indexOf(".") !=-1 && data.split('.').length == 3)){
|
||||||
if(data == null || (data.indexOf(".") !=-1 && data.split('.').length != 3)){
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
private static getPayload(data){
|
private static getPayload(data){
|
||||||
var payload = data.split('.')[1];
|
var payload = data.split('.')[1];
|
||||||
return atob(payload);
|
return StringUtils.b64DecodeUnicode(payload);
|
||||||
}
|
}
|
||||||
public static parseUserInfo(data: any): User {
|
public static parseUserInfo(data: any): User {
|
||||||
if(this.validateJWTFormat(data)){
|
if(this.validateJWTFormat(data)){
|
||||||
var info = JSON.parse(this.getPayload(data));
|
var info = JSON.parse(this.getPayload(data));
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
var user: User = new User();
|
var user: User = new User();
|
||||||
|
|
||||||
user.username = info.sub;
|
user.firstname = (StringUtils.URIDecode(info.firstname)).replace("+"," ");
|
||||||
|
user.lastname = (StringUtils.URIDecode(info.lastname)).replace("+"," ");
|
||||||
user.email = info.email;
|
user.email = info.email;
|
||||||
user.id = info.userId;
|
// user.id = info.userId;
|
||||||
user.fullname = info.fullname;
|
user.fullname = (StringUtils.URIDecode(info.fullname)).replace("+"," ");
|
||||||
user.role = info.role;
|
user.role = info.role;;
|
||||||
user.jwt = data;
|
user.jwt = data;
|
||||||
user.expirationDate = info.exp;
|
user.expirationDate = info.exp;
|
||||||
localStorage.setItem("user", JSON.stringify(user));
|
localStorage.setItem("user", JSON.stringify(user));
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
export class COOKIE{
|
||||||
|
public static cookieName_u:string="XCsrfToken";
|
||||||
|
public static cookieName_id:string="AccessToken";
|
||||||
|
|
||||||
|
public static getCookie(name: string) : string {
|
||||||
|
if(typeof document == 'undefined'){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
let ca: Array<string> = document.cookie.split(';');
|
||||||
|
let caLen: number = ca.length;
|
||||||
|
let cookieName = `${name}=`;
|
||||||
|
let c: string;
|
||||||
|
|
||||||
|
for (let i: number = 0; i < caLen; i += 1) {
|
||||||
|
c = ca[i].replace(/^\s+/g, '');
|
||||||
|
if (c.indexOf(cookieName) == 0) {
|
||||||
|
return c.substring(cookieName.length, c.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public static deleteCookie(name) {
|
||||||
|
this.setCookie(name, '', -1);
|
||||||
|
}
|
||||||
|
public static setCookie(name: string, value: string, expireDays: number, path: string = '/') {
|
||||||
|
let d:Date = new Date();
|
||||||
|
d.setTime(d.getTime() + expireDays * 24 * 60 * 60 * 1000);
|
||||||
|
let expires:string = `expires=${d.toUTCString()}`;
|
||||||
|
// let cpath:string = path ? `; path=${path}` : '';
|
||||||
|
document.cookie = name+'='+value+'; path='+path+'; domain='+OpenaireProperties.getCookieDomain()+';';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import {ExportCSVComponent} from '../../utils/exportCSV.class';
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="OpenAIRE Content Providers"
|
<search-page pageTitle="OpenAIRE Content Providers"
|
||||||
|
formPlaceholderText = "Search for OpenAIRE Content Providers"
|
||||||
type="datasources" entityType="dataprovider" [(filters)] = "filters"
|
type="datasources" entityType="dataprovider" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||||
[baseUrl] = "baseUrl" [showResultCount]=false
|
[baseUrl] = "baseUrl" [showResultCount]=false
|
||||||
|
|
|
@ -16,6 +16,7 @@ import {ExportCSVComponent} from '../../utils/exportCSV.class';
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="Entity Registries"
|
<search-page pageTitle="Entity Registries"
|
||||||
|
formPlaceholderText = "Search for Entity Registries"
|
||||||
type="datasources" entityType="dataprovider" [(filters)] = "filters"
|
type="datasources" entityType="dataprovider" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||||
[baseUrl] = "baseUrl" [showResultCount]=false
|
[baseUrl] = "baseUrl" [showResultCount]=false
|
||||||
|
|
|
@ -16,6 +16,7 @@ import {ExportCSVComponent} from '../../utils/exportCSV.class';
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="OpenAIRE Journals"
|
<search-page pageTitle="OpenAIRE Journals"
|
||||||
|
formPlaceholderText = "Search for OpenAIRE Journals"
|
||||||
type="datasources" entityType="dataprovider" [(filters)] = "filters"
|
type="datasources" entityType="dataprovider" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||||
[baseUrl] = "baseUrl" [showResultCount]=false
|
[baseUrl] = "baseUrl" [showResultCount]=false
|
||||||
|
|
|
@ -27,17 +27,16 @@ import {RouterHelper} from '../../utils/routerHelper.class';
|
||||||
encapsulation: ViewEncapsulation.Emulated,
|
encapsulation: ViewEncapsulation.Emulated,
|
||||||
selector: 'search-find',
|
selector: 'search-find',
|
||||||
template: `
|
template: `
|
||||||
<div class="uk-margin-top">
|
<div class="">
|
||||||
<div class="page-header">
|
|
||||||
<h1>{{pageTitle}}</h1>
|
|
||||||
</div>
|
|
||||||
<div >
|
|
||||||
|
|
||||||
<div class="uk-width-1-1 uk-margin uk-padding uk-panel uk-background-muted">
|
<div class="uk-width-1-1 ">
|
||||||
|
<div class="uk-background-norepeat uk-background-cover uk-section uk-flex uk-flex-middle" style="background-image: url('./assets/formImageLight.jpg'); box-sizing: border-box; height: 250px">
|
||||||
<search-form [(keyword)]=keyword (keywordChange)="keywordChanged($event)"></search-form>
|
<div class="uk-width-1-1">
|
||||||
|
<search-form [(keyword)]=keyword (keywordChange)="keywordChanged($event)" placeholderText="Search for research results, projects, content providers, organizations in OpenAIRE information space"></search-form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class=" uk-margin-top uk-width-1-1">
|
<div class=" uk-margin-large-top uk-container">
|
||||||
|
|
||||||
<ul class=" uk-tab uk-visible@m" uk-tab="connect: #searchtabs; animation: uk-animation-fade">
|
<ul class=" uk-tab uk-visible@m" uk-tab="connect: #searchtabs; animation: uk-animation-fade">
|
||||||
<li (click)="searchPublications()" >
|
<li (click)="searchPublications()" >
|
||||||
|
@ -229,8 +228,7 @@ import {RouterHelper} from '../../utils/routerHelper.class';
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
`
|
||||||
`
|
|
||||||
})
|
})
|
||||||
export class SearchComponent {
|
export class SearchComponent {
|
||||||
public sub: any;
|
public sub: any;
|
||||||
|
@ -289,19 +287,10 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
|
||||||
this._meta.updateProperty("og:description", description);
|
this._meta.updateProperty("og:description", description);
|
||||||
this._meta.updateProperty("og:title", title);
|
this._meta.updateProperty("og:title", title);
|
||||||
this._meta.updateProperty("og:url", url);
|
this._meta.updateProperty("og:url", url);
|
||||||
// console.log("Constr PORT:"+process.env.PORT);
|
|
||||||
// if (typeof document !== 'undefined') {
|
|
||||||
//
|
|
||||||
// console.log("Constr Cookie:"+document.cookie);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ngOnInit() {
|
public ngOnInit() {
|
||||||
// console.log("init PORT:"+process.env.PORT);
|
|
||||||
// if (typeof document !== 'undefined') {
|
|
||||||
//
|
|
||||||
// console.log("Init Cookie:"+document.cookie);
|
|
||||||
// }
|
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
this.keyword = (params['keyword'])?params['keyword']:"";
|
this.keyword = (params['keyword'])?params['keyword']:"";
|
||||||
if(this.keyword !=null && this.keyword.length > 0){
|
if(this.keyword !=null && this.keyword.length > 0){
|
||||||
|
|
|
@ -14,9 +14,9 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
||||||
selector: 'advanced-search-page',
|
selector: 'advanced-search-page',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<div class="uk-margin-top">
|
<div class="uk-container uk-margin-top">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1>{{pageTitle}}</h1>
|
<h2>{{pageTitle}}</h2>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a *ngIf = "simpleSearchLink && simpleSearchLink.length > 0" routerLinkActive="router-link-active" [routerLink]=simpleSearchLink [class]="(disableForms)?'uk-float-right uk-disabled uk-link-muted':'uk-float-right'" >Simple search <span class="uk-icon">
|
<a *ngIf = "simpleSearchLink && simpleSearchLink.length > 0" routerLinkActive="router-link-active" [routerLink]=simpleSearchLink [class]="(disableForms)?'uk-float-right uk-disabled uk-link-muted':'uk-float-right'" >Simple search <span class="uk-icon">
|
||||||
|
|
|
@ -4,18 +4,23 @@ import {Observable} from 'rxjs/Observable';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-form',
|
selector: 'search-form',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<form [class]="(isDisabled)?'uk-margin uk-text-center uk-margin-top uk-disabled':'uk-margin uk-text-center uk-margin-top'">
|
<form [class]="(isDisabled)?'uk-margin uk-text-center uk-margin-top uk-disabled':'uk-margin uk-text-center uk-margin-top'">
|
||||||
<input type="text" class="uk-input uk-width-1-2" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
<input type="text" class="uk-input uk-width-1-2" [placeholder]="placeholderText" aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
||||||
<button (click)="keywordChanged()" type="submit" class=" uk-button uk-button-default"><span class="uk-icon">
|
<button (click)="keywordChanged()" type="submit" class=" uk-button uk-button-default"><span class="uk-icon">
|
||||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
|
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
|
||||||
</span>Search</button>
|
</span>Search</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
|
|
||||||
export class SearchFormComponent {
|
export class SearchFormComponent {
|
||||||
@Input() isDisabled: boolean = false;
|
@Input() isDisabled: boolean = false;
|
||||||
@Input() keyword: string = '';
|
@Input() keyword: string = '';
|
||||||
|
@Input() generalSearch: boolean = false;
|
||||||
|
@Input() placeholderText: string = "Type keywords";
|
||||||
|
|
||||||
@Output() keywordChange = new EventEmitter();
|
@Output() keywordChange = new EventEmitter();
|
||||||
|
|
||||||
|
|
|
@ -18,49 +18,54 @@ import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
selector: 'search-page',
|
selector: 'search-page',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<div class="uk-margin-top">
|
<div class="">
|
||||||
<div class="page-header">
|
<!--div class="page-header">
|
||||||
<h1>{{pageTitle}}</h1>
|
<h2>{{pageTitle}}</h2>
|
||||||
</div>
|
</div-->
|
||||||
<div>
|
<!--div class="uk-width-1-1 uk-margin uk-padding uk-panel uk-background-muted"-->
|
||||||
<div *ngIf="showRefine" >
|
<div class="uk-background-norepeat uk-background-cover uk-section uk-flex uk-flex-middle" style="background-image: url('./assets/formImage.jpg'); box-sizing: border-box; height: 250px">
|
||||||
<div class="uk-width-1-1 uk-margin uk-padding uk-panel uk-background-muted">
|
<div class="uk-width-1-1">
|
||||||
<search-form [isDisabled]="disableForms" [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)"></search-form>
|
<div class="uk-width-1-1">
|
||||||
<div *ngIf="isFiltered()" class = " uk-text-center ">
|
<search-form [isDisabled]="disableForms" [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)" [placeholderText]="formPlaceholderText"s></search-form>
|
||||||
<span *ngIf = "searchUtils.keyword.length > 0">Keywords: <span [innerHtml]="searchUtils.keyword"></span><a (click) = "clearKeywords() " [class]="(disableForms)?'uk-icon-button uk-disabled':'uk-icon-button'"><span class=" clickable " aria-hidden="true"><span class="uk-icon">
|
</div>
|
||||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
<div class="uk-width-1-1 uk-light">
|
||||||
</span></span></a>
|
<!--link to advanced search -->
|
||||||
</span>
|
<a *ngIf = "advancedSearchLink && advancedSearchLink.length > 0" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-float-right uk-light uk-disabled uk-link-muted':'uk-float-right uk-light'" [routerLink]=advancedSearchLink >More search options <span class="uk-icon">
|
||||||
<span *ngFor="let filter of filters " >
|
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
|
||||||
<span *ngIf = "filter.countSelectedValues > 0"> {{filter.title}}:
|
</span>
|
||||||
<span *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; " ><span [innerHtml]="value.name"></span><a (click) = "removeFilter(value, filter) " [class]="(disableForms)?'uk-icon-button uk-disabled':'uk-icon-button'"><span class=" clickable" aria-hidden="true"><span class="uk-icon">
|
</a>
|
||||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
<div *ngIf="isFiltered()" class = " uk-text-center ">
|
||||||
</span></span></a>
|
<span *ngIf = "searchUtils.keyword.length > 0">Keywords: <span [innerHtml]="searchUtils.keyword"></span><a (click) = "clearKeywords() " [class]="(disableForms)?'uk-icon-button uk-disabled':'uk-icon-button'"><span class=" clickable " aria-hidden="true"><span class="uk-icon">
|
||||||
<span *ngIf="!end">, </span>
|
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
||||||
|
</span></span></a>
|
||||||
|
</span>
|
||||||
|
<span *ngFor="let filter of filters " >
|
||||||
|
<span *ngIf = "filter.countSelectedValues > 0"> {{filter.title}}:
|
||||||
|
<span *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; " ><span [innerHtml]="value.name"></span><a (click) = "removeFilter(value, filter) " [class]="(disableForms)?'uk-icon-button uk-disabled':'uk-icon-button'"><span class=" clickable" aria-hidden="true"><span class="uk-icon">
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
||||||
|
</span></span></a>
|
||||||
|
<span *ngIf="!end">, </span>
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
|
||||||
|
|
||||||
<!--span>
|
<a (click)="clearFilters()" [class]="(disableForms)?'uk-disabled uk-link-muted':''">
|
||||||
Clear All
|
Clear All
|
||||||
<a (click)="clearFilters()" class="uk-icon-button uk-text-right"><span class="uk-icon">
|
</a>
|
||||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
</div>
|
||||||
</span></a></span-->
|
</div>
|
||||||
<a (click)="clearFilters()" [class]="(disableForms)?'uk-disabled uk-link-muted':''">
|
<div *ngIf= "showUnknownFilters" class = " uk-text-center uk-light">
|
||||||
Clear All
|
<a (click) = "clearFilters() " >Try new Query</a>
|
||||||
</a>
|
</div>
|
||||||
</div>
|
|
||||||
<div *ngIf= "showUnknownFilters" class = " uk-text-center ">
|
</div>
|
||||||
<a (click) = "clearFilters() " >Try new Query</a>
|
</div>
|
||||||
</div>
|
<div class="uk-container">
|
||||||
<a *ngIf = "advancedSearchLink && advancedSearchLink.length > 0" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-float-right uk-disabled uk-link-muted':'uk-float-right'" [routerLink]=advancedSearchLink >More search options <span class="uk-icon">
|
|
||||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
|
|
||||||
</span></a>
|
|
||||||
</div>
|
|
||||||
<div class="uk-grid uk-width-1-1 uk-margin">
|
<div class="uk-grid uk-width-1-1 uk-margin">
|
||||||
|
|
||||||
|
|
||||||
<div class="uk-offcanvas-content uk-hidden@m">
|
<div *ngIf="showRefine" class="uk-offcanvas-content uk-hidden@m">
|
||||||
|
|
||||||
<a href="#offcanvas-usage" uk-toggle><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="6" y="4" width="12" height="1"></rect><rect x="6" y="9" width="12" height="1"></rect><rect x="6" y="14" width="12" height="1"></rect><rect x="2" y="4" width="2" height="1"></rect><rect x="2" y="9" width="2" height="1"></rect><rect x="2" y="14" width="2" height="1"></rect></svg></a>
|
<a href="#offcanvas-usage" uk-toggle><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="6" y="4" width="12" height="1"></rect><rect x="6" y="9" width="12" height="1"></rect><rect x="6" y="14" width="12" height="1"></rect><rect x="2" y="4" width="2" height="1"></rect><rect x="2" y="9" width="2" height="1"></rect><rect x="2" y="14" width="2" height="1"></rect></svg></a>
|
||||||
|
|
||||||
|
@ -75,19 +80,14 @@ import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class=" search-filters uk-width-1-4@l uk-width-1-4@m uk-width-1-1@s uk-visible@m">
|
<div *ngIf="showRefine" class=" search-filters uk-width-1-4@l uk-width-1-4@m uk-width-1-1@s uk-visible@m">
|
||||||
<search-filter *ngFor="let filter of filters " [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (change)="filterChanged($event)" (toggleModal)="toggleModal($event)"></search-filter>
|
<search-filter *ngFor="let filter of filters " [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (change)="filterChanged($event)" (toggleModal)="toggleModal($event)"></search-filter>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="uk-width-3-4@m uk-width-3-4@l uk-width-1-1@s uk-first-column" >
|
<div [class]="(showRefine)?'uk-width-3-4@m uk-width-3-4@l uk-width-1-1@s uk-first-column':''" >
|
||||||
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
|
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
|
||||||
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
|
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
|
||||||
<!--p class="uk-text-right" *ngIf="totalResults <= 10000">
|
|
||||||
<span class="clickable" (click)="downloadfile(downloadURLAPI+type+'?format=csv&page=0&size='+totalResults+csvParams,type+'-report-'+totalResults)">
|
|
||||||
<span aria-hidden="true" class="glyphicon glyphicon-download"></span>
|
|
||||||
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="download" ratio="1"><polyline fill="none" stroke="#000" points="14,10 9.5,14.5 5,10"></polyline><rect x="3" y="17" width="13" height="1"></rect><line fill="none" stroke="#000" x1="9.5" y1="13.91" x2="9.5" y2="3"></line></svg></span> Results (CSV)
|
|
||||||
</span>
|
|
||||||
</p-->
|
|
||||||
<p *ngIf="tableViewLink" class="uk-text-right">
|
<p *ngIf="tableViewLink" class="uk-text-right">
|
||||||
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
|
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
|
||||||
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
|
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
|
||||||
|
@ -101,47 +101,20 @@ import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
[type]="entityType" [urlParam]="urlParam"
|
[type]="entityType" [urlParam]="urlParam"
|
||||||
[showLoading]="true">
|
[showLoading]="true">
|
||||||
</search-result>
|
</search-result>
|
||||||
<!--table-view *ngIf="tableView"
|
|
||||||
[results]="results"
|
|
||||||
[status]=searchUtils.status
|
|
||||||
[type]="entityType" [urlParam]="urlParam"
|
|
||||||
[showLoading]="true">
|
|
||||||
</table-view-->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div *ngIf="!showRefine" >
|
|
||||||
<search-form [isDisabled]="disableForms" [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)"></search-form>
|
|
||||||
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues"></search-paging>
|
|
||||||
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
|
|
||||||
<search-result *ngIf="!tableView"
|
|
||||||
[results]="results"
|
|
||||||
[status]=searchUtils.status
|
|
||||||
[type]="entityType" [urlParam]="urlParam"
|
|
||||||
[showLoading]="true">
|
|
||||||
</search-result>
|
|
||||||
<!--table-view *ngIf="tableView"
|
|
||||||
[results]="results"
|
|
||||||
[status]=searchUtils.status
|
|
||||||
[type]="entityType" [urlParam]="urlParam"
|
|
||||||
[showLoading]="true">
|
|
||||||
</table-view-->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--modal-loading [message]= "'Loading results...'"></modal-loading-->
|
|
||||||
|
|
||||||
<!--modal-search-filter [filter]="currentFilter" [showResultCount]=showResultCount (modalChange)="filterChanged($event)"></modal-search-filter-->
|
|
||||||
|
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class SearchPageComponent {
|
export class SearchPageComponent {
|
||||||
@Input() pageTitle = "";
|
@Input() pageTitle = "";
|
||||||
|
@Input() formPlaceholderText = "Type Keywords...";
|
||||||
@Input() results = [];
|
@Input() results = [];
|
||||||
@Input() filters = [];
|
@Input() filters = [];
|
||||||
@Input() type:string = "";
|
@Input() type:string = "";
|
||||||
|
|
|
@ -18,9 +18,9 @@ import {ContentProvidersDatatablePipe} from '../../utils/pipes/contentProvidersD
|
||||||
selector: 'search-page-table',
|
selector: 'search-page-table',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<div class="uk-margin-top">
|
<div class="uk-container uk-margin-top">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1>{{pageTitle}}</h1>
|
<h2>{{pageTitle}}</h2>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div *ngIf="showRefine" >
|
<div *ngIf="showRefine" >
|
||||||
|
|
|
@ -5,5 +5,6 @@ export class SearchUtilsClass{
|
||||||
keyword:string = "";
|
keyword:string = "";
|
||||||
baseUrl:string = "";
|
baseUrl:string = "";
|
||||||
totalResults = 0;
|
totalResults = 0;
|
||||||
|
totalResultsNoFilters:number; // for organization landing - tab with projects
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
||||||
selector: 'search-dataproviders',
|
selector: 'search-dataproviders',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="Search Dataproviders"
|
<search-page pageTitle="Search Content Providers"
|
||||||
|
formPlaceholderText = "Search for Content Providers"
|
||||||
type="data providers" entityType="dataprovider" [(filters)] = "filters"
|
type="data providers" entityType="dataprovider" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
|
[(results)] = "results" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
|
||||||
(queryChange)="queryChanged($event)" (downloadClick)="downloadClicked($event)"
|
(queryChange)="queryChanged($event)" (downloadClick)="downloadClicked($event)"
|
||||||
|
|
|
@ -15,7 +15,8 @@ import {DOI} from '../../utils/string-utils.class';
|
||||||
selector: 'search-datasets',
|
selector: 'search-datasets',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="Search Datasets"
|
<search-page pageTitle="Search Research Data"
|
||||||
|
formPlaceholderText = "Search for Research Data"
|
||||||
type="datasets" entityType="dataset" [(filters)] = "filters"
|
type="datasets" entityType="dataset" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||||
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)"
|
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)"
|
||||||
|
|
|
@ -14,6 +14,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="Search Organizations"
|
<search-page pageTitle="Search Organizations"
|
||||||
|
formPlaceholderText = "Search for Organizations"
|
||||||
type="organizations" entityType="organization" [(filters)] = "filters"
|
type="organizations" entityType="organization" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||||
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)"
|
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)"
|
||||||
|
|
|
@ -14,6 +14,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="Search Projects"
|
<search-page pageTitle="Search Projects"
|
||||||
|
formPlaceholderText = "Search for Projects"
|
||||||
type="projects" entityType="project" [(filters)] = "filters"
|
type="projects" entityType="project" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||||
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)"
|
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)"
|
||||||
|
|
|
@ -18,6 +18,7 @@ import {DOI} from '../../utils/string-utils.class';
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="Search Publications"
|
<search-page pageTitle="Search Publications"
|
||||||
|
formPlaceholderText = "Search for Publications"
|
||||||
type="publications" entityType="publication"
|
type="publications" entityType="publication"
|
||||||
[(filters)] = "filters" [(results)] = "results"
|
[(filters)] = "filters" [(results)] = "results"
|
||||||
[(searchUtils)] = "searchUtils" [(baseUrl)] = baseUrl
|
[(searchUtils)] = "searchUtils" [(baseUrl)] = baseUrl
|
||||||
|
|
|
@ -43,9 +43,9 @@ import {Session} from '../login/utils/helper.class';
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="uk-nav-header uk-parent">
|
<li class="uk-nav-header uk-parent">
|
||||||
Data Providers
|
Content Providers
|
||||||
<ul class="uk-nav-sub">
|
<ul class="uk-nav-sub">
|
||||||
<li><a routerLinkActive="uk-link" routerLink="/search/content-providers" class="uk-offcanvas-close custom-offcanvas-close" >Compatible Data Providers</a></li>
|
<li><a routerLinkActive="uk-link" routerLink="/search/content-providers" class="uk-offcanvas-close custom-offcanvas-close" >OpenAIRE Content Providers</a></li>
|
||||||
<li><a routerLinkActive="uk-link" routerLink="/search/entity-registries" class="uk-offcanvas-close custom-offcanvas-close" >Entity Registries</a></li>
|
<li><a routerLinkActive="uk-link" routerLink="/search/entity-registries" class="uk-offcanvas-close custom-offcanvas-close" >Entity Registries</a></li>
|
||||||
<li><a routerLinkActive="uk-link" routerLink="/search/journals" class="uk-offcanvas-close custom-offcanvas-close" >Journals</a></li>
|
<li><a routerLinkActive="uk-link" routerLink="/search/journals" class="uk-offcanvas-close custom-offcanvas-close" >Journals</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -140,12 +140,12 @@ import {Session} from '../login/utils/helper.class';
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="uk-parent">
|
<li class="uk-parent">
|
||||||
<a routerLinkActive="uk-link" routerLink="/search/content-providers" class="" aria-expanded="false">Data Providers</a>
|
<a routerLinkActive="uk-link" routerLink="/search/content-providers" class="" aria-expanded="false">Content Providers</a>
|
||||||
<div class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left" style="top: 80px; left: 113px;" id="dpMenu" (click)="onClick('dpMenu')">
|
<div class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left" style="top: 80px; left: 113px;" id="dpMenu" (click)="onClick('dpMenu')">
|
||||||
<div class="uk-navbar-dropdown-grid uk-child-width-1-1 uk-grid uk-grid-stack" uk-grid="">
|
<div class="uk-navbar-dropdown-grid uk-child-width-1-1 uk-grid uk-grid-stack" uk-grid="">
|
||||||
<div class="uk-first-column">
|
<div class="uk-first-column">
|
||||||
<ul class="uk-nav uk-navbar-dropdown-nav">
|
<ul class="uk-nav uk-navbar-dropdown-nav">
|
||||||
<li><a routerLinkActive="uk-link" routerLink="/search/content-providers">Compatible Data Providers</a></li>
|
<li><a routerLinkActive="uk-link" routerLink="/search/content-providers">OpenAIRE Content Providers</a></li>
|
||||||
<li><a routerLinkActive="uk-link" routerLink="/search/entity-registries">Entity Registries</a></li>
|
<li><a routerLinkActive="uk-link" routerLink="/search/entity-registries">Entity Registries</a></li>
|
||||||
<li><a routerLinkActive="uk-link" routerLink="/search/journals">Journals</a></li>
|
<li><a routerLinkActive="uk-link" routerLink="/search/journals">Journals</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -6,7 +6,6 @@ export class FetchProjects{
|
||||||
public results =[];
|
public results =[];
|
||||||
|
|
||||||
public filters; // for getResultsForOrganizations
|
public filters; // for getResultsForOrganizations
|
||||||
public totalResults; // for getResultsForOrganizations // this is total results with the initial query - before filtering
|
|
||||||
public funders:any = []; // for getResultsForOrganizations // this is filled with the initial query - before filtering
|
public funders:any = []; // for getResultsForOrganizations // this is filled with the initial query - before filtering
|
||||||
|
|
||||||
public sub: any;
|
public sub: any;
|
||||||
|
@ -144,8 +143,8 @@ export class FetchProjects{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.totalResults && filterquery == ""){
|
if(filterquery == ""){
|
||||||
this.totalResults = this.searchUtils.totalResults;
|
this.searchUtils.totalResultsNoFilters = this.searchUtils.totalResults;
|
||||||
this.funders = [];
|
this.funders = [];
|
||||||
for(var i = 0; i < this.filters.length; i++){
|
for(var i = 0; i < this.filters.length; i++){
|
||||||
console.log("this.filters[i].filterId:"+this.filters[i].filterId);
|
console.log("this.filters[i].filterId:"+this.filters[i].filterId);
|
||||||
|
|
|
@ -89,6 +89,12 @@ export class OpenaireProperties {
|
||||||
|
|
||||||
private static vocabulariesAPI ="https://beta.services.openaire.eu/provision/mvc/vocabularies/";
|
private static vocabulariesAPI ="https://beta.services.openaire.eu/provision/mvc/vocabularies/";
|
||||||
|
|
||||||
|
private static loginUrl ="http://mpagasas.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/openid_connect_login";
|
||||||
|
private static loginUrl_pm ="https://beta.services.openaire.eu/uoa-user-management/openid_connect_login";
|
||||||
|
|
||||||
|
private static cookieDomain =".di.uoa.gr";
|
||||||
|
private static cookieDomain_pm =".openaire.eu";
|
||||||
|
|
||||||
public static getBaseLink():string{
|
public static getBaseLink():string{
|
||||||
return this.baseLink;
|
return this.baseLink;
|
||||||
}
|
}
|
||||||
|
@ -308,6 +314,20 @@ export class OpenaireProperties {
|
||||||
public static getVocabulariesAPI():string{
|
public static getVocabulariesAPI():string{
|
||||||
return this.vocabulariesAPI;
|
return this.vocabulariesAPI;
|
||||||
}
|
}
|
||||||
|
public static getLoginURL():string{
|
||||||
|
if(this.productionMode){
|
||||||
|
return this.loginUrl_pm;
|
||||||
|
}else{
|
||||||
|
return this.loginUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static getCookieDomain():string{
|
||||||
|
if(this.productionMode){
|
||||||
|
return this.cookieDomain_pm;
|
||||||
|
}else{
|
||||||
|
return this.cookieDomain;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export class ErrorCodes {
|
export class ErrorCodes {
|
||||||
public LOADING = 0;
|
public LOADING = 0;
|
||||||
|
|
|
@ -119,4 +119,11 @@ export class StringUtils{
|
||||||
public static URIDecode(params: string):string {
|
public static URIDecode(params: string):string {
|
||||||
return decodeURIComponent(params);
|
return decodeURIComponent(params);
|
||||||
}
|
}
|
||||||
|
public static b64DecodeUnicode(str) {
|
||||||
|
return decodeURIComponent(Array.prototype.map.call(atob(str), function(c) {
|
||||||
|
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
||||||
|
}).join(''));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 109 KiB |
Binary file not shown.
After Width: | Height: | Size: 261 KiB |
Loading…
Reference in New Issue