Merge branch 'develop' of code-repo.d4science.org:MaDgIK/openaire-library into develop
This commit is contained in:
commit
e463080109
|
@ -1,5 +1,5 @@
|
||||||
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
|
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
||||||
import {Router, ActivatedRoute} from '@angular/router';
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {ClaimsService} from '../../claim-utils/service/claims.service';
|
import {ClaimsService} from '../../claim-utils/service/claims.service';
|
||||||
import {ModalLoading} from '../../../utils/modal/loading.component';
|
import {ModalLoading} from '../../../utils/modal/loading.component';
|
||||||
import {AlertModal} from '../../../utils/modal/alert';
|
import {AlertModal} from '../../../utils/modal/alert';
|
||||||
|
@ -63,6 +63,7 @@ export class ClaimInsertComponent {
|
||||||
private userManagementService: UserManagementService, private _logService: LogService) {
|
private userManagementService: UserManagementService, private _logService: LogService) {
|
||||||
}
|
}
|
||||||
subscriptions = [];
|
subscriptions = [];
|
||||||
|
timerSubscription;
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.subscriptions.forEach(subscription => {
|
this.subscriptions.forEach(subscription => {
|
||||||
if (subscription instanceof Subscriber) {
|
if (subscription instanceof Subscriber) {
|
||||||
|
@ -88,13 +89,12 @@ export class ClaimInsertComponent {
|
||||||
})
|
})
|
||||||
).subscribe();
|
).subscribe();
|
||||||
this.subscriptions.push(loadingTimerSubscription);
|
this.subscriptions.push(loadingTimerSubscription);
|
||||||
|
this.timerSubscription = timer(0, 10000).pipe(
|
||||||
let timerSubscription = timer(0, 10000).pipe(
|
|
||||||
map(() => {
|
map(() => {
|
||||||
this.getStatus(); // load data contains the http request
|
this.getStatus(); // load data contains the http request
|
||||||
})
|
})
|
||||||
).subscribe();
|
).subscribe();
|
||||||
this.subscriptions.push(timerSubscription);
|
this.subscriptions.push(this.timerSubscription);
|
||||||
}else{
|
}else{
|
||||||
this.claimsJob = null;
|
this.claimsJob = null;
|
||||||
}
|
}
|
||||||
|
@ -274,12 +274,12 @@ export class ClaimInsertComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.saveLocalStorage();
|
this.saveLocalStorage();
|
||||||
let timerSubscription = timer(0, 10000).pipe(
|
this.timerSubscription = timer(0, 10000).pipe(
|
||||||
map(() => {
|
map(() => {
|
||||||
this.getStatus(); // load data contains the http request
|
this.getStatus(); // load data contains the http request
|
||||||
})
|
})
|
||||||
).subscribe();
|
).subscribe();
|
||||||
this.subscriptions.push(timerSubscription);
|
this.subscriptions.push(this.timerSubscription);
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
err = err && err.error?err.error:err;
|
err = err && err.error?err.error:err;
|
||||||
|
@ -599,11 +599,10 @@ export class ClaimInsertComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
getStatus(){
|
getStatus(){
|
||||||
if(this.feedRecordsJob && ! (this.feedRecordsJob.status == "COMPLETE" || this.feedRecordsJob.status == "ERROR") ) {
|
if(this.feedRecordsJob && ! (this.feedRecordsJob.status == "COMPLETE" || this.feedRecordsJob.status == "FAILED") ) {
|
||||||
this.subscriptions.push(this.claimService.getStatus(this.feedRecordsJob.id, this.properties.claimsAPIURL).subscribe(data => {
|
this.subscriptions.push(this.claimService.getStatus(this.feedRecordsJob.id, this.properties.claimsAPIURL).subscribe(data => {
|
||||||
this.feedRecordsJob = data.data;
|
this.feedRecordsJob = data.data;
|
||||||
// console.log("feed", this.feedRecordsJob.status);
|
if (this.feedRecordsJob.status == "COMPLETE" || this.feedRecordsJob.status == "FAILED") {
|
||||||
if (this.feedRecordsJob.status == "COMPLETE" || data.data.status == "ERROR") {
|
|
||||||
this.insertedRecords = this.feedRecordsJob.insertedIds;
|
this.insertedRecords = this.feedRecordsJob.insertedIds;
|
||||||
this.errorInRecords = this.feedRecordsJob.errorInClaims;
|
this.errorInRecords = this.feedRecordsJob.errorInClaims;
|
||||||
}
|
}
|
||||||
|
@ -622,8 +621,8 @@ export class ClaimInsertComponent {
|
||||||
if(this.claimsJob) {
|
if(this.claimsJob) {
|
||||||
this.subscriptions.push(this.claimService.getStatus(this.claimsJob.id, this.properties.claimsAPIURL).subscribe(data => {
|
this.subscriptions.push(this.claimService.getStatus(this.claimsJob.id, this.properties.claimsAPIURL).subscribe(data => {
|
||||||
this.claimsJob = data.data;
|
this.claimsJob = data.data;
|
||||||
// console.log("claim: ", this.claimsJob.status, this.feedRecordsJob.status?this.feedRecordsJob.status:" no feed job");
|
if ((this.claimsJob.status == "COMPLETE" || this.claimsJob.status == "FAILED") &&
|
||||||
if ((this.claimsJob.status == "COMPLETE" || data.data.status == "ERROR") && ( !this.feedRecordsJob || (this.feedRecordsJob.status == "COMPLETE" || data.data.status == "ERROR")) ) {
|
( !this.feedRecordsJob || (this.feedRecordsJob.status == "COMPLETE" || data.data.status == "FAILED"))) {
|
||||||
this.insertedClaims = this.claimsJob.insertedIds;
|
this.insertedClaims = this.claimsJob.insertedIds;
|
||||||
this.errorInClaims = this.claimsJob.errorInClaims;
|
this.errorInClaims = this.claimsJob.errorInClaims;
|
||||||
|
|
||||||
|
@ -636,7 +635,7 @@ export class ClaimInsertComponent {
|
||||||
this.errors.push(error);
|
this.errors.push(error);
|
||||||
}
|
}
|
||||||
this.afterclaimsInsertion();
|
this.afterclaimsInsertion();
|
||||||
|
this.timerSubscription.unsubscribe();
|
||||||
|
|
||||||
}
|
}
|
||||||
}, err => {
|
}, err => {
|
||||||
|
|
|
@ -8,63 +8,64 @@ import {properties} from "../../../../environments/environment";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class HelperService {
|
export class HelperService {
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
getHelper (router: string, position: string, before: boolean, div: string, properties:EnvProperties, communityId:string ):any {
|
getHelper(router: string, position: string, before: boolean, div: string, properties: EnvProperties, communityId: string): any {
|
||||||
//console.info("get router helpText for : "+router+" - position="+position+" - before="+before + " - div="+div);
|
//console.info("get router helpText for : "+router+" - position="+position+" - before="+before + " - div="+div);
|
||||||
|
|
||||||
let url = properties.adminToolsAPIURL;
|
let url = properties.adminToolsAPIURL;
|
||||||
if(div) {
|
if (div) {
|
||||||
url += '/divhelpcontent?active=true&community='+communityId+'&page='+router+'&div=' + div;
|
url += '/divhelpcontent?active=true&community=' + communityId + '&page=' + router + '&div=' + div;
|
||||||
} else {
|
} else {
|
||||||
url += '/pagehelpcontent?active=true&community='+communityId+'&page='+router+'&position=' + position;
|
url += '/pagehelpcontent?active=true&community=' + communityId + '&page=' + router + '&position=' + position;
|
||||||
if(before) {
|
if (before) {
|
||||||
url += '&before='+before;
|
url += '&before=' + before;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.http.get(/*(properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)+ (properties.forceCacheReload?'&forceReload=true':'')):*/ url);
|
|
||||||
//.map(res => <any> res.json());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
getPageHelpContents(properties:EnvProperties, portal:string, router: string, portalType = properties.adminToolsPortalType):any {
|
|
||||||
if(!portal) {
|
|
||||||
portal = properties.adminToolsCommunity;
|
|
||||||
}
|
|
||||||
if(!portal) {
|
|
||||||
portal = 'openaire';
|
|
||||||
}
|
|
||||||
if(typeof properties.useHelpTexts == "undefined" || properties.useHelpTexts) {
|
|
||||||
let page_route: string = router.split('?')[0].substring(0);
|
|
||||||
let url = properties.adminToolsAPIURL;
|
|
||||||
url += '/' + portalType + '/' + portal + '/pagehelpcontent/grouped?active=true&page=' +
|
|
||||||
((page_route.indexOf("/"+portal+"/")!=-1 ) ? ("/" + page_route.split("/"+portal+"/")[1]) : page_route);
|
|
||||||
return this.http.get(/*(properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)+ (properties.forceCacheReload?'&forceReload=true':'')) :*/ url);
|
|
||||||
}else {
|
|
||||||
return of(null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getDivHelpContents(properties:EnvProperties, communityId:string, router: string):any {
|
return this.http.get(/*(properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)+ (properties.forceCacheReload?'&forceReload=true':'')):*/ url);
|
||||||
if(!communityId) {
|
//.map(res => <any> res.json());
|
||||||
communityId = properties.adminToolsCommunity;
|
|
||||||
}
|
}
|
||||||
if(!communityId) {
|
|
||||||
communityId = 'openaire';
|
getPageHelpContents(properties: EnvProperties, portal: string, router: string, portalType = properties.adminToolsPortalType): any {
|
||||||
}
|
if (!portal) {
|
||||||
if(typeof properties.useHelpTexts == "undefined" || properties.useHelpTexts) {
|
portal = properties.adminToolsCommunity;
|
||||||
|
}
|
||||||
|
if (!portal) {
|
||||||
|
portal = 'openaire';
|
||||||
|
}
|
||||||
|
if (typeof properties.useHelpTexts == "undefined" || properties.useHelpTexts) {
|
||||||
let page_route: string = router.split('?')[0].substring(0);
|
let page_route: string = router.split('?')[0].substring(0);
|
||||||
let url = properties.adminToolsAPIURL;
|
let url = properties.adminToolsAPIURL;
|
||||||
url += '/'+properties.adminToolsPortalType+'/' + communityId + '/divhelpcontent/grouped?active=true&page='+
|
url += '/' + portalType + '/' + portal + '/pagehelpcontent/grouped?active=true&page=' +
|
||||||
((page_route.indexOf("/"+communityId+"/")!=-1 ) ? ("/" + page_route.split("/"+communityId+"/")[1]) : page_route);
|
((page_route.indexOf("/" + portal + "/") != -1) ? ("/" + page_route.split("/" + portal + "/")[1]) : page_route);
|
||||||
return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)+ (properties.forceCacheReload?'&forceReload=true':'')): url);
|
return this.http.get(/*(properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)+ (properties.forceCacheReload?'&forceReload=true':'')) :*/ url);
|
||||||
}else {
|
} else {
|
||||||
return of(null);
|
return of(null);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getDivHelpContents(properties: EnvProperties, communityId: string, router: string): any {
|
||||||
|
if (!communityId) {
|
||||||
|
communityId = properties.adminToolsCommunity;
|
||||||
|
}
|
||||||
|
if (!communityId) {
|
||||||
|
communityId = 'openaire';
|
||||||
|
}
|
||||||
|
if (typeof properties.useHelpTexts == "undefined" || properties.useHelpTexts) {
|
||||||
|
let page_route: string = router.split('?')[0].substring(0);
|
||||||
|
let url = properties.adminToolsAPIURL;
|
||||||
|
url += '/' + properties.adminToolsPortalType + '/' + communityId + '/divhelpcontent/grouped?active=true&page=' +
|
||||||
|
((page_route.indexOf("/" + communityId + "/") != -1) ? ("/" + page_route.split("/" + communityId + "/")[1]) : page_route);
|
||||||
|
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url) + (properties.forceCacheReload ? '&forceReload=true' : '')) : url);
|
||||||
|
} else {
|
||||||
|
return of(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
export type Environment = "development" | "test" | "beta" | "production";
|
export type Environment = "development" | "test" | "beta" | "production";
|
||||||
export type Dashboard = "explore" | "connect" | "monitor" | "aggregator" | "eosc" | "developers" | "faircore4eosc" | "irish";
|
export type Dashboard = "explore" | "connect" | "monitor" | "aggregator" | "eosc" | "developers" | "faircore4eosc" | "irish";
|
||||||
export type PortalType = "explore" | "connect" | "community" | "monitor" | "funder" | "ri" | "project" | "organization" | "aggregator" | "eosc" | "faircore4eosc" | "country";
|
export type PortalType = "explore" | "connect" | "community" | "monitor" | "funder" | "ri" | "project" | "organization" |
|
||||||
|
"aggregator" | "eosc" | "faircore4eosc" | "country" | "datasource" | "journal" | "publisher";
|
||||||
|
|
||||||
export interface EnvProperties {
|
export interface EnvProperties {
|
||||||
environment?: Environment;
|
environment?: Environment;
|
||||||
|
|
Loading…
Reference in New Issue