[Explore | Trunk]: Remove properties resolver subscriptions

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@60774 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-04-01 14:40:10 +00:00
parent 85af86976e
commit 743992cd62
3 changed files with 268 additions and 289 deletions

View File

@ -1,35 +1,22 @@
import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {Subscriber} from "rxjs";
import {Component, OnInit} from '@angular/core';
import {properties} from "../../../environments/environment";
@Component({
selector: 'openaire-claims-admin',
template: `
<claims-admin *ngIf="claimsInfoURL && userInfoURL" [claimsInfoURL]=claimsInfoURL [userInfoURL]="userInfoURL">
</claims-admin>
`,
})
export class OpenaireClaimsAdminComponent {
export class OpenaireClaimsAdminComponent implements OnInit {
claimsInfoURL: string;
userInfoURL: string;
sub;
constructor (private route: ActivatedRoute) {
}
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
constructor() {
}
public ngOnInit() {
this.sub = this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.claimsInfoURL = data.envSpecific.claimsInformationLink;
this.userInfoURL = data.envSpecific.userInfoUrl;
});
this.claimsInfoURL = properties.claimsInformationLink;
this.userInfoURL = properties.userInfoUrl;
}
}

View File

@ -1,8 +1,5 @@
import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {Subscriber} from "rxjs";
import {Component, OnInit} from '@angular/core';
import {properties} from "../../../environments/environment";
@Component({
@ -13,22 +10,15 @@ import {Subscriber} from "rxjs";
`
})
export class OpenaireMyClaimsComponent {
export class OpenaireMyClaimsComponent implements OnInit {
claimsInfoURL: string;
userInfoURL: string;
sub;
constructor (private route: ActivatedRoute) {
}
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
constructor() {
}
public ngOnInit() {
this.sub = this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.claimsInfoURL = data.envSpecific.claimsInformationLink;
this.userInfoURL = data.envSpecific.userInfoUrl;
});
this.claimsInfoURL = properties.claimsInformationLink;
this.userInfoURL = properties.userInfoUrl;
}
}

View File

@ -20,6 +20,7 @@ import { SEOService } from '../openaireLibrary/sharedComponents/SEO/SEO.service'
import {SearchResearchResultsService} from "../openaireLibrary/services/searchResearchResults.service";
import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
import {Filter} from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class";
import {properties} from "../../environments/environment";
@Component({
selector: 'home',
@ -133,7 +134,7 @@ export class HomeComponent {
showProjects: boolean = false;
showDataProviders: boolean = false;
showOrganizations: boolean = false;
properties: EnvProperties;
properties: EnvProperties = properties;
public readMore: boolean = false;
subs: Subscription[] = [];
@ -147,7 +148,16 @@ export class HomeComponent {
selectedEntity = "all";
selectedEntitySimpleUrl;
selectedEntityAdvancedUrl;
resultTypes:Filter = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', originalFilterId: "", valueIsExact: true, title: "Result Types",filterOperator:"or"};
resultTypes: Filter = {
values: [],
filterId: "type",
countSelectedValues: 0,
filterType: 'checkbox',
originalFilterId: "",
valueIsExact: true,
title: "Result Types",
filterOperator: "or"
};
public pageContents = null;
constructor(
@ -160,18 +170,14 @@ export class HomeComponent {
private _refineFieldResultsService: RefineFieldResultsService,
private location: Location, private _piwikService: PiwikService,
private config: ConfigurationService, private _meta: Meta, private _title: Title, private seoService: SEOService,
private helper: HelperService, private router: Router
private helper: HelperService
) {
let description = "OpenAIRE Explore: Over 100M of research deduplicated, 170K research software, 11M research data. One of the largest open scholarly records collection worldwide.";
let title = "OpenAIRE | Find and Share research";
this._title.setTitle(title);
this._meta.updateTag({content: description}, "name='description'");
this._meta.updateTag({content: description}, "property='og:description'");
this._meta.updateTag({content: title}, "property='og:title'");
}
private getPageContents() {
@ -197,25 +203,19 @@ export class HomeComponent {
}
public ngOnInit() {
this.subs.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this._router.url, false);
this.getPageContents();
if (this.properties != null) {
var url = this.properties.domain + this.properties.baseLink + this._router.url;
this._meta.updateTag({content: url}, "property='og:url'");
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subs.push(this._piwikService.trackView(this.properties, "OpenAIRE").subscribe());
}
//this.config.getCommunityInformation(this.properties, this.properties.adminToolsCommunity ).subscribe(data => {
this.subs.push(this.config.communityInformationState.subscribe(data => {
if (data) {
var showEntity = {};
for (var i = 0; i < data['entities'].length; i++) {
showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
}
this.showPublications = showEntity["publication"];
@ -245,8 +245,8 @@ export class HomeComponent {
}
));
}
}));
}
public ngOnDestroy() {
for (let sub of this.subs) {
sub.unsubscribe();
@ -369,11 +369,13 @@ export class HomeComponent {
private handleError(message: string, error) {
console.error("Home Page: " + message, error);
}
entityChanged($event) {
this.selectedEntity = $event.entity;
this.selectedEntitySimpleUrl = $event.simpleUrl;
this.selectedEntityAdvancedUrl = $event.advancedUrl;
}
goTo(simple: boolean) {
let url = (simple) ? this.selectedEntitySimpleUrl : this.selectedEntityAdvancedUrl;
let parameterNames = [];