Monitor Page: Remove filters if user is logged out
This commit is contained in:
parent
74b510df02
commit
0b814da356
|
@ -31,6 +31,7 @@ import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class";
|
|||
import {properties} from "../../environments/environment";
|
||||
import {IndexInfoService} from "../openaireLibrary/utils/indexInfo.service";
|
||||
import {ConfigurationService} from "../openaireLibrary/utils/configuration/configuration.service";
|
||||
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
|
||||
|
||||
declare var UIkit;
|
||||
|
||||
|
@ -125,10 +126,6 @@ export class MonitorComponent implements OnInit, OnDestroy {
|
|||
subscription.unsubscribe();
|
||||
}
|
||||
var url = properties.domain + properties.baseLink + this._router.url;
|
||||
this.subscriptions.push(this.route.queryParams.subscribe(params => {
|
||||
this.queryParams = Object.assign({}, params);
|
||||
this.isViewPublic = (params['view'] == 'public');
|
||||
}));
|
||||
if (!this.stakeholder || this.stakeholder.alias !== params['stakeholder']) {
|
||||
this.status = this.errorCodes.LOADING;
|
||||
this.numberResults = new Map<string, number>();
|
||||
|
@ -166,7 +163,9 @@ export class MonitorComponent implements OnInit, OnDestroy {
|
|||
, filterOperator: "or", valueIsExact: true, filterType: "checkbox", radioValue: ""
|
||||
});
|
||||
}
|
||||
this.initializeFilters();
|
||||
this.subscriptions.push(this.route.queryParams.subscribe( queryParams => {
|
||||
this.handleQueryParams(queryParams, params);
|
||||
}));
|
||||
this.seoService.createLinkForCanonicalURL(url, false);
|
||||
this._meta.updateTag({content: url}, "property='og:url'");
|
||||
this.description = "Monitor Dashboard | " + this.stakeholder.name;
|
||||
|
@ -178,9 +177,7 @@ export class MonitorComponent implements OnInit, OnDestroy {
|
|||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subscriptions.push(this.configurationService.communityInformationState.subscribe(portal => {
|
||||
if (portal && portal.piwik) {
|
||||
console.debug(portal)
|
||||
this.piwikSiteId = portal.piwik;
|
||||
console.debug(this.piwikSiteId)
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, this.title, this.piwikSiteId).subscribe());
|
||||
}
|
||||
}));
|
||||
|
@ -212,13 +209,28 @@ export class MonitorComponent implements OnInit, OnDestroy {
|
|||
this.subscriptions.push(this._piwikService.trackView(this.properties, this.title, this.piwikSiteId).subscribe());
|
||||
}
|
||||
}
|
||||
this.initializeFilters();
|
||||
this.setView(params);
|
||||
this.subscriptions.push(this.route.queryParams.subscribe( queryParams => {
|
||||
this.handleQueryParams(queryParams, params);
|
||||
}));
|
||||
}
|
||||
}));
|
||||
}));
|
||||
}
|
||||
|
||||
private handleQueryParams(queryParams, params) {
|
||||
this.queryParams = Object.assign({}, queryParams);
|
||||
this.initializeFilters();
|
||||
this.setView(params);
|
||||
if(!this.user && (this.filters.filter(filter => this.queryParams[filter.filterId]).length > 0 || this.queryParams['year'])) {
|
||||
if(queryParams['view']) {
|
||||
this.router.navigate([], {queryParams: {view: queryParams['view']}});
|
||||
} else {
|
||||
this.router.navigate([], {queryParams: {}});
|
||||
}
|
||||
}
|
||||
this.isViewPublic = (queryParams['view'] == 'public');
|
||||
}
|
||||
|
||||
private initializeFilters() {
|
||||
this.periodFilter.selectedFromValue = (this.queryParams['year'] && this.queryParams['year'].indexOf("range") == 0) ? this.queryParams['year'].split("range")[1].split(":")[0] : "";
|
||||
this.periodFilter.selectedToValue = (this.queryParams['year'] && this.queryParams['year'].indexOf("range") == 0) ? this.queryParams['year'].split("range")[1].split(":")[1] : "";
|
||||
|
|
Loading…
Reference in New Issue