Change piwik service methods in order to get the piwik from portal configuration
This commit is contained in:
parent
620b924cbe
commit
4701eae560
|
@ -1,5 +1,3 @@
|
|||
<schema2jsonld *ngIf="url" [URL]="url" [name]="pageTitle" type="other"></schema2jsonld>
|
||||
|
||||
<ng-template #card let-organization="organization" let-fullView="fullView">
|
||||
<div [class]="fullView?'uk-card-body uk-height-1-1 uk-flex uk-flex-column uk-flex-around':''">
|
||||
<div class="affiliation-logo">
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {Title, Meta} from '@angular/platform-browser';
|
||||
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
||||
import {AffiliationService} from "../openaireLibrary/connect/affiliations/affiliation.service";
|
||||
import {Affiliation} from "../openaireLibrary/utils/entities/CuratorInfo";
|
||||
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
|
||||
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
|
||||
import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service";
|
||||
import {PiwikHelper} from "../utils/piwikHelper";
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
||||
import {AffiliationService} from "../openaireLibrary/connect/affiliations/affiliation.service";
|
||||
import {Affiliation} from "../openaireLibrary/utils/entities/CuratorInfo";
|
||||
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
|
||||
import {Subscriber} from "rxjs";
|
||||
import {properties} from "../../environments/environment";
|
||||
|
||||
@Component({
|
||||
selector: 'affiliations',
|
||||
templateUrl: './affiliations.component.html',
|
||||
styleUrls: ['./affiliations.component.less']
|
||||
styleUrls: ['./affiliations.component.less']
|
||||
})
|
||||
export class AffiliationsComponent {
|
||||
@Input() getAffiliationsFromAPI: boolean = false;
|
||||
|
@ -24,61 +20,33 @@ export class AffiliationsComponent {
|
|||
@Input() affiliations: Affiliation[] = [];
|
||||
@Input() sliderOptions = '';
|
||||
@Input() arrows = true;
|
||||
|
||||
|
||||
public showLoading: boolean = false;
|
||||
|
||||
communityId: string;
|
||||
properties:EnvProperties;
|
||||
|
||||
subscriptions = [];
|
||||
public url: string = null;
|
||||
public pageTitle: string = "Related Organizations";
|
||||
|
||||
constructor ( private route: ActivatedRoute, private _router: Router,
|
||||
private _meta: Meta,
|
||||
private _title: Title,
|
||||
private seoService: SEOService,
|
||||
private _piwikService: PiwikService,
|
||||
private affiliationService: AffiliationService) {}
|
||||
|
||||
public ngOnInit() {
|
||||
|
||||
this.subscriptions.push(this.route.queryParams.subscribe(
|
||||
communityId => {
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
|
||||
if(!this.communityId) {
|
||||
this.communityId = communityId['communityId'];
|
||||
}
|
||||
|
||||
this.properties = properties;
|
||||
if(this.longView) {
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId)).subscribe());
|
||||
}
|
||||
this.url = this.properties.domain + this._router.url;
|
||||
this.seoService.createLinkForCanonicalURL(this.url);
|
||||
this.updateUrl(this.url);
|
||||
this.updateTitle(this.pageTitle);
|
||||
this.updateDescription("OpenAIRE - Connect, Community Gateway, research community, organizations");
|
||||
}
|
||||
if(this.getAffiliationsFromAPI) {
|
||||
this.showLoading = true;
|
||||
this.affiliationService.initAffiliations(this.communityId);
|
||||
this.subscriptions.push(this.affiliationService.affiliations.subscribe(
|
||||
affiliations => {
|
||||
this.affiliations = affiliations.filter((affiliation) => this.longView || !!affiliation['logo_url']);
|
||||
this.showLoading = false;
|
||||
},
|
||||
error => {
|
||||
console.error("Affiliations Component: Error getting affiliations for community with id: " + this.communityId, error);
|
||||
this.showLoading = false;
|
||||
}
|
||||
));
|
||||
}
|
||||
}));
|
||||
|
||||
public communityId: string;
|
||||
public properties: EnvProperties = properties;
|
||||
private subscriptions = [];
|
||||
|
||||
constructor(private route: ActivatedRoute, private affiliationService: AffiliationService) {
|
||||
}
|
||||
|
||||
|
||||
public ngOnInit() {
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
|
||||
if (this.getAffiliationsFromAPI) {
|
||||
this.showLoading = true;
|
||||
this.affiliationService.initAffiliations(this.communityId);
|
||||
this.subscriptions.push(this.affiliationService.affiliations.subscribe(
|
||||
affiliations => {
|
||||
this.affiliations = affiliations.filter((affiliation) => this.longView || !!affiliation['logo_url']);
|
||||
this.showLoading = false;
|
||||
},
|
||||
error => {
|
||||
console.error("Affiliations Component: Error getting affiliations for community with id: " + this.communityId, error);
|
||||
this.showLoading = false;
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
|
@ -87,19 +55,4 @@ export class AffiliationsComponent {
|
|||
});
|
||||
this.affiliationService.clearSubscriptions();
|
||||
}
|
||||
|
||||
private updateDescription(description: string) {
|
||||
this._meta.updateTag({content: description}, "name='description'");
|
||||
this._meta.updateTag({content: description}, "property='og:description'");
|
||||
}
|
||||
|
||||
private updateTitle(title: string) {
|
||||
var _title = ((title.length > 50) ? title.substring(0, 50) : title);
|
||||
this._title.setTitle(_title);
|
||||
this._meta.updateTag({content: _title}, "property='og:title'");
|
||||
}
|
||||
|
||||
private updateUrl(url: string) {
|
||||
this._meta.updateTag({content: url}, "property='og:url'");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import {NgModule} from '@angular/core';
|
||||
|
||||
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../openaireLibrary/error/isRouteEnabled.guard'
|
||||
|
@ -7,15 +7,11 @@ import {RouterModule} from '@angular/router';
|
|||
import {AffiliationsComponent} from './affiliations.component';
|
||||
import {AffiliationService} from "../openaireLibrary/connect/affiliations/affiliation.service";
|
||||
import {CommonModule} from "@angular/common";
|
||||
import {Schema2jsonldModule} from "../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module";
|
||||
import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOService.module";
|
||||
import {PiwikServiceModule} from "../openaireLibrary/utils/piwik/piwikService.module";
|
||||
import {UrlPrefixModule} from "../openaireLibrary/utils/pipes/url-prefix.module";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, RouterModule, Schema2jsonldModule, SEOServiceModule,
|
||||
PiwikServiceModule, UrlPrefixModule
|
||||
CommonModule, RouterModule, UrlPrefixModule
|
||||
],
|
||||
declarations: [
|
||||
AffiliationsComponent
|
||||
|
|
|
@ -280,7 +280,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
this.initLayout('connect');
|
||||
}
|
||||
}
|
||||
this.configurationService.initCommunityInformation(this.properties, (communityId) ? communityId : this.properties.adminToolsPortalType);
|
||||
this.configurationService.initPortal(this.properties, (communityId) ? communityId : this.properties.adminToolsPortalType);
|
||||
|
||||
}
|
||||
getLayouts(){
|
||||
|
@ -407,7 +407,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
} else {
|
||||
this.communityId = null;
|
||||
this.properties.adminToolsPortalType = "connect";
|
||||
this.configurationService.initCommunityInformation(this.properties, "connect");
|
||||
this.configurationService.initPortal(this.properties, "connect");
|
||||
this.initAdminToolCommunity(null);
|
||||
this.buildConnectMenu(true);
|
||||
if (this.community && this.community.status == "manager") {
|
||||
|
|
|
@ -77,7 +77,7 @@ export class CommunitiesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
this.seoService.createLinkForCanonicalURL(url, false);
|
||||
this._meta.updateTag({content: url}, "property='og:url'");
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, "OpenAIRE Connect", this.properties.piwikSiteId).subscribe());
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, "OpenAIRE Connect").subscribe());
|
||||
}
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
|
|
|
@ -221,12 +221,7 @@ export class CommunityComponent {
|
|||
this._meta.updateTag({content: community.title}, "property='og:title'");
|
||||
this._title.setTitle(community.title);
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subs.push(this.config.communityInformationState.subscribe(portal => {
|
||||
if(portal && portal.piwik) {
|
||||
this.piwikSiteId = portal.piwik;
|
||||
this.subs.push(this._piwikService.trackView(this.properties, community.title, this.piwikSiteId).subscribe());
|
||||
}
|
||||
}));
|
||||
this.subs.push(this._piwikService.trackView(this.properties, community.title).subscribe());
|
||||
}
|
||||
if (this.community.zenodoCommunity) {
|
||||
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.community.zenodoCommunity, null).subscribe(
|
||||
|
@ -281,7 +276,7 @@ export class CommunityComponent {
|
|||
this.contentProvidersCalculated = true;
|
||||
}
|
||||
));
|
||||
this.subs.push(this.config.communityInformationState.subscribe(
|
||||
this.subs.push(this.config.portalAsObservable.subscribe(
|
||||
res => {
|
||||
this.communityInfo = res;
|
||||
|
||||
|
@ -300,7 +295,7 @@ export class CommunityComponent {
|
|||
this.handleError("Error getting community with id: " + this.communityId, error);
|
||||
}
|
||||
));
|
||||
this.subs.push(this.config.communityInformationState.subscribe(data => {
|
||||
this.subs.push(this.config.portalAsObservable.subscribe(data => {
|
||||
if (data) {
|
||||
var showEntity = {};
|
||||
for (var i = 0; i < data['entities'].length; i++) {
|
||||
|
|
|
@ -60,7 +60,7 @@ export class ContactComponent implements OnInit {
|
|||
this.email = {body: '', subject: '', recipients: []};
|
||||
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subscriptions.push( this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe());
|
||||
this.subscriptions.push( this._piwikService.trackView(this.properties, this.pageTitle).subscribe());
|
||||
}
|
||||
this.url = this.properties.domain + this._router.url;
|
||||
this.seoService.createLinkForCanonicalURL(this.url);
|
||||
|
|
|
@ -79,7 +79,7 @@ export class CuratorsComponent {
|
|||
if (community) {
|
||||
this.community = community;
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.community.communityId)).subscribe());
|
||||
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe());
|
||||
}
|
||||
this.url = this.properties.domain + this._router.url;
|
||||
this.seoService.createLinkForCanonicalURL(this.url);
|
||||
|
|
|
@ -86,7 +86,7 @@ export class ShareInZenodoComponent {
|
|||
this.communityId = community.communityId;
|
||||
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId);
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subs.push(this._piwikService.trackView(this.properties, this.title, this.piwikSiteId).subscribe());
|
||||
this.subs.push(this._piwikService.trackView(this.properties, this.title).subscribe());
|
||||
}
|
||||
this.community = community;
|
||||
this.masterZenodoCommunityId = this.community.zenodoCommunity;
|
||||
|
|
|
@ -52,7 +52,7 @@ export class GetStartedComponent implements OnInit {
|
|||
|
||||
ngOnInit() {
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe());
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe());
|
||||
}
|
||||
this.url = this.properties.domain + this.properties.baseLink + this._router.url;
|
||||
this.seoService.createLinkForCanonicalURL(this.url);
|
||||
|
|
|
@ -25,7 +25,7 @@ export class FeaturedPageComponent {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.subs.push(this.config.communityInformationState.subscribe((portal: Portal) => {
|
||||
this.subs.push(this.config.portalAsObservable.subscribe((portal: Portal) => {
|
||||
if (portal) {
|
||||
let pages: Page[] = <Page[]>portal.pages;
|
||||
this.page = pages.find(page => (page.route == this._router.url));
|
||||
|
|
|
@ -8,6 +8,7 @@ import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
|
|||
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
|
||||
import {Subscriber} from "rxjs";
|
||||
import {properties} from "../../environments/environment";
|
||||
import {ConfigurationService} from "../openaireLibrary/utils/configuration/configuration.service";
|
||||
|
||||
@Component({
|
||||
selector: 'html-page',
|
||||
|
@ -33,16 +34,16 @@ export class HtmlPageComponent {
|
|||
private _title: Title,
|
||||
private seoService: SEOService,
|
||||
private _piwikService: PiwikService,
|
||||
private configurationService: ConfigurationService,
|
||||
private helper: HelperService) {
|
||||
}
|
||||
|
||||
public ngOnInit() {
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe());
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe());
|
||||
}
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||
//TODO set the proper URL
|
||||
this.url = this.properties.domain + this._router.url;
|
||||
this.url = this.properties.domain + this.properties.baseLink + this._router.url;
|
||||
this.seoService.createLinkForCanonicalURL(this.url);
|
||||
this.updateUrl(this.url);
|
||||
this.updateTitle(this.pageTitle);
|
||||
|
|
|
@ -11,7 +11,7 @@ import {Breadcrumb} from "../../openaireLibrary/utils/breadcrumbs/breadcrumbs.co
|
|||
</div>
|
||||
<div class="uk-container uk-container-large uk-section uk-section-small uk-margin-medium-bottom">
|
||||
<h1 class="uk-margin-top uk-margin-large-bottom uk-width-1-2@m">Supporting Organizations</h1>
|
||||
<html-page description="Organizations" pageTitle="Supporting Organizations"></html-page>
|
||||
<html-page description="OpenAIRE - Connect, Community Gateway, research community, organizations" pageTitle="Supporting Organizations"></html-page>
|
||||
<affiliations [longView]="true" [getAffiliationsFromAPI]="true"></affiliations>
|
||||
</div>
|
||||
`
|
||||
|
|
|
@ -222,7 +222,7 @@ export class FaqsComponent {
|
|||
this.properties = properties;
|
||||
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe());
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe());
|
||||
}
|
||||
this.url = this.properties.baseLink + this._router.url;
|
||||
this.seoService.createLinkForCanonicalURL(this.url);
|
||||
|
|
|
@ -249,7 +249,7 @@ export class LearnHowComponent implements OnInit {
|
|||
|
||||
public ngOnInit() {
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe());
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe());
|
||||
}
|
||||
this.url = this.properties.baseLink + this._router.url;
|
||||
this.seoService.createLinkForCanonicalURL(this.url);
|
||||
|
|
|
@ -73,7 +73,7 @@ export class MyCommunitiesComponent {
|
|||
this.seoService.createLinkForCanonicalURL(url, false);
|
||||
this._meta.updateTag({content: url}, "property='og:url'");
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, "OpenAIRE Connect", this.properties.piwikSiteId).subscribe());
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, "OpenAIRE Connect").subscribe());
|
||||
}
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c547dfa9453b9a68befb41f447d8c410eb7aea2c
|
||||
Subproject commit 49e2edfe84d441bf1b5bf4bbfb7f94f98d88cb7a
|
|
@ -91,7 +91,7 @@ export class StatisticsComponent {
|
|||
if(community) {
|
||||
this.communityId = community.communityId;
|
||||
if (this.currentMode == "showInMonitor" && this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subs.push(this._piwikService.trackView(this.properties, "Monitor " + this.communityId, PiwikHelper.siteIDs[this.communityId]).subscribe());
|
||||
this.subs.push(this._piwikService.trackView(this.properties, "Monitor " + this.communityId).subscribe());
|
||||
}
|
||||
this.communityName = community.shortTitle;
|
||||
this.createChartUrlMap();
|
||||
|
@ -157,7 +157,7 @@ export class StatisticsComponent {
|
|||
|
||||
getCommunityInfo() {
|
||||
// console.log(`calling ${this.properties.adminToolsAPIURL}/communityFull/${this.communityId}`);
|
||||
this.subs.push(this._configService.communityInformationState.subscribe(
|
||||
this.subs.push(this._configService.portalAsObservable.subscribe(
|
||||
res => {
|
||||
this.communityInfo = res;
|
||||
/*for(let i=0; i<this.communityInfo.entities.length; i++){
|
||||
|
|
|
@ -363,7 +363,7 @@ export class SubjectsComponent {
|
|||
if (community) {
|
||||
this.communityId = community.communityId;
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId)).subscribe());
|
||||
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe());
|
||||
}
|
||||
this.getPageContents();
|
||||
this.displayedSubjects = community.subjects;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/**
|
||||
* @deprecated
|
||||
* */
|
||||
export class PiwikHelper{
|
||||
public static siteIDs = {
|
||||
"dh-ch":81,
|
||||
|
@ -39,6 +42,7 @@ export class PiwikHelper{
|
|||
"argo-france": 634,
|
||||
"knowmad": 640
|
||||
};
|
||||
|
||||
public static getSiteId(communityId:string){
|
||||
return this.siteIDs[communityId];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue