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

View File

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

View File

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