[Trunk | Library]: depositFirstPage.component & searchDataprovidersToDeposit.component: Add piwik in new deposit pages.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@56622 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-07-18 11:41:02 +00:00
parent df37f2328f
commit ddb5d82677
3 changed files with 27 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import {Component, Input} from '@angular/core';
import {ZenodoInformationClass} from './utils/zenodoInformation.class';
import {EnvProperties} from "../utils/properties/env-properties";
import {ActivatedRoute} from "@angular/router";
import {PiwikService} from "../utils/piwik/piwik.service";
@Component({
selector: 'deposit-first-page',
@ -143,13 +144,14 @@ import {ActivatedRoute} from "@angular/router";
export class DepositFirstPageComponent {
@Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
@Input() piwikSiteId = null;
piwiksub:any;
public keyword: string;
public depositRoute = "/search-deposit";
public searchPlaceHolder = "Search for repositories by title, country, organization, subject...";
properties:EnvProperties;
constructor (private route: ActivatedRoute) {}
constructor (private route: ActivatedRoute, private _piwikService:PiwikService) {}
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
@ -164,7 +166,16 @@ export class DepositFirstPageComponent {
if (!this.zenodoInformation.name) {
this.zenodoInformation.name = "Zenodo";
}
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, "Deposit your research (first page)", this.piwikSiteId).subscribe();
}
});
}
ngOnDestroy() {}
ngOnDestroy() {
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
}

View File

@ -10,6 +10,7 @@ import {SearchCustomFilter, SearchUtilsClass} from '../searchPages/searchUtils/s
import {EnvProperties} from '../utils/properties/env-properties';
import {StringUtils} from "../utils/string-utils.class";
import {ZenodoInformationClass} from "./utils/zenodoInformation.class";
import {PiwikService} from "../utils/piwik/piwik.service";
@Component({
selector: 'search-dataproviders',
@ -48,6 +49,7 @@ export class SearchDataprovidersToDepositComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
piwiksub:any;
@Input() customFilter:SearchCustomFilter= null;
public results =[];
public filters =[];
@ -73,7 +75,8 @@ export class SearchDataprovidersToDepositComponent {
@Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService) {
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService,
private _piwikService:PiwikService) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
@ -86,6 +89,10 @@ export class SearchDataprovidersToDepositComponent {
this.properties = data.envSpecific;
this.baseUrl = "/search-deposit";//data.envSpecific.searchLinkToDataProviders;
this.pagingLimit = data.envSpecific.pagingLimit;
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, "Deposit search page)", this.piwikSiteId).subscribe();
}
});
this.searchPage.refineFields = this.refineFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
@ -124,6 +131,10 @@ export class SearchDataprovidersToDepositComponent {
if(this.subResults){
this.subResults.unsubscribe();
}
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
public getResults(keyword:string,refine:boolean, page: number, size: number){

View File

@ -12,11 +12,13 @@ import {SearchFormModule} from '../searchPages/searchUtils/searchForm.module';
import {SearchPageModule} from '../searchPages/searchUtils/searchPage.module';
import {FreeGuard} from'../login/freeGuard.guard';
import {IsRouteEnabled} from '../error/isRouteEnabled.guard';
import {PiwikServiceModule} from "../utils/piwik/piwikService.module";
@NgModule({
imports: [
CommonModule, FormsModule,
RouterModule,
PiwikServiceModule,
DataProvidersServiceModule,
SearchFormModule, SearchResultsModule, SearchPageModule