[MonitorDashboard]: Fix a bug with subscriptions
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57835 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
90b5ce8db1
commit
321c59aaa1
|
@ -19,6 +19,7 @@ import {StakeholderCreator} from "../utils/entities/stakeholderCreator";
|
||||||
import {LayoutService} from "../library/sharedComponents/sidebar/layout.service";
|
import {LayoutService} from "../library/sharedComponents/sidebar/layout.service";
|
||||||
import {FormBuilder, FormControl} from "@angular/forms";
|
import {FormBuilder, FormControl} from "@angular/forms";
|
||||||
import {IDeactivateComponent} from "../openaireLibrary/utils/can-exit.guard";
|
import {IDeactivateComponent} from "../openaireLibrary/utils/can-exit.guard";
|
||||||
|
import {Subscription} from "rxjs";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'monitor',
|
selector: 'monitor',
|
||||||
|
@ -29,6 +30,7 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
||||||
id;
|
id;
|
||||||
status;
|
status;
|
||||||
};
|
};
|
||||||
|
public subscriptions: any[] = [];
|
||||||
public piwiksub: any;
|
public piwiksub: any;
|
||||||
public pageContents = null;
|
public pageContents = null;
|
||||||
public divContents = null;
|
public divContents = null;
|
||||||
|
@ -78,14 +80,18 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
||||||
});
|
});
|
||||||
this.route.data
|
this.route.data
|
||||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||||
|
let subscription: Subscription;
|
||||||
this.route.params.subscribe(params => {
|
this.route.params.subscribe(params => {
|
||||||
|
if(subscription) {
|
||||||
|
subscription.unsubscribe();
|
||||||
|
}
|
||||||
this.properties = data.envSpecific;
|
this.properties = data.envSpecific;
|
||||||
var url = data.envSpecific.baseLink + this._router.url;
|
var url = data.envSpecific.baseLink + this._router.url;
|
||||||
if (!this.stakeholder || this.stakeholder.alias !== params['stakeholder']) {
|
if (!this.stakeholder || this.stakeholder.alias !== params['stakeholder']) {
|
||||||
this.status = this.errorCodes.LOADING;
|
this.status = this.errorCodes.LOADING;
|
||||||
this.numberResults = new Map<number, number>();
|
this.numberResults = new Map<number, number>();
|
||||||
this.chartsActiveType = new Map<number, IndicatorPath>();
|
this.chartsActiveType = new Map<number, IndicatorPath>();
|
||||||
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
subscription = this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||||
/*let stakeholder: Stakeholder = null;
|
/*let stakeholder: Stakeholder = null;
|
||||||
if (params['stakeholder'] == "fwf") {
|
if (params['stakeholder'] == "fwf") {
|
||||||
stakeholder = new Stakeholder(null, "funder", "fwf_________::FWF", "Austrian Science Fund (FWF)", "FWF",
|
stakeholder = new Stakeholder(null, "funder", "fwf_________::FWF", "Austrian Science Fund (FWF)", "FWF",
|
||||||
|
@ -125,7 +131,8 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
||||||
}
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.navigateToError();
|
this.navigateToError();
|
||||||
})
|
});
|
||||||
|
this.subscriptions.push(subscription);
|
||||||
} else {
|
} else {
|
||||||
this.setView(params);
|
this.setView(params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,6 +159,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
}
|
}
|
||||||
|
|
||||||
onPrivacyChange(value) {
|
onPrivacyChange(value) {
|
||||||
|
console.log(this.numbers);
|
||||||
this.displayCharts = this.filterPrivacy(this.charts, value);
|
this.displayCharts = this.filterPrivacy(this.charts, value);
|
||||||
this.displayNumbers = this.filterPrivacy(this.numbers, value);
|
this.displayNumbers = this.filterPrivacy(this.numbers, value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ export class TopicComponent implements OnInit, OnDestroy {
|
||||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||||
this.properties = data.envSpecific;
|
this.properties = data.envSpecific;
|
||||||
let subscription: Subscription;
|
let subscription: Subscription;
|
||||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
this.route.params.subscribe(params => {
|
||||||
if(subscription) {
|
if(subscription) {
|
||||||
subscription.unsubscribe();
|
subscription.unsubscribe();
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,8 @@ export class TopicComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}));
|
this.subscriptions.push(subscription);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue