Merge branch 'angular-14' of code-repo.d4science.org:MaDgIK/openaire-library into angular-14
This commit is contained in:
commit
10130d368a
|
@ -2,8 +2,10 @@ import {throwError as observableThrowError} from 'rxjs';
|
||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {HttpClient} from '@angular/common/http';
|
import {HttpClient} from '@angular/common/http';
|
||||||
import {ClaimEntity, ClaimResult} from '../claimHelper.class';
|
import {ClaimEntity, ClaimResult} from '../claimHelper.class';
|
||||||
import {map} from "rxjs/operators";
|
import {map, timeout} from "rxjs/operators";
|
||||||
import {EnvProperties} from "../../../utils/properties/env-properties";
|
import {EnvProperties} from "../../../utils/properties/env-properties";
|
||||||
|
import {properties} from "../../../../../environments/environment";
|
||||||
|
import {StringUtils} from "../../../utils/string-utils.class";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SearchCrossrefService {
|
export class SearchCrossrefService {
|
||||||
|
@ -20,7 +22,9 @@ export class SearchCrossrefService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
searchCrossrefByDOIs(DOIs: string[], properties: EnvProperties, parse: boolean = false): any {
|
searchCrossrefByDOIs(DOIs: string[], properties: EnvProperties, parse: boolean = false, file: boolean = false): any {
|
||||||
|
let timeoutTime: number = properties.environment == "production" ? 6000 : 12000;
|
||||||
|
// let timeoutTimeForFile: number = 60000;
|
||||||
|
|
||||||
var doisParams = "";
|
var doisParams = "";
|
||||||
for (var i = 0; i < DOIs.length; i++) {
|
for (var i = 0; i < DOIs.length; i++) {
|
||||||
|
@ -28,11 +32,21 @@ export class SearchCrossrefService {
|
||||||
}
|
}
|
||||||
let url = properties.searchCrossrefAPIURL + '?filter=' + doisParams;
|
let url = properties.searchCrossrefAPIURL + '?filter=' + doisParams;
|
||||||
return this.http.get(url)
|
return this.http.get(url)
|
||||||
//.map(request => <any> request.json().message)
|
// .pipe(timeout(file ? timeoutTimeForFile : (timeoutTime)))
|
||||||
.pipe(map(request => request['message']))
|
.pipe(timeout(timeoutTime))
|
||||||
.pipe(map(request => [request["total-results"], parse ? this.parse(request['items']) : request]))
|
.pipe(map(request => request['message']))
|
||||||
//.catch(this.handleError);
|
.pipe(map(request => [request["total-results"], parse ? this.parse(request['items']) : request]))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
searchCrossrefByDOI(DOI: string): any {
|
||||||
|
let timeoutTimeForFile: number = 20000;
|
||||||
|
|
||||||
|
let url = properties.searchCrossrefAPIURL + '/' + StringUtils.URIEncode(DOI);
|
||||||
|
return this.http.get(url)
|
||||||
|
.pipe(timeout(timeoutTimeForFile))
|
||||||
|
.pipe(map(request => request['message']))
|
||||||
|
.pipe(map(request => this.parse(request)))
|
||||||
|
}
|
||||||
searchCrossrefByMultipleDOIs(dois: string[], properties: EnvProperties, parse: boolean = false): any {
|
searchCrossrefByMultipleDOIs(dois: string[], properties: EnvProperties, parse: boolean = false): any {
|
||||||
let url = properties.searchCrossrefAPIURL + '?filter=doi:';
|
let url = properties.searchCrossrefAPIURL + '?filter=doi:';
|
||||||
for (var i = 0; i < dois.length; i++) {
|
for (var i = 0; i < dois.length; i++) {
|
||||||
|
@ -56,8 +70,11 @@ export class SearchCrossrefService {
|
||||||
|
|
||||||
parse(response): ClaimEntity[] {
|
parse(response): ClaimEntity[] {
|
||||||
const results: ClaimEntity[] = [];
|
const results: ClaimEntity[] = [];
|
||||||
for (let i = 0; i < response.length; i++) {
|
let length = Array.isArray(response) ? response.length : 1;
|
||||||
const item = response[i];
|
|
||||||
|
for (let i = 0; i < length; i++) {
|
||||||
|
const item = Array.isArray(response) ? response[i] : response;
|
||||||
|
|
||||||
const entity: ClaimEntity = new ClaimEntity();
|
const entity: ClaimEntity = new ClaimEntity();
|
||||||
entity.result = new ClaimResult();
|
entity.result = new ClaimResult();
|
||||||
entity.result.publisher = null;
|
entity.result.publisher = null;
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {Injectable} from '@angular/core';
|
||||||
import {HttpClient} from '@angular/common/http';
|
import {HttpClient} from '@angular/common/http';
|
||||||
import {EnvProperties} from '../../../utils/properties/env-properties';
|
import {EnvProperties} from '../../../utils/properties/env-properties';
|
||||||
import {ClaimEntity, ClaimResult} from '../claimHelper.class';
|
import {ClaimEntity, ClaimResult} from '../claimHelper.class';
|
||||||
import {catchError, map} from 'rxjs/operators';
|
import {catchError, map, timeout} from 'rxjs/operators';
|
||||||
import {properties} from "../../../../../environments/environment";
|
import {properties} from "../../../../../environments/environment";
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,10 +21,14 @@ export class SearchDataciteService {
|
||||||
//.catch(this.handleError);
|
//.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
getDataciteResultByDOI(doi: string, properties: EnvProperties, parse: boolean = false): any {
|
getDataciteResultByDOI(doi: string, properties: EnvProperties, parse: boolean = false, file: boolean = false): any {
|
||||||
|
let timeoutTime: number = properties.environment == "production" ? 6000 : 12000;
|
||||||
|
let timeoutTimeForFile: number = 20000;
|
||||||
|
|
||||||
let url = properties.searchDataciteAPIURL + '/' + doi;
|
let url = properties.searchDataciteAPIURL + '/' + doi;
|
||||||
let key = url;
|
let key = url;
|
||||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||||
|
.pipe(timeout(file ? timeoutTimeForFile : (timeoutTime)))
|
||||||
.pipe(map(request => (parse ? SearchDataciteService.parse([request["data"]])[0] : request)), catchError(err => of(null)));
|
.pipe(map(request => (parse ? SearchDataciteService.parse([request["data"]])[0] : request)), catchError(err => of(null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,16 @@ declare var UIkit: any;
|
||||||
<div>
|
<div>
|
||||||
<!--div class="uk-text-lead">Upload a DOI csv file <helper div="link-result-bulk" tooltip=true ></helper></div>
|
<!--div class="uk-text-lead">Upload a DOI csv file <helper div="link-result-bulk" tooltip=true ></helper></div>
|
||||||
<label for="exampleInputFile">Select a file: </label-->
|
<label for="exampleInputFile">Select a file: </label-->
|
||||||
<div class="js-upload uk-float-left" uk-form-custom>
|
<div class="uk-float-left">
|
||||||
<input id="exampleInputFile" class="uk-width-medium" type="file" (change)="fileChangeEvent($event)"/>
|
<span class="js-upload" uk-form-custom>
|
||||||
<span class="uk-link " style="text-decoration: underline;">Upload a DOI's CSV file </span>
|
<input id="exampleInputFile" class="uk-width-medium" type="file" (change)="fileChangeEvent($event)"/>
|
||||||
|
<span class="uk-link " style="text-decoration: underline;">Upload a DOI's CSV file </span>
|
||||||
|
</span>
|
||||||
<!--button class="uk-button portal-button" type="button" tabindex="-1" [class.disabled]="!enableUpload" ><span class="uk-margin-small-right uk-icon" >
|
<!--button class="uk-button portal-button" type="button" tabindex="-1" [class.disabled]="!enableUpload" ><span class="uk-margin-small-right uk-icon" >
|
||||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <polyline fill="none" stroke="#000" points="5 8 9.5 3.5 14 8 "></polyline> <rect x="3" y="17" width="13" height="1"></rect>
|
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <polyline fill="none" stroke="#000" points="5 8 9.5 3.5 14 8 "></polyline> <rect x="3" y="17" width="13" height="1"></rect>
|
||||||
<line fill="none" stroke="#000" x1="9.5" y1="15" x2="9.5" y2="4"></line></svg></span> Select</button-->
|
<line fill="none" stroke="#000" x1="9.5" y1="15" x2="9.5" y2="4"></line></svg></span> Select</button-->
|
||||||
<!--helper div="link-result-bulk" tooltip=true ></helper-->
|
<!--helper div="link-result-bulk" tooltip=true ></helper-->
|
||||||
<span class=" " title="{{tooltip}}" uk-tooltip><span class="uk-icon" uk-icon="icon: info; ratio: 0.8"> </span> </span>
|
<span class=" " title="{{tooltip}}" uk-tooltip><span class="uk-icon" uk-icon="icon: info; ratio: 0.8"> </span> </span>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="showReport" uk-alert class="uk-alert-primary">
|
<div *ngIf="showReport" uk-alert class="uk-alert-primary">
|
||||||
<a class="uk-alert-close" uk-close></a>
|
<a class="uk-alert-close" uk-close></a>
|
||||||
|
@ -107,17 +109,16 @@ export class BulkClaimComponent {
|
||||||
exceedsLimit = false;
|
exceedsLimit = false;
|
||||||
@Input() basketLimit ;
|
@Input() basketLimit ;
|
||||||
tooltip = `
|
tooltip = `
|
||||||
<div class="uk-padding-small uk-padding-remove-right uk-padding-remove-left">
|
<div>
|
||||||
<div >
|
<div class="uk-margin-bottom">Up to 100 DOIs</div>
|
||||||
<div><span class="uk-text-bold">CSV format:</span> <br>"DOI","ACCESS_MODE","DATE"</div>
|
<div><span class="uk-text-bold">CSV format:</span> <br>"DOI","ACCESS_MODE","DATE"</div>
|
||||||
<br>
|
<br>
|
||||||
<div class=" uk-text-small">
|
<div class="uk-text-small">
|
||||||
<div>- DOI is required</div>
|
<div>- DOI is required</div>
|
||||||
<div>- Access mode: <br> OPEN, CLOSED, EMBARGO</div>
|
<div>- Access mode: <br> OPEN, CLOSED, EMBARGO</div>
|
||||||
<div>- Embargo end date:<br> YYYY-MM-DD </div>
|
<div>- Embargo end date:<br> YYYY-MM-DD </div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>`;
|
||||||
</div>`;
|
|
||||||
constructor(private _searchCrossrefService: SearchCrossrefService, private _searchDataciteService: SearchDataciteService) {
|
constructor(private _searchCrossrefService: SearchCrossrefService, private _searchDataciteService: SearchDataciteService) {
|
||||||
this.filesToUpload = [];
|
this.filesToUpload = [];
|
||||||
}
|
}
|
||||||
|
@ -247,11 +248,12 @@ export class BulkClaimComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchResult(id: string, accessMode: string, date: string, row: number) {
|
fetchResult(id: string, accessMode: string, date: string, row: number) {
|
||||||
this.subscriptions.push(this._searchCrossrefService.searchCrossrefByDOIs([id], this.properties, true).subscribe(
|
// this.subscriptions.push(this._searchCrossrefService.searchCrossrefByDOIs([id], this.properties, true, true).subscribe(
|
||||||
|
this.subscriptions.push(this._searchCrossrefService.searchCrossrefByDOI(id).subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
|
||||||
const result:ClaimEntity = data[1][0];
|
if (data.length > 0) {
|
||||||
if (data[1].length > 0) {
|
const result:ClaimEntity = data[0];
|
||||||
this.foundIds.push(id);
|
this.foundIds.push(id);
|
||||||
result.result.accessRights = accessMode;
|
result.result.accessRights = accessMode;
|
||||||
result.result.embargoEndDate = date;
|
result.result.embargoEndDate = date;
|
||||||
|
|
|
@ -18,6 +18,10 @@
|
||||||
</h2>
|
</h2>
|
||||||
<div class="uk-width-3-4@m" uk-scrollspy-class>
|
<div class="uk-width-3-4@m" uk-scrollspy-class>
|
||||||
We have developed a classification scheme for UN Sustainable Development Goals, to view contributions of research towards complex challenges for humanity such as climate change, biodiversity loss, pollution and poverty reduction.
|
We have developed a classification scheme for UN Sustainable Development Goals, to view contributions of research towards complex challenges for humanity such as climate change, biodiversity loss, pollution and poverty reduction.
|
||||||
|
|
||||||
|
<div class="uk-text-meta uk-margin-top">
|
||||||
|
For more information please visit <a href="https://www.openaire.eu/openaire-explore-introducing-sdgs-and-fos" target="_blank">https://www.openaire.eu/openaire-explore-introducing-sdgs-and-fos</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<!-- TODO: need a page for the description of the algorithm - to get us there from the learn more btn -->
|
<!-- TODO: need a page for the description of the algorithm - to get us there from the learn more btn -->
|
||||||
|
|
|
@ -60,7 +60,7 @@ declare var UIkit;
|
||||||
<label>{{placeholderInfo.label}} <sup *ngIf="required">*</sup></label>
|
<label>{{placeholderInfo.label}} <sup *ngIf="required">*</sup></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-flex" [class.uk-flex-middle]="type !== 'textarea'"
|
<div class="uk-flex" [class.uk-flex-middle]="type !== 'textarea'"
|
||||||
[attr.uk-tooltip]="(tooltip && !focused && type !== 'chips' && type !== 'textarea')?('title: ' + getTooltip(formControl.value ? (formControl.value) : (placeholderInfo?.static?placeholderInfo.label:hint)) + '; delay: 500; pos: bottom-left'):null">
|
[attr.uk-tooltip]="(tooltip && !focused && type !== 'chips' && type !== 'textarea' && (formControl.value || hint || placeholderInfo?.label))?('title: ' + (formControl.value ?getTooltip(formControl.value):(hint?hint:placeholderInfo?.label)) + '; delay: 500; pos: bottom-left'):null">
|
||||||
<ng-template [ngIf]="type === 'text' || type === 'URL' || type === 'logoURL'">
|
<ng-template [ngIf]="type === 'text' || type === 'URL' || type === 'logoURL'">
|
||||||
<input #input class="input" [attr.placeholder]="placeholderInfo?.static?placeholderInfo.label:hint"
|
<input #input class="input" [attr.placeholder]="placeholderInfo?.static?placeholderInfo.label:hint"
|
||||||
[formControl]="formAsControl" [class.uk-text-truncate]="!focused">
|
[formControl]="formAsControl" [class.uk-text-truncate]="!focused">
|
||||||
|
|
|
@ -9,7 +9,9 @@ export const DEFAULT_TIMEOUT = new InjectionToken<number>('defaultTimeout');
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class TimeoutInterceptor implements HttpInterceptor {
|
export class TimeoutInterceptor implements HttpInterceptor {
|
||||||
private static TIMEOUT_WHITELIST = [properties.csvAPIURL, properties.registryUrl, properties.claimsAPIURL];
|
// timeout inside services for: properties.searchCrossrefAPIURL, properties.searchDataciteAPIURL
|
||||||
|
private static TIMEOUT_WHITELIST = [properties.csvAPIURL, properties.registryUrl, properties.claimsAPIURL,
|
||||||
|
properties.searchCrossrefAPIURL, properties.searchDataciteAPIURL];
|
||||||
|
|
||||||
constructor(@Inject(DEFAULT_TIMEOUT) protected defaultTimeout: number, @Inject(PLATFORM_ID) private platformId: any) {
|
constructor(@Inject(DEFAULT_TIMEOUT) protected defaultTimeout: number, @Inject(PLATFORM_ID) private platformId: any) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,21 @@
|
||||||
import {Component, ViewEncapsulation, ComponentRef, ElementRef, Input, EventEmitter, Output} from '@angular/core';
|
import {
|
||||||
|
Component,
|
||||||
|
ViewEncapsulation,
|
||||||
|
ComponentRef,
|
||||||
|
ElementRef,
|
||||||
|
Input,
|
||||||
|
EventEmitter,
|
||||||
|
Output,
|
||||||
|
ViewChild
|
||||||
|
} from '@angular/core';
|
||||||
|
declare var UIkit: any;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'modal-loading',
|
selector: 'modal-loading',
|
||||||
template: `
|
template: `
|
||||||
<!--uk-modal="center:true"-->
|
<!-- uk-modal="center:true"-->
|
||||||
<div [class]="(!isOpen)?'uk-modal ':'uk-modal uk-open uk-animation-fade'" [open]="!isOpen" tabindex="-1" role="dialog" >
|
<!-- <div [class]="(!isOpen)?'uk-modal ':'uk-modal uk-open uk-animation-fade'" [open]="!isOpen" uk-modal tabindex="-1" role="dialog" >-->
|
||||||
|
<div #loading_element class="uk-modal" [id]="id" uk-modal="container: #modal-container">
|
||||||
<div class="uk-modal-dialog" role="">
|
<div class="uk-modal-dialog" role="">
|
||||||
<!--div class="modal-content"-->
|
<!--div class="modal-content"-->
|
||||||
|
|
||||||
|
@ -23,6 +34,23 @@ import {Component, ViewEncapsulation, ComponentRef, ElementRef, Input, EventEmit
|
||||||
</div>
|
</div>
|
||||||
<!--/div-->
|
<!--/div-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <div #element [class]="(!isOpen)?'uk-modal ':'uk-modal uk-animation-fade uk-open'" [open]="!isOpen" uk-modal="container: #modal-container">-->
|
||||||
|
<!-- <div class="uk-modal-dialog">-->
|
||||||
|
<!-- <div class="uk-modal-body uk-animation-fast uk-text-left">-->
|
||||||
|
<!-- <h4 class="text-center" >{{message}}</h4>-->
|
||||||
|
<!-- <div class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert">-->
|
||||||
|
<!-- <span class="loading-gif uk-align-center" ></span>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- <ng-content></ng-content>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--div class="uk-modal uk-open" aria-hidden="false" style="display: block; overflow-y: scroll;">
|
<!--div class="uk-modal uk-open" aria-hidden="false" style="display: block; overflow-y: scroll;">
|
||||||
<div class="uk-modal-dialog" tabindex="">
|
<div class="uk-modal-dialog" tabindex="">
|
||||||
<div class="uk-modal-spinner"></div>
|
<div class="uk-modal-spinner"></div>
|
||||||
|
@ -35,27 +63,54 @@ import {Component, ViewEncapsulation, ComponentRef, ElementRef, Input, EventEmit
|
||||||
* API to an open alert window.
|
* API to an open alert window.
|
||||||
*/
|
*/
|
||||||
export class ModalLoading{
|
export class ModalLoading{
|
||||||
|
private static MODAL_LOADING_COUNTER: number = 0;
|
||||||
|
|
||||||
|
id: string = "modal-loading";
|
||||||
|
|
||||||
@Input() public message:string ="Loading";
|
@Input() public message:string ="Loading";
|
||||||
|
@ViewChild('loading_element') element: ElementRef;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* if the value is true alert will be visible or else it will be hidden.
|
* if the value is true alert will be visible or else it will be hidden.
|
||||||
*/
|
*/
|
||||||
public isOpen:boolean=false;
|
// public isOpen:boolean=false;
|
||||||
/**
|
/**
|
||||||
* Emitted when a ok button was clicked
|
* Emitted when a ok button was clicked
|
||||||
* or when Ok method is called.
|
* or when Ok method is called.
|
||||||
*/
|
*/
|
||||||
@Output() public alertOutput:EventEmitter<any> = new EventEmitter();
|
@Output() public alertOutput:EventEmitter<any> = new EventEmitter();
|
||||||
constructor( public _elementRef: ElementRef){}
|
constructor( public _elementRef: ElementRef){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
ModalLoading.MODAL_LOADING_COUNTER++;
|
||||||
|
this.id = 'modal-loading-' + ModalLoading.MODAL_LOADING_COUNTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
if(typeof document !== "undefined") {
|
||||||
|
const element = document.getElementById("modal-container");
|
||||||
|
for (let i = element.childNodes.length - 1; i >= 0; --i) {
|
||||||
|
let child: ChildNode = element.childNodes[i];
|
||||||
|
if (child['id'] == this.id) {
|
||||||
|
child.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a alert window creating backdrop.
|
* Opens a alert window creating backdrop.
|
||||||
*/
|
*/
|
||||||
open(){
|
open(){
|
||||||
this.isOpen= true;
|
// this.isOpen= true;
|
||||||
|
UIkit.modal(this.element.nativeElement).show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
close(){
|
close(){
|
||||||
this.isOpen = false;
|
// this.isOpen = false;
|
||||||
|
UIkit.modal(this.element.nativeElement).hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue