Merge remote-tracking branch 'origin/new-claims-api' into angular-16

This commit is contained in:
Konstantinos Triantafyllou 2023-10-11 16:33:50 +03:00
commit 8581af9404
7 changed files with 193 additions and 144 deletions

View File

@ -2,8 +2,6 @@ import {Component, Input, ViewChild} from '@angular/core';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {ContextsService} from './service/contexts.service'; import {ContextsService} from './service/contexts.service';
import {ClaimEntity, ShowOptions} from './claimHelper.class'; import {ClaimEntity, ShowOptions} from './claimHelper.class';
import {Session} from '../../login/utils/helper.class';
import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
import {EnvProperties} from '../../utils/properties/env-properties'; import {EnvProperties} from '../../utils/properties/env-properties';
import {Subscriber} from "rxjs"; import {Subscriber} from "rxjs";
import {OpenaireEntities} from "../../utils/properties/searchFields"; import {OpenaireEntities} from "../../utils/properties/searchFields";
@ -183,10 +181,6 @@ export class ClaimContextSearchFormComponent {
} }
getCommunities() { getCommunities() {
if (!Session.isLoggedIn()) {
this.saveStateAndRedirectLogin();
} else {
this.loading = true; this.loading = true;
this.subscriptions.push(this._contextService.getCommunitiesByState().subscribe( this.subscriptions.push(this._contextService.getCommunitiesByState().subscribe(
data => { data => {
@ -220,18 +214,14 @@ export class ClaimContextSearchFormComponent {
this.error = true; this.error = true;
} }
)); ));
}
} }
getCategories() { getCategories() {
this.loading = true; this.loading = true;
// this.categories=[]; // this.categories=[];
if (this.selectedCommunityId != '0') { if (this.selectedCommunityId != '0') {
if (!Session.isLoggedIn()) {
this.saveStateAndRedirectLogin();
} else {
if (this.categories[this.selectedCommunityId]) { if (this.categories[this.selectedCommunityId]) {
this.loading = false; this.loading = false;
if(this.categories[this.selectedCommunityId].length > 0){ if(this.categories[this.selectedCommunityId].length > 0){
@ -259,7 +249,7 @@ export class ClaimContextSearchFormComponent {
} }
)); ));
} }
}
} }
displaySubcategory(id) { displaySubcategory(id) {
@ -272,9 +262,6 @@ export class ClaimContextSearchFormComponent {
} }
browseConcepts(categoryId) { browseConcepts(categoryId) {
if (!Session.isLoggedIn()) {
this.saveStateAndRedirectLogin();
} else {
if (this.conceptsClass[categoryId] != null) { if (this.conceptsClass[categoryId] != null) {
this.conceptsClassDisplay[categoryId] = !this.conceptsClassDisplay[categoryId]; this.conceptsClassDisplay[categoryId] = !this.conceptsClassDisplay[categoryId];
return; return;
@ -302,8 +289,6 @@ export class ClaimContextSearchFormComponent {
this.conceptsCategoryLoading[categoryId] = false; this.conceptsCategoryLoading[categoryId] = false;
} }
)); ));
}
} }
browseSubConcepts(categoryId, conceptId) { browseSubConcepts(categoryId, conceptId) {
@ -325,24 +310,6 @@ export class ClaimContextSearchFormComponent {
} }
saveStateAndRedirectLogin() {
if (this.results != null) {
localStorage.setItem(this.localStoragePrefix + "results", JSON.stringify(this.results));
}
if (this.sources != null) {
localStorage.setItem(this.localStoragePrefix + "sources", JSON.stringify(this.sources));
}
this.router.navigate(['/user-info'], {
queryParams: {
"errorCode": LoginErrorCodes.NOT_VALID,
"redirectUrl": this.router.url
}
});
}
private static handleError(message: string, error) { private static handleError(message: string, error) {
console.error("Claim context search form (component): " + message, error); console.error("Claim context search form (component): " + message, error);
} }

View File

@ -10,7 +10,7 @@ export class ClaimsService {
} }
private getClaimRequest(size : number, page : number, url :string, fromCache:boolean):any { private getClaimRequest(size : number, page : number, url :string, fromCache:boolean):any {
return this.http.get(url, CustomOptions.getAuthOptions()); return this.http.get(url, CustomOptions.getAuthOptionsWithBody());
} }
getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string):any { getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string):any {
let url = apiUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types); let url = apiUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types);
@ -44,10 +44,7 @@ export class ClaimsService {
deleteClaimById(claimId:string , apiUrl:string):any{ deleteClaimById(claimId:string , apiUrl:string):any{
//console.warn('Trying to delete claim with id : '+claimId); //console.warn('Trying to delete claim with id : '+claimId);
let url = apiUrl +"claims/"+claimId; let url = apiUrl +"claims/"+claimId;
// let headers = new Headers({ 'Content-Type': 'application/json' });
// let options = new RequestOptions({ headers: headers });
return this.http.delete( url, CustomOptions.getAuthOptionsWithBody())//.map(request => <any> request.json()) return this.http.delete( url, CustomOptions.getAuthOptionsWithBody())//.map(request => <any> request.json())
// .do(request => console.info("After delete" ))
.pipe(catchError(this.handleError)); .pipe(catchError(this.handleError));
} }
@ -61,10 +58,7 @@ export class ClaimsService {
} }
url= apiUrl +"claims/bulk?"+url; url= apiUrl +"claims/bulk?"+url;
// let headers = new Headers({ 'Content-Type': 'application/json' }); return this.http.delete( url, CustomOptions.getAuthOptionsWithBody())//.map(request => <any> request.json())
// let options = new RequestOptions({ headers: headers });
return this.http.delete( url, CustomOptions.getAuthOptions())//.map(request => <any> request.json())
// .do(request => console.info("After delete" ))
.pipe(catchError(this.handleError)); .pipe(catchError(this.handleError));
} }
@ -72,40 +66,27 @@ export class ClaimsService {
// console.warn('Trying toinsert claims : '+claims); // console.warn('Trying toinsert claims : '+claims);
let url = apiUrl +"claims/bulk"; let url = apiUrl +"claims/bulk";
let body = JSON.stringify( claims ); let body = JSON.stringify( claims );
//console.warn('Json body: : '+body);
// let headers = new Headers({ 'Content-Type': 'application/json' });
// let options = new RequestOptions({ headers: headers });
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody()) return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
//.map(res => res.json())
//.do(request => console.info("Insert Response:"+request.status) )
.pipe(catchError(this.handleError)); .pipe(catchError(this.handleError));
} }
insertClaim(claim, apiUrl:string):any{
//console.warn('Trying toinsert claim : '+claim);
let url = apiUrl +"claims";
let body = JSON.stringify( claim );
// let headers = new Headers({ 'Content-Type': 'application/json' });
// let options = new RequestOptions({ headers: headers });
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
//.map(res => res.json())
//.do(request => console.info("Insert Response:"+request.status) )
.pipe(catchError(this.handleError));
}
insertDirectRecords(records, apiUrl:string):any{ insertDirectRecords(records, apiUrl:string):any{
//console.warn('Trying to feedrecords : '+records); //console.warn('Trying to feedrecords : '+records);
let url = apiUrl +"feed/bulk"; let url = apiUrl +"feed/bulk";
let body = JSON.stringify( records ); let body = JSON.stringify( records );
//console.warn('Json body: : '+body);
// let headers = new Headers({ 'Content-Type': 'application/json' });
// let options = new RequestOptions({ headers: headers });
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody()) return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
//.map(res => res.json())
//.do(request => console.info("Insert Response:"+request) )
.pipe(catchError(this.handleError)); .pipe(catchError(this.handleError));
} }
getStatus(jobId, apiUrl:string):any{
let url = apiUrl +"jobStatus/" + jobId;
return this.http.get(url,CustomOptions.getAuthOptionsWithBody())
.pipe(catchError(this.handleError));
}
private handleError (error: Response) { private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure // in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console // instead of just logging it to the console
@ -113,22 +94,4 @@ export class ClaimsService {
return observableThrowError(error || 'Server error'); return observableThrowError(error || 'Server error');
} }
// getClaim(id:string, apiUrl:string):any {
// let url = apiUrl+"claims/"+id;
// return new Promise((resolve, reject) => {
// this.http.get(url)
// //.map(res => res.json())
// .subscribe(
// data => {
// resolve(data['data']);
// },
// err => {
// reject(err);
// }
// )
// ;
// });
// }
} }

View File

@ -18,26 +18,12 @@ export class ClaimsByTokenService {
let key = url; let key = url;
return this.http.get(url, CustomOptions.getAuthOptions()); return this.http.get(url, CustomOptions.getAuthOptionsWithBody());
//.map(res => <any> res.text())
//.map(request => <any> request.json());
} }
/*
getClaims(email: string, token: string, user_token: string):any {
let url = OpenaireProperties.getClaimsAPIURL(); // What else?
let body = JSON.stringify( {"email": email, "token": token} );
console.warn('Json body: : '+body);
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
return this.http.post(url, body, options)
.map(res => res.json())
.do(request => console.info("Insert Response:"+request.status) )
.catch(this.handleError);
}
*/
updateClaimsCuration( selectedRight: Set<string>, selectedWrong: Set<string>, apiURL:string) { updateClaimsCuration( selectedRight: Set<string>, selectedWrong: Set<string>, apiURL:string) {
let url = apiURL + "curate/bulk"; let url = apiURL + "curate/bulk";

View File

@ -14,7 +14,8 @@ import {
Message Message
} from "../../claim-utils/claimHelper.class"; } from "../../claim-utils/claimHelper.class";
import {UserManagementService} from "../../../services/user-management.service"; import {UserManagementService} from "../../../services/user-management.service";
import {Subscriber} from "rxjs"; import {Subscriber, timer} from "rxjs";
import {map} from "rxjs/operators";
@Component({ @Component({
selector: 'claim-insert', selector: 'claim-insert',
@ -30,7 +31,19 @@ import {Subscriber} from "rxjs";
<div class="uk-width-expand uk-margin-small-left">CONFIRM LINKING</div> <div class="uk-width-expand uk-margin-small-left">CONFIRM LINKING</div>
</button> </button>
</div> </div>
<modal-loading [message]="'Please wait...'"></modal-loading> <modal-loading [message]="'Please wait...'">
<div *ngIf="claimsJob">
<div *ngIf="claimsJob && claimsJob.insertedIds.length <1" class="uk-text-meta uk-text-small">
Initiating process....</div>
<div *ngIf="claimsJob && claimsJob.insertedIds.length >0" class="uk-text-meta uk-text-small">
{{claimsJob.insertedIds.length}} out of {{claims2Insert}} links created.</div>
<div *ngIf="feedRecordsJob && feedRecordsJob.insertedIds.length >0" class="uk-text-meta uk-text-small">
{{feedRecordsJob.insertedIds.length}} out of {{records2Insert}} records added in the index...</div>
<div *ngIf="claimsJob.status != 'COMPLETE'" class="uk-text-meta uk-text-small">
Please don't close the window, process is ongoing...</div>
</div>
</modal-loading>
<modal-alert (alertOutput)="confirmClose()"> <modal-alert (alertOutput)="confirmClose()">
<h4 class="modal-title uk-text-bold " id="myModalLabel">Confirmation notice</h4> <h4 class="modal-title uk-text-bold " id="myModalLabel">Confirmation notice</h4>
<p>All the links you provided will be published in the OpenAIRE platform. <br> <p>All the links you provided will be published in the OpenAIRE platform. <br>
@ -60,6 +73,32 @@ export class ClaimInsertComponent {
this.subscriptions.push(this.route.queryParams.subscribe(params => { this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.params = params; this.params = params;
})); }));
if(localStorage.getItem(this.localStoragePrefix + "claimsJob")){
this.claimsJob = JSON.parse(localStorage.getItem(this.localStoragePrefix + "claimsJob"));
this.feedRecordsJob = JSON.parse(localStorage.getItem(this.localStoragePrefix + "feedRecordsJob"));
if(this.claimsJob.status != "COMPLETE"){
this.claiming = true;
let loadingTimerSubscription = timer(0, 1000).pipe(
map(() => {
if(this.loading) {
this.loading.open();
loadingTimerSubscription.unsubscribe();
}
})
).subscribe();
this.subscriptions.push(loadingTimerSubscription);
let timerSubscription = timer(0, 10000).pipe(
map(() => {
this.getStatus(); // load data contains the http request
})
).subscribe();
this.subscriptions.push(timerSubscription);
}else{
this.claimsJob = null;
}
}
} }
params = {}; params = {};
@ -84,15 +123,15 @@ export class ClaimInsertComponent {
private errorInClaims: ClaimRecord2Insert[] = []; private errorInClaims: ClaimRecord2Insert[] = [];
private insertedRecords = []; private insertedRecords = [];
private errorInRecords = []; private errorInRecords = [];
public claimsJob;
public feedRecordsJob;
public claims2Insert;
public records2Insert
public insert() { public insert() {
this.confirmOpen(); this.confirmOpen();
} }
saveAndNavigate(){ saveAndNavigate(){
localStorage.setItem(this.localStoragePrefix + "results", JSON.stringify(this.results)); this.saveLocalStorage();
if (this.sources != null) {
localStorage.setItem(this.localStoragePrefix + "sources", JSON.stringify(this.sources));
}
this._router.navigate(['/user-info'], { this._router.navigate(['/user-info'], {
queryParams: { queryParams: {
"errorCode": LoginErrorCodes.NOT_VALID, "errorCode": LoginErrorCodes.NOT_VALID,
@ -177,12 +216,15 @@ export class ClaimInsertComponent {
//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.log("directclaims"); // console.log("directclaims");
// console.log(directclaims); // console.log(directclaims);
if (directclaims.length > 0 && this.properties.environment != "development"){ if (directclaims.length > 0/* && this.properties.environment != "development"*/){
this.subscriptions.push(this.claimService.insertDirectRecords(directclaims, this.properties.claimsAPIURL).subscribe( this.subscriptions.push(this.claimService.insertDirectRecords(directclaims, this.properties.claimsAPIURL).subscribe(
data => { data => {
this.insertedRecords = data.insertedIds; this.feedRecordsJob = data.data;
this.records2Insert = directclaims.length;
this.errorInRecords = data.errorInClaims; console.log(data);
// this.insertedRecords = data.insertedIds;
//
// this.errorInRecords = data.errorInClaims;
this.isertBulkClaims(claims); this.isertBulkClaims(claims);
}, },
err => { err => {
@ -190,12 +232,12 @@ export class ClaimInsertComponent {
if (err.code && err.code == 403) { if (err.code && err.code == 403) {
this.saveAndNavigate(); this.saveAndNavigate();
} }
if (err.insertedIds && err.insertedIds.length > 0) { /* if (err.insertedIds && err.insertedIds.length > 0) {
this.insertedRecords = err.insertedIds; this.insertedRecords = err.insertedIds;
} }
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); this.isertBulkClaims(claims);
ClaimInsertComponent.handleError("Error inserting direct records: " + JSON.stringify(directclaims), err); ClaimInsertComponent.handleError("Error inserting direct records: " + JSON.stringify(directclaims), err);
@ -209,30 +251,18 @@ export class ClaimInsertComponent {
} }
private isertBulkClaims(claims: ClaimRecord2Insert[]) { private isertBulkClaims(claims: ClaimRecord2Insert[]) {
console.log("claims");
console.log(claims);
this.errors.splice(0, this.errors.length); this.errors.splice(0, this.errors.length);
this.subscriptions.push(this.claimService.insertBulkClaims(claims, this.properties.claimsAPIURL).subscribe( this.subscriptions.push(this.claimService.insertBulkClaims(claims, this.properties.claimsAPIURL).subscribe(
data => { data => {
this.insertedClaims = data.insertedIds; this.claims2Insert = claims.length;
this.errorInClaims = data.errorInClaims; this.claimsJob = data.data;
//TODO remove - testing having errors in claims this.saveLocalStorage();
// this.insertedClaims.pop(); let timerSubscription = timer(0, 10000).pipe(
// this.insertedClaims.pop(); map(() => {
// this.errorInClaims.push(claims[1]); this.getStatus(); // load data contains the http request
// this.insertedClaims.splice(0,this.insertedClaims.length); })
// this.errorInClaims = claims; ).subscribe();
//remove till here this.subscriptions.push(timerSubscription);
if (claims.length != this.insertedClaims.length) {
let error: ClaimsErrorMessage = new ClaimsErrorMessage();
error.type = "claimServiceFail2Insert";
error.inserted = this.insertedClaims.length;
error.failed = this.errorInClaims.length;
this.createErrorMessagesPerEntity((this.insertedClaims.length == 0));
this.errors.push(error);
}
this.afterclaimsInsertion();
}, },
err => { err => {
err = err && err.error?err.error:err; err = err && err.error?err.error:err;
@ -335,13 +365,16 @@ export class ClaimInsertComponent {
} }
private afterclaimsInsertion() { private afterclaimsInsertion() {
this.loading.close();
this.claiming = false; this.claiming = false;
this.loading.close();
if (this.errorInClaims.length == 0 && this.insertedClaims.length > 0) { if (this.errorInClaims.length == 0 && this.insertedClaims.length > 0) {
localStorage.removeItem(this.localStoragePrefix + "sources"); localStorage.removeItem(this.localStoragePrefix + "sources");
localStorage.removeItem(this.localStoragePrefix + "results"); localStorage.removeItem(this.localStoragePrefix + "results");
localStorage.removeItem(this.localStoragePrefix + "claimsJob");
localStorage.removeItem(this.localStoragePrefix + "feedRecordsJob");
this._router.navigate(['/myclaims'], {queryParams: this.params}); this._router.navigate(['/myclaims'], {queryParams: this.params});
} }
} }
@ -517,8 +550,77 @@ export class ClaimInsertComponent {
} }
if(this.defaultColors){ if(this.defaultColors){
buttonClass+=" linksbaskettitles uk-padding-small "; buttonClass+=" linksbaskettitles uk-padding-small ";
} }
return buttonClass + "uk-text-center "; return buttonClass + "uk-text-center ";
} }
getStatus(){
if(this.feedRecordsJob && ! (this.feedRecordsJob.status == "COMPLETE" || this.feedRecordsJob.status == "ERROR") ) {
this.subscriptions.push(this.claimService.getStatus(this.feedRecordsJob.id, this.properties.claimsAPIURL).subscribe(data => {
console.log("feed", data);
this.feedRecordsJob = data.data;
if (this.feedRecordsJob.status == "COMPLETE" || data.data.status == "ERROR") {
this.insertedRecords = this.feedRecordsJob.insertedIds;
this.errorInRecords = this.feedRecordsJob.errorInClaims;
}
}, err => {
let error: ClaimsErrorMessage = new ClaimsErrorMessage();
error.type = "jobError";
this.createErrorMessagesPerEntity((this.insertedClaims.length == 0));
this.errors.push(error);
this.afterclaimsInsertion();
this.feedRecordsJob = null;
localStorage.removeItem(this.localStoragePrefix + "feedRecordsJob");
}
));
}
if(this.claimsJob) {
this.subscriptions.push(this.claimService.getStatus(this.claimsJob.id, this.properties.claimsAPIURL).subscribe(data => {
console.log("claim", data);
this.claimsJob = data.data;
if ((this.claimsJob.status == "COMPLETE" || data.data.status == "ERROR") && ( !this.feedRecordsJob || !(this.feedRecordsJob.status == "COMPLETE" || data.data.status == "ERROR")) ) {
this.insertedClaims = this.claimsJob.insertedIds;
this.errorInClaims = this.claimsJob.errorInClaims;
if (this.claims2Insert != this.insertedClaims.length) {
let error: ClaimsErrorMessage = new ClaimsErrorMessage();
error.type = "claimServiceFail2Insert";
error.inserted = this.insertedClaims.length;
error.failed = this.errorInClaims.length;
this.createErrorMessagesPerEntity((this.insertedClaims.length == 0));
this.errors.push(error);
}
this.afterclaimsInsertion();
}
}, err => {
let error: ClaimsErrorMessage = new ClaimsErrorMessage();
error.type = "jobError";
this.createErrorMessagesPerEntity((this.insertedClaims.length == 0));
this.errors.push(error);
this.afterclaimsInsertion();
this.claimsJob = null;
localStorage.removeItem(this.localStoragePrefix + "claimsJob");
}
));
}
}
saveLocalStorage(){
if (this.results != null) {
localStorage.setItem(this.localStoragePrefix + "results", JSON.stringify(this.results));
}
if (this.sources != null) {
localStorage.setItem(this.localStoragePrefix + "sources", JSON.stringify(this.sources));
}
if (this.claimsJob != null) {
localStorage.setItem(this.localStoragePrefix + "claimsJob", JSON.stringify(this.claimsJob));
}
if (this.feedRecordsJob != null) {
localStorage.setItem(this.localStoragePrefix + "feedRecordsJob", JSON.stringify(this.feedRecordsJob));
}
}
} }

View File

@ -16,6 +16,8 @@ import {OpenaireEntities} from "../../utils/properties/searchFields";
import {StringUtils} from "../../utils/string-utils.class"; import {StringUtils} from "../../utils/string-utils.class";
import {RouterHelper} from "../../utils/routerHelper.class"; import {RouterHelper} from "../../utils/routerHelper.class";
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import {LoginErrorCodes} from "../../login/utils/guardHelper.class";
import {UserManagementService} from "../../services/user-management.service";
@Component({ @Component({
selector: 'linking-generic', selector: 'linking-generic',
@ -51,12 +53,17 @@ export class LinkingGenericComponent {
constructor (private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService, constructor (private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService,
private _meta: Meta, private _title: Title, private _piwikService:PiwikService, private _meta: Meta, private _title: Title, private _piwikService:PiwikService,
private seoService: SEOService, private helper: HelperService, private cdr: ChangeDetectorRef, private seoService: SEOService, private helper: HelperService, private cdr: ChangeDetectorRef,
private location: Location) { private location: Location, private userManagementService: UserManagementService) {
} }
subscriptions = []; subscriptions = [];
ngOnInit() { ngOnInit() {
if(this.breadcrumbs.length === 0) { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
if (!user) {
this.saveStateAndRedirectLogin();
}
}));
if(this.breadcrumbs.length === 0) {
this.breadcrumbs.push({name: 'home', route: '/'}); this.breadcrumbs.push({name: 'home', route: '/'});
this.breadcrumbs.push({name: "Link", route: null}); this.breadcrumbs.push({name: "Link", route: null});
} }
@ -94,6 +101,11 @@ export class LinkingGenericComponent {
if(localStorage.getItem(this.localStoragePrefix + "sources")){ if(localStorage.getItem(this.localStoragePrefix + "sources")){
this.sources = JSON.parse(localStorage.getItem(this.localStoragePrefix + "sources")); this.sources = JSON.parse(localStorage.getItem(this.localStoragePrefix + "sources"));
} }
if(localStorage.getItem(this.localStoragePrefix + "claimsJob")){
let job = JSON.parse(localStorage.getItem(this.localStoragePrefix + "claimsJob"));
if(job.status != "COMPLETE"){
this.showOptions.show = 'claim'; }
}
} }
} }
@ -206,4 +218,20 @@ export class LinkingGenericComponent {
this.location.back(); this.location.back();
} }
} }
saveStateAndRedirectLogin() {
if (this.results != null) {
localStorage.setItem(this.localStoragePrefix + "results", JSON.stringify(this.results));
}
if (this.sources != null) {
localStorage.setItem(this.localStoragePrefix + "sources", JSON.stringify(this.sources));
}
this._router.navigate(['/user-info'], {
queryParams: {
"errorCode": LoginErrorCodes.NOT_VALID,
"redirectUrl": this._router.url
}
});
}
} }

View File

@ -250,6 +250,14 @@
None of the links saved. None of the links saved.
</div> </div>
</div> </div>
<div *ngIf="message.type == 'jobError'">
<div class="">
<span class=" uk-text-bold">The saving status of your links can't be fetched. Please check your links or start over. </span>
<br>
<a routerLinkActive="router-link-active" routerLink="/myclaims">Manage your links here</a>
</div>
</div>
</div> </div>
</div> </div>
<div *ngIf="warnings.length > 0" <div *ngIf="warnings.length > 0"

View File

@ -16,17 +16,12 @@ export class CustomOptions {
return { return {
headers: new HttpHeaders({ headers: new HttpHeaders({
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'X-XSRF-TOKEN': COOKIE.getCookie(COOKIE.cookieName_id)?COOKIE.getCookie(COOKIE.cookieName_id):''
}), withCredentials: true }), withCredentials: true
}; };
} }
public static getAuthOptions():{} { public static getAuthOptions():{} {
return { return this.getAuthOptionsWithBody();
headers: new HttpHeaders({
'X-XSRF-TOKEN': (COOKIE.getCookie(COOKIE.cookieName_id)) ? COOKIE.getCookie(COOKIE.cookieName_id) : ''
}), withCredentials: true
};
} }
} }