claimsByToken.component & mailPrefs.component: when Session is expired, redirect to '/user-info' page to show a proper message.
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@53742 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
78d4bb3f7d
commit
645ef263ce
|
@ -1,6 +1,6 @@
|
|||
import {Component, ViewChild, ViewChildren, QueryList, Input, ViewEncapsulation} from '@angular/core';
|
||||
import {Location} from '@angular/common';
|
||||
import {ActivatedRoute, Params} from '@angular/router';
|
||||
import {ActivatedRoute, Params, Router} from '@angular/router';
|
||||
import {Title, Meta} from '@angular/platform-browser';
|
||||
|
||||
import {DataTableDirective} from 'angular-datatables';
|
||||
|
@ -12,7 +12,6 @@ import {ErrorCodes} from '../../utils/properties/errorCodes';
|
|||
|
||||
import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe';
|
||||
|
||||
import {Session} from '../../login/utils/helper.class';
|
||||
import {RouterHelper} from '../../utils/routerHelper.class';
|
||||
|
||||
import {ModalSelect} from '../../utils/modal/selectModal.component';
|
||||
|
@ -20,6 +19,10 @@ import {ModalLoading} from '../../utils/modal/loading.component';
|
|||
|
||||
import {ClaimsByTokenService} from './claimsByToken.service';
|
||||
|
||||
import {Session} from '../../login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'claims-project-manager',
|
||||
templateUrl: 'claimsByToken.component.html',
|
||||
|
@ -83,6 +86,7 @@ export class ClaimsByTokenComponent {
|
|||
public routerHelper:RouterHelper = new RouterHelper();
|
||||
|
||||
constructor (private route: ActivatedRoute,
|
||||
private _router: Router,
|
||||
private claimsByTokenService: ClaimsByTokenService,
|
||||
private _meta: Meta, private _title: Title) {
|
||||
this.errorCodes = new ErrorCodes();
|
||||
|
@ -198,23 +202,28 @@ console.info("configure dtOptions2: ",this.dtOptions[1]);
|
|||
}
|
||||
|
||||
filterData(row: any, query: string) {
|
||||
let returnValue: boolean = false;
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
let returnValue: boolean = false;
|
||||
|
||||
if(query) {
|
||||
for(var i=0; i <3; i++){
|
||||
var r= this.filterQuery(row[i], query);
|
||||
if(r) {
|
||||
returnValue = true;
|
||||
break;
|
||||
if(query) {
|
||||
for(var i=0; i <3; i++){
|
||||
var r= this.filterQuery(row[i], query);
|
||||
if(r) {
|
||||
returnValue = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!returnValue) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!returnValue) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
filterQuery(data, query){
|
||||
|
@ -226,25 +235,29 @@ console.info("configure dtOptions2: ",this.dtOptions[1]);
|
|||
}
|
||||
|
||||
refreshTable(page:number, whichTable: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if(whichTable == "pending") {
|
||||
var table = $('#table1').DataTable();
|
||||
table.page( page - 1 ).draw( false );
|
||||
|
||||
if(whichTable == "pending") {
|
||||
var table = $('#table1').DataTable();
|
||||
table.page( page - 1 ).draw( false );
|
||||
var info = table.page.info();
|
||||
console.info("records: "+info.recordsDisplay);
|
||||
|
||||
var info = table.page.info();
|
||||
console.info("records: "+info.recordsDisplay);
|
||||
this.activePendingPage.page = page;//$event.value;
|
||||
this.totalPendingResults.count = info.recordsDisplay;
|
||||
} else if(whichTable == 'curated') {
|
||||
var table = $('#table2').DataTable();
|
||||
table.page( page - 1 ).draw( false );
|
||||
|
||||
this.activePendingPage.page = page;//$event.value;
|
||||
this.totalPendingResults.count = info.recordsDisplay;
|
||||
} else if(whichTable == 'curated') {
|
||||
var table = $('#table2').DataTable();
|
||||
table.page( page - 1 ).draw( false );
|
||||
var info = table.page.info();
|
||||
console.info("records: "+info.recordsDisplay);
|
||||
|
||||
var info = table.page.info();
|
||||
console.info("records: "+info.recordsDisplay);
|
||||
|
||||
this.activeCuratedPage.page = page;//$event.value;
|
||||
this.totalCuratedResults.count = info.recordsDisplay;
|
||||
this.activeCuratedPage.page = page;//$event.value;
|
||||
this.totalCuratedResults.count = info.recordsDisplay;
|
||||
}
|
||||
}
|
||||
|
||||
//table.mfActivePage=$event.value;
|
||||
|
@ -252,52 +265,83 @@ refreshTable(page:number, whichTable: string) {
|
|||
}
|
||||
|
||||
validateJWTandToken() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if(this.openaireId) {
|
||||
this.pending_status = this.errorCodes.LOADING;
|
||||
this.curated_status = this.errorCodes.LOADING;
|
||||
|
||||
if(this.openaireId) {
|
||||
this.pending_status = this.errorCodes.LOADING;
|
||||
this.curated_status = this.errorCodes.LOADING;
|
||||
this.showTables = false;
|
||||
this.pending_claims = [];
|
||||
this.curated_claims = [];
|
||||
|
||||
this.showTables = false;
|
||||
this.pending_claims = [];
|
||||
this.curated_claims = [];
|
||||
this.activePendingPage.page = 1;
|
||||
this.totalPendingResults.count = 0;
|
||||
this.activeCuratedPage.page = 1;
|
||||
this.totalCuratedResults.count = 0;
|
||||
|
||||
this.activePendingPage.page = 1;
|
||||
this.totalPendingResults.count = 0;
|
||||
this.activeCuratedPage.page = 1;
|
||||
this.totalCuratedResults.count = 0;
|
||||
|
||||
this.claimsByTokenService.getClaims(this.openaireId, this.properties.claimsAPIURL).subscribe(
|
||||
data => {
|
||||
//this.closeLoading();
|
||||
this.accessStatus = "valid";
|
||||
//console.info(data);
|
||||
this.claims = data.data;
|
||||
for(let claim of this.claims) {
|
||||
if(claim.targetType == "project") {
|
||||
this.project = claim.target;
|
||||
} else {
|
||||
this.project = claim.source;
|
||||
this.claimsByTokenService.getClaims(this.openaireId, this.properties.claimsAPIURL).subscribe(
|
||||
data => {
|
||||
//this.closeLoading();
|
||||
this.accessStatus = "valid";
|
||||
//console.info(data);
|
||||
this.claims = data.data;
|
||||
for(let claim of this.claims) {
|
||||
if(claim.targetType == "project") {
|
||||
this.project = claim.target;
|
||||
} else {
|
||||
this.project = claim.source;
|
||||
}
|
||||
if(claim.curatedBy) {
|
||||
this.curated_claims.push(claim);
|
||||
} else {
|
||||
this.pending_claims.push(claim);
|
||||
}
|
||||
}
|
||||
if(claim.curatedBy) {
|
||||
this.curated_claims.push(claim);
|
||||
} else {
|
||||
this.pending_claims.push(claim);
|
||||
|
||||
this.totalPendingResults.count = this.pending_claims.length;
|
||||
this.totalCuratedResults.count = this.curated_claims.length;
|
||||
|
||||
if(this.project) {
|
||||
this.updateTitle("Claims For Project Managers - "+this.project.name);
|
||||
}
|
||||
}
|
||||
this.showTables = true;
|
||||
|
||||
this.totalPendingResults.count = this.pending_claims.length;
|
||||
this.totalCuratedResults.count = this.curated_claims.length;
|
||||
if(!this.triggered) {
|
||||
console.info("initial load");
|
||||
this.triggerInitialLoad();
|
||||
} else {
|
||||
console.info("rerender");
|
||||
var table1 = $('#table1').DataTable();
|
||||
table1.clear();
|
||||
|
||||
if(this.project) {
|
||||
this.updateTitle("Claims For Project Managers - "+this.project.name);
|
||||
var table2 = $('#table2').DataTable();
|
||||
table2.clear();
|
||||
|
||||
this.rerender();
|
||||
}
|
||||
|
||||
this.pending_status = this.errorCodes.DONE;
|
||||
this.curated_status = this.errorCodes.DONE;
|
||||
},
|
||||
err => {
|
||||
if(err.status == '404') {
|
||||
this.pending_status = this.errorCodes.NOT_FOUND;
|
||||
this.curated_status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.pending_status = this.errorCodes.ERROR;
|
||||
this.curated_status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.pending_status = this.errorCodes.NOT_AVAILABLE;
|
||||
this.curated_status = this.errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
this.showTables = true;
|
||||
|
||||
if(!this.triggered) {
|
||||
console.info("initial load");
|
||||
this.triggerInitialLoad();
|
||||
} else {
|
||||
console.info("rerender");
|
||||
var table1 = $('#table1').DataTable();
|
||||
table1.clear();
|
||||
|
||||
|
@ -307,82 +351,65 @@ refreshTable(page:number, whichTable: string) {
|
|||
this.rerender();
|
||||
}
|
||||
|
||||
this.pending_status = this.errorCodes.DONE;
|
||||
this.curated_status = this.errorCodes.DONE;
|
||||
},
|
||||
err => {
|
||||
if(err.status == '404') {
|
||||
this.pending_status = this.errorCodes.NOT_FOUND;
|
||||
this.curated_status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.pending_status = this.errorCodes.ERROR;
|
||||
this.curated_status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.pending_status = this.errorCodes.NOT_AVAILABLE;
|
||||
this.curated_status = this.errorCodes.NOT_AVAILABLE;
|
||||
this.accessStatus = "invalid";
|
||||
console.log(err);
|
||||
}
|
||||
this.showTables = true;
|
||||
|
||||
if(!this.triggered) {
|
||||
this.triggerInitialLoad();
|
||||
} else {
|
||||
var table1 = $('#table1').DataTable();
|
||||
table1.clear();
|
||||
|
||||
var table2 = $('#table2').DataTable();
|
||||
table2.clear();
|
||||
|
||||
this.rerender();
|
||||
}
|
||||
|
||||
this.accessStatus = "invalid";
|
||||
console.log(err);
|
||||
}
|
||||
);
|
||||
);
|
||||
} else {
|
||||
this.accessStatus = "invalid";
|
||||
this.accessStatus = "invalid";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
selectApprove(id:string, event, mode: string) {
|
||||
var value = event.currentTarget.checked;
|
||||
if(value){
|
||||
if(mode == "pending") {
|
||||
this.selectedRight_PendingMode.add(id);
|
||||
this.selectedWrong_PendingMode.delete(id);
|
||||
} else {
|
||||
this.selectedRight_CuratedMode.add(id);
|
||||
this.selectedWrong_CuratedMode.delete(id);
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
var value = event.currentTarget.checked;
|
||||
if(value){
|
||||
if(mode == "pending") {
|
||||
this.selectedRight_PendingMode.add(id);
|
||||
this.selectedWrong_PendingMode.delete(id);
|
||||
} else {
|
||||
this.selectedRight_CuratedMode.add(id);
|
||||
this.selectedWrong_CuratedMode.delete(id);
|
||||
}
|
||||
}else{
|
||||
if(mode == "pending") {
|
||||
this.selectedRight_PendingMode.delete(id);
|
||||
}
|
||||
// } else {
|
||||
// this.selectedRight_CuratedMode.delete(id);
|
||||
// this.selectedWrong_CuratedMode.add(id);
|
||||
// }
|
||||
}
|
||||
}else{
|
||||
if(mode == "pending") {
|
||||
this.selectedRight_PendingMode.delete(id);
|
||||
}
|
||||
// } else {
|
||||
// this.selectedRight_CuratedMode.delete(id);
|
||||
// this.selectedWrong_CuratedMode.add(id);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
selectDisapprove(id:string, event, mode: string) {
|
||||
var value = event.currentTarget.checked;
|
||||
if(value){
|
||||
if(mode == "pending") {
|
||||
this.selectedWrong_PendingMode.add(id);
|
||||
this.selectedRight_PendingMode.delete(id);
|
||||
} else {
|
||||
this.selectedWrong_CuratedMode.add(id);
|
||||
this.selectedRight_CuratedMode.delete(id);
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
var value = event.currentTarget.checked;
|
||||
if(value){
|
||||
if(mode == "pending") {
|
||||
this.selectedWrong_PendingMode.add(id);
|
||||
this.selectedRight_PendingMode.delete(id);
|
||||
} else {
|
||||
this.selectedWrong_CuratedMode.add(id);
|
||||
this.selectedRight_CuratedMode.delete(id);
|
||||
}
|
||||
}else{
|
||||
if(mode == "pending") {
|
||||
this.selectedWrong_PendingMode.delete(id);
|
||||
}
|
||||
// } else {
|
||||
// this.selectedWrong_CuratedMode.delete(id);
|
||||
// this.selectedRight_CuratedMode.add(id);
|
||||
// }
|
||||
}
|
||||
}else{
|
||||
if(mode == "pending") {
|
||||
this.selectedWrong_PendingMode.delete(id);
|
||||
}
|
||||
// } else {
|
||||
// this.selectedWrong_CuratedMode.delete(id);
|
||||
// this.selectedRight_CuratedMode.add(id);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -415,72 +442,92 @@ refreshTable(page:number, whichTable: string) {
|
|||
}
|
||||
|
||||
cancelEditOfCuration(claim: any) {
|
||||
console.info("cancelEditOfCuration - approved:"+claim.approved);
|
||||
if(claim.approved) {
|
||||
//this.selectedRight_CuratedMode.add(claim.id);
|
||||
this.selectedWrong_CuratedMode.delete(claim.id);
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.selectedRight_CuratedMode.delete(claim.id);
|
||||
//this.selectedWrong_CuratedMode.add(claim.id);
|
||||
console.info("cancelEditOfCuration - approved:"+claim.approved);
|
||||
if(claim.approved) {
|
||||
//this.selectedRight_CuratedMode.add(claim.id);
|
||||
this.selectedWrong_CuratedMode.delete(claim.id);
|
||||
} else {
|
||||
this.selectedRight_CuratedMode.delete(claim.id);
|
||||
//this.selectedWrong_CuratedMode.add(claim.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
saveEdited(claim: any, editable_index: number) {
|
||||
this.curated_status = this.errorCodes.LOADING;
|
||||
|
||||
let approved: boolean = this.isRight_CuratedMode(claim);
|
||||
|
||||
if(approved == claim.approved) {
|
||||
this.selectedRight_CuratedMode.delete(claim.id);
|
||||
this.selectedWrong_CuratedMode.delete(claim.id);
|
||||
this.editable.delete(editable_index);
|
||||
|
||||
this.curated_status = this.errorCodes.DONE;
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
let claimCurationInfo: {"id": string, "approved": boolean} = {"id": claim.id, "approved": approved};
|
||||
this.curated_status = this.errorCodes.LOADING;
|
||||
|
||||
this.claimsByTokenService.updateClaimCuration(claimCurationInfo, this.properties.claimsAPIURL).subscribe(
|
||||
let approved: boolean = this.isRight_CuratedMode(claim);
|
||||
|
||||
if(approved == claim.approved) {
|
||||
this.selectedRight_CuratedMode.delete(claim.id);
|
||||
this.selectedWrong_CuratedMode.delete(claim.id);
|
||||
this.editable.delete(editable_index);
|
||||
|
||||
this.curated_status = this.errorCodes.DONE;
|
||||
} else {
|
||||
let claimCurationInfo: {"id": string, "approved": boolean} = {"id": claim.id, "approved": approved};
|
||||
|
||||
this.claimsByTokenService.updateClaimCuration(claimCurationInfo, this.properties.claimsAPIURL).subscribe(
|
||||
data => {
|
||||
console.info(data);
|
||||
this.selectedRight_CuratedMode.delete(claim.id);
|
||||
this.selectedWrong_CuratedMode.delete(claim.id);
|
||||
this.editable.delete(editable_index);
|
||||
|
||||
this.validateJWTandToken();
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
this.curated_status = this.errorCodes.NOT_SAVED;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
saveChanges() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.pending_status = this.errorCodes.LOADING;
|
||||
//this.openLoading();
|
||||
console.info("Changes Saved!, right-wrong", this.selectedRight_PendingMode, this.selectedWrong_PendingMode);
|
||||
this.claimsByTokenService.updateClaimsCuration(this.selectedRight_PendingMode, this.selectedWrong_PendingMode, this.properties.claimsAPIURL).subscribe(
|
||||
data => {
|
||||
//this.closeLoading();
|
||||
console.info(data);
|
||||
this.selectedRight_CuratedMode.delete(claim.id);
|
||||
this.selectedWrong_CuratedMode.delete(claim.id);
|
||||
this.editable.delete(editable_index);
|
||||
|
||||
this.mode = "curated";
|
||||
this.clearCheckboxes();
|
||||
this.validateJWTandToken();
|
||||
},
|
||||
err => {
|
||||
//this.closeLoading();
|
||||
console.log(err);
|
||||
this.curated_status = this.errorCodes.NOT_SAVED;
|
||||
this.pending_status = this.errorCodes.NOT_SAVED;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
saveChanges() {
|
||||
this.pending_status = this.errorCodes.LOADING;
|
||||
//this.openLoading();
|
||||
console.info("Changes Saved!, right-wrong", this.selectedRight_PendingMode, this.selectedWrong_PendingMode);
|
||||
this.claimsByTokenService.updateClaimsCuration(this.selectedRight_PendingMode, this.selectedWrong_PendingMode, this.properties.claimsAPIURL).subscribe(
|
||||
data => {
|
||||
//this.closeLoading();
|
||||
console.info(data);
|
||||
this.mode = "curated";
|
||||
this.clearCheckboxes();
|
||||
this.validateJWTandToken();
|
||||
},
|
||||
err => {
|
||||
//this.closeLoading();
|
||||
console.log(err);
|
||||
this.pending_status = this.errorCodes.NOT_SAVED;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
clearCheckboxes() {
|
||||
this.pending_status = this.errorCodes.LOADING;
|
||||
this.selectedRight_PendingMode.clear();
|
||||
this.selectedWrong_PendingMode.clear();
|
||||
this.pending_status = this.errorCodes.DONE;
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.pending_status = this.errorCodes.LOADING;
|
||||
this.selectedRight_PendingMode.clear();
|
||||
this.selectedWrong_PendingMode.clear();
|
||||
this.pending_status = this.errorCodes.DONE;
|
||||
}
|
||||
}
|
||||
|
||||
public openLoading(){
|
||||
|
|
|
@ -69,11 +69,11 @@ export class MailPrefsComponent {
|
|||
|
||||
getEmailPreferences() {
|
||||
if(!Session.isLoggedIn()){
|
||||
this.userValidMessage = "User session has expired. Please login again.";
|
||||
//this.userValidMessage = "User session has expired. Please login again.";
|
||||
if(this.showSaveResetButtons) {
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
this.status = this.errorCodes.LOADING;
|
||||
this.savedMessage = "";
|
||||
|
||||
|
@ -123,28 +123,42 @@ export class MailPrefsComponent {
|
|||
}
|
||||
|
||||
changeNotify(notification: any, checked: boolean, index: number) {
|
||||
this.savedMessage = "";
|
||||
this.status = this.errorCodes.DONE;
|
||||
notification.notify = checked;
|
||||
this.prefsChanged[index] = true;
|
||||
if(!Session.isLoggedIn()){
|
||||
//this.userValidMessage = "User session has expired. Please login again.";
|
||||
if(this.showSaveResetButtons) {
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
}
|
||||
} else {
|
||||
this.savedMessage = "";
|
||||
this.status = this.errorCodes.DONE;
|
||||
notification.notify = checked;
|
||||
this.prefsChanged[index] = true;
|
||||
}
|
||||
}
|
||||
|
||||
changeFrequency(value: number, index: number) {
|
||||
this.savedMessage = "";
|
||||
this.status = this.errorCodes.DONE;
|
||||
if(this.initialNotifications[index].frequency != value) {
|
||||
this.prefsChanged[index] = true;
|
||||
if(!Session.isLoggedIn()){
|
||||
//this.userValidMessage = "User session has expired. Please login again.";
|
||||
if(this.showSaveResetButtons) {
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
}
|
||||
} else {
|
||||
this.savedMessage = "";
|
||||
this.status = this.errorCodes.DONE;
|
||||
if(this.initialNotifications[index].frequency != value) {
|
||||
this.prefsChanged[index] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
saveNotification(index: number) {
|
||||
if(this.notifications.length > 0 && this.initialNotifications.length > 0) {
|
||||
if(!Session.isLoggedIn()){
|
||||
this.userValidMessage = "User session has expired. Please login again.";
|
||||
//this.userValidMessage = "User session has expired. Please login again.";
|
||||
if(this.showSaveResetButtons) {
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
if(JSON.stringify(this.notifications[index]) != JSON.stringify(this.initialNotifications[index])) {
|
||||
|
||||
this.status = this.errorCodes.LOADING;
|
||||
|
@ -187,15 +201,22 @@ export class MailPrefsComponent {
|
|||
}
|
||||
|
||||
restoreNotification(index: number) {
|
||||
if(this.notifications.length > 0 && this.initialNotifications.length > 0) {
|
||||
this.status = this.errorCodes.LOADING;
|
||||
this.savedMessage = "";
|
||||
console.info("Restore Notification");
|
||||
console.info(this.notifications[index]);
|
||||
this.notifications[index] = JSON.parse(JSON.stringify( this.initialNotifications[index] ));
|
||||
console.info(this.initialNotifications[index]);
|
||||
this.status = this.errorCodes.DONE;
|
||||
this.prefsChanged[index] = false;
|
||||
if(!Session.isLoggedIn()){
|
||||
//this.userValidMessage = "User session has expired. Please login again.";
|
||||
if(this.showSaveResetButtons) {
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
}
|
||||
} else {
|
||||
if(this.notifications.length > 0 && this.initialNotifications.length > 0) {
|
||||
this.status = this.errorCodes.LOADING;
|
||||
this.savedMessage = "";
|
||||
console.info("Restore Notification");
|
||||
console.info(this.notifications[index]);
|
||||
this.notifications[index] = JSON.parse(JSON.stringify( this.initialNotifications[index] ));
|
||||
console.info(this.initialNotifications[index]);
|
||||
this.status = this.errorCodes.DONE;
|
||||
this.prefsChanged[index] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue