Menu items: don;t add community id parameter for production

Piwik: 
	add new piwik ids for aginfra, clarin
	in monitor: track piwik only for monitor - not when component is used from dashboard
		set the proper title and community id
Monitor: hide hr when there are not the charts above it


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@52386 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2018-06-07 10:11:16 +00:00
parent 3a25d0c4af
commit bde2f196d6
5 changed files with 34 additions and 26 deletions

View File

@ -87,12 +87,11 @@ export class AppComponent {
items: [new MenuItem("","Publications","","/search/find/publications",false,["publication"],["/search/find/publications"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}), items: [new MenuItem("","Publications","","/search/find/publications",false,["publication"],["/search/find/publications"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
new MenuItem("","Research Data","","/search/find/datasets",false,["dataset"],["/search/find/datasets"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}), new MenuItem("","Research Data","","/search/find/datasets",false,["dataset"],["/search/find/datasets"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
new MenuItem("","Software","","/search/find/software",false,["software"],["/search/find/software"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}), new MenuItem("","Software","","/search/find/software",false,["software"],["/search/find/software"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
new MenuItem("","Projects","","/search/find/projects/",false,["project"],["/search/find/projects"],{communityId: community.communityId}), new MenuItem("","Projects","","/search/find/projects/",false,["project"],["/search/find/projects"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
new MenuItem("","Content Providers","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],{communityId: community.communityId}), new MenuItem("","Content Providers","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
// new MenuItem("","Organizations","","/search/find/organizations/",false,["organization"],["/search/find/organizations"],{community: community.communityId}),
]}, ]},
{ {
rootItem: new MenuItem("monitor","Monitor","","/monitor",false,[],["/statistics"],{communityId:community.communityId}), rootItem: new MenuItem("monitor","Monitor","","/monitor",false,[],["/statistics"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
items: [] items: []
}, },
{ {

View File

@ -100,7 +100,14 @@
<iframe [src]=displayedGraphUrl width="1000" height="450"></iframe> <iframe [src]=displayedGraphUrl width="1000" height="450"></iframe>
</div> </div>
</div> </div>
<hr> <hr *ngIf="(statisticsDisplay.entities[entity].charts.map['timeline'] &&
statisticsDisplay.entities[entity].charts.map['timeline'][currentMode] &&
chartsUrlMap[entity + 'Timeline'] &&
(displayedTimeline == (entity + 'Timeline'))) || (statisticsDisplay.entities[entity].charts.map['graph'] &&
statisticsDisplay.entities[entity].charts.map['graph'][currentMode] &&
chartsUrlMap[entity + 'Graph'] &&
(displayedGraph == (entity + 'Graph')))">
<div *ngIf="statisticsDisplay.entities[entity].charts.map['projectColumn'][currentMode] || <div *ngIf="statisticsDisplay.entities[entity].charts.map['projectColumn'][currentMode] ||
statisticsDisplay.entities[entity].charts.map['projectPie'][currentMode] || statisticsDisplay.entities[entity].charts.map['projectPie'][currentMode] ||
statisticsDisplay.entities[entity].charts.map['projectTable'][currentMode]"> statisticsDisplay.entities[entity].charts.map['projectTable'][currentMode]">

View File

@ -23,6 +23,7 @@ import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
import {availableCharts, availableEntitiesMap, StatisticsDisplay, import {availableCharts, availableEntitiesMap, StatisticsDisplay,
StatisticsSummary StatisticsSummary
} from "../openaireLibrary/connect/statistics/statisticsEntities"; } from "../openaireLibrary/connect/statistics/statisticsEntities";
import {PiwikHelper} from '../utils/piwikHelper';
@Component({ @Component({
selector: 'statistics', selector: 'statistics',
@ -90,9 +91,6 @@ export class StatisticsComponent {
this.properties = data.envSpecific; this.properties = data.envSpecific;
var url = data.envSpecific.baseLink+this._router.url; var url = data.envSpecific.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')){
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE").subscribe();
}
this.route.queryParams.subscribe( this.route.queryParams.subscribe(
communityId => { communityId => {
@ -100,7 +98,10 @@ export class StatisticsComponent {
if(!this.communityId){ if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname); this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
} }
console.log(" Stats! "+ this.properties.statisticsAPIURL); if(this.currentMode == "showInMonitor" && this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, "Monitor "+ this.communityId, PiwikHelper.siteIDs[this.communityId]).subscribe();
}
// console.log(" Stats! "+ this.properties.statisticsAPIURL);
this.createStatisticsObjects(); this.createStatisticsObjects();
}); });
}); });
@ -120,7 +121,7 @@ export class StatisticsComponent {
} }
createStatisticsObjects() { createStatisticsObjects() {
console.log(" Stats! "+ this.properties.statisticsAPIURL); // console.log(" Stats! "+ this.properties.statisticsAPIURL);
this._statisticsService.getCommunityStatistics(this.properties.statisticsAPIURL,this.communityId).subscribe ( this._statisticsService.getCommunityStatistics(this.properties.statisticsAPIURL,this.communityId).subscribe (
res => { res => {
console.log('statisticsSum is:'); console.log('statisticsSum is:');
@ -152,7 +153,7 @@ export class StatisticsComponent {
getCommunityInfo() { getCommunityInfo() {
console.log(`calling ${this.properties.adminToolsAPIURL}/communityFull/${this.communityId}`); // console.log(`calling ${this.properties.adminToolsAPIURL}/communityFull/${this.communityId}`);
this._configService.getCommunityInformation(this.properties.adminToolsAPIURL, this.communityId).subscribe( this._configService.getCommunityInformation(this.properties.adminToolsAPIURL, this.communityId).subscribe(
res => { res => {
this.communityInfo = res; this.communityInfo = res;
@ -172,8 +173,8 @@ export class StatisticsComponent {
initializeDisplayedCharts() { initializeDisplayedCharts() {
let firstEntity: string; let firstEntity: string;
this.entitiesList = Array.from( this.entitiesMap.keys() ); this.entitiesList = Array.from( this.entitiesMap.keys() );
console.log('this.entitiesList is',this.entitiesList); // console.log('this.entitiesList is',this.entitiesList);
console.log(`my current mode is: ${this.currentMode}`); // console.log(`my current mode is: ${this.currentMode}`);
for (let entity of this.entitiesList) { for (let entity of this.entitiesList) {
if (this.statisticsDisplay.entities[entity] && this.statisticsSum[entity].total && this.communityInfo.entities.filter(x => x['pid'] == entity && x['isEnabled']===true).length ) { if (this.statisticsDisplay.entities[entity] && this.statisticsSum[entity].total && this.communityInfo.entities.filter(x => x['pid'] == entity && x['isEnabled']===true).length ) {
this.allowedCharts[entity] = []; this.allowedCharts[entity] = [];
@ -188,7 +189,7 @@ export class StatisticsComponent {
} }
} }
if (this.allowedCharts[entity].length) { if (this.allowedCharts[entity].length) {
console.log(`added ${entity} to allowedEntities`); // console.log(`added ${entity} to allowedEntities`);
this.allowedEntities.push(entity); this.allowedEntities.push(entity);
if (!firstEntity){ if (!firstEntity){
firstEntity = entity; firstEntity = entity;
@ -222,19 +223,19 @@ export class StatisticsComponent {
onChangeEntity (entity: string) { onChangeEntity (entity: string) {
this.displayedEntity = entity; this.displayedEntity = entity;
console.log(`displayed entity is ${entity}`); // console.log(`displayed entity is ${entity}`);
console.log(`statisticsSum[${entity}].total is ${this.statisticsSum[entity].total}`); // console.log(`statisticsSum[${entity}].total is ${this.statisticsSum[entity].total}`);
if (this.statisticsSum[entity].total && if (this.statisticsSum[entity].total &&
this.allowedEntities.filter(x => x == entity).length ) { this.allowedEntities.filter(x => x == entity).length ) {
console.log(`found ${entity} in allowedEntities`); // console.log(`found ${entity} in allowedEntities`);
this.displayedTimeline = `${entity}Timeline`; this.displayedTimeline = `${entity}Timeline`;
this.displayedTimelineUrl = this.chartsUrlMap[this.displayedTimeline]; this.displayedTimelineUrl = this.chartsUrlMap[this.displayedTimeline];
console.log(`displayed Timeline is: ${this.displayedTimeline}`); // console.log(`displayed Timeline is: ${this.displayedTimeline}`);
this.displayedGraph = `${entity}Graph`; this.displayedGraph = `${entity}Graph`;
this.displayedGraphUrl = this.chartsUrlMap[this.displayedGraph]; this.displayedGraphUrl = this.chartsUrlMap[this.displayedGraph];
console.log(`displayed Graph is: ${this.displayedGraph}`); // console.log(`displayed Graph is: ${this.displayedGraph}`);
if (this.allowedCharts[entity]) { if (this.allowedCharts[entity]) {
let firstProjectChart = this.allowedCharts[entity].filter( x => x.includes(entity+'Project') ); let firstProjectChart = this.allowedCharts[entity].filter( x => x.includes(entity+'Project') );
if (firstProjectChart[0]) { if (firstProjectChart[0]) {
@ -242,23 +243,23 @@ export class StatisticsComponent {
} else { } else {
this.displayedProjectChart = ''; this.displayedProjectChart = '';
this.displayedProjectChartUrl = ''; this.displayedProjectChartUrl = '';
console.log(`displayed ProjectChart is: ${this.displayedProjectChart}`); // console.log(`displayed ProjectChart is: ${this.displayedProjectChart}`);
} }
} }
} else { } else {
this.displayedTimeline = ''; this.displayedTimeline = '';
this.displayedTimelineUrl = ''; this.displayedTimelineUrl = '';
console.log(`displayed Timeline is: ${this.displayedTimeline}`); // console.log(`displayed Timeline is: ${this.displayedTimeline}`);
this.displayedGraph = ''; this.displayedGraph = '';
this.displayedGraphUrl = ''; this.displayedGraphUrl = '';
console.log(`displayed Graph is: ${this.displayedGraph}`); // console.log(`displayed Graph is: ${this.displayedGraph}`);
} }
} }
changeDisplayedProjectChart(chartName: string) { changeDisplayedProjectChart(chartName: string) {
this.displayedProjectChart = chartName; this.displayedProjectChart = chartName;
this.displayedProjectChartUrl = this.chartsUrlMap[this.displayedProjectChart]; this.displayedProjectChartUrl = this.chartsUrlMap[this.displayedProjectChart];
console.log(`displayed ProjectChart is: ${this.displayedProjectChart}`); // console.log(`displayed ProjectChart is: ${this.displayedProjectChart}`);
} }
} }

View File

@ -11,7 +11,8 @@ export class PiwikHelper{
"ni":88, "ni":88,
"oa-pg":89, "oa-pg":89,
"rda":90, "rda":90,
"aginfra":93 "aginfra":93,
"clarin":100
} }
} }

View File

@ -22,7 +22,7 @@
.mainPageSearchForm { .mainPageSearchForm {
background-image: url("./home.jpg"); background-image: url("./home.jpg") !important;
background-color: rgb(255, 255, 255); background-color: rgb(255, 255, 255);
box-sizing: border-box; box-sizing: border-box;
min-height: calc(100vh - 412.767px); min-height: calc(100vh - 412.767px);