in statistics: added check if entity is deactivated
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@51758 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
3b4a925203
commit
f452a63947
|
@ -3,6 +3,9 @@
|
||||||
<span>Most recent statistics</span>
|
<span>Most recent statistics</span>
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngIf="!statisticsSum || (statisticsSum.total_projects==0) || (allowedEntities.length == 0)" class="uk-alert uk-alert-info" style="margin-top:40px;">
|
||||||
|
No statistics are available for {{ communityId.toUpperCase() }}
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div *ngFor="let entity of allowedEntities">
|
<div *ngFor="let entity of allowedEntities">
|
||||||
<div *ngIf="statisticsSum[entity].total>0 && allowedCharts[entity].length>0">
|
<div *ngIf="statisticsSum[entity].total>0 && allowedCharts[entity].length>0">
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
<div class="uk-container uk-margin-bottom">
|
<div class="uk-container uk-margin-bottom">
|
||||||
|
|
||||||
<article class="uk-article ">
|
<article class="uk-article ">
|
||||||
<div *ngIf="!statisticsSum || (statisticsSum.total_projects==0)" class="uk-alert uk-alert-info" style="margin-top:40px; padding-left:40px;">
|
<div *ngIf="!statisticsSum || (statisticsSum.total_projects==0) || (allowedEntities.length == 0)" class="uk-alert uk-alert-info" style="margin-top:40px; padding-left:40px;">
|
||||||
No statistics are available for {{ communityId.toUpperCase() }}
|
No statistics are available for {{ communityId.toUpperCase() }}
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="statisticsSum && (statisticsSum.total_projects>0) && statisticsDisplay && chartsUrlMap" class="uk-margin uk-margin-top">
|
<div *ngIf="statisticsSum && (statisticsSum.total_projects>0) && statisticsDisplay" class="uk-margin uk-margin-top">
|
||||||
<div class="uk-grid">
|
<div class="uk-grid">
|
||||||
<ul class="uk-tab uk-tab-left uk-width-1-6 uk-margin-top" data-uk-tab="{connect:'#tabs'}">
|
<ul class="uk-tab uk-tab-left uk-width-1-6 uk-margin-top" data-uk-tab="{connect:'#tabs'}">
|
||||||
<li *ngFor="let entity of entitiesList"
|
<li *ngFor="let entity of allowedEntities"
|
||||||
(click)="onChangeEntity(entity)">
|
(click)="onChangeEntity(entity)">
|
||||||
|
|
||||||
<a href="#">{{ entitiesMap.get(entity) }}</a>
|
<a href="#">{{ entitiesMap.get(entity) }}</a>
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul id="tabs" class="uk-switcher uk-margin uk-width-5-6" style="min-height:450px; padding-left:40px;">
|
<ul id="tabs" class="uk-switcher uk-margin uk-width-5-6" style="min-height:450px; padding-left:40px;">
|
||||||
<li *ngFor="let entity of entitiesList">
|
<li *ngFor="let entity of allowedEntities">
|
||||||
<div *ngIf="(displayedEntity == entity) && statisticsSum[entity]">
|
<div *ngIf="(displayedEntity == entity) && statisticsSum[entity]">
|
||||||
<div class="uk-text-uppercase uk-text-bold uk-heading-divider">
|
<div class="uk-text-uppercase uk-text-bold uk-heading-divider">
|
||||||
<h2>{{ entitiesMap.get(entity) }} statistics</h2>
|
<h2>{{ entitiesMap.get(entity) }} statistics</h2>
|
||||||
|
|
|
@ -35,9 +35,9 @@ export class StatisticsComponent {
|
||||||
|
|
||||||
properties:EnvProperties;
|
properties:EnvProperties;
|
||||||
@Input() communityId = null;
|
@Input() communityId = null;
|
||||||
public communityInfo = null;
|
|
||||||
|
|
||||||
@Input() currentMode = 'showInMonitor';
|
@Input() currentMode = 'showInMonitor';
|
||||||
|
communityInfo: any = null;
|
||||||
entitiesList: string[] = [];
|
entitiesList: string[] = [];
|
||||||
entitiesMap: Map<string,string> = availableEntitiesMap;
|
entitiesMap: Map<string,string> = availableEntitiesMap;
|
||||||
chartCatsList: string[] = availableCharts;
|
chartCatsList: string[] = availableCharts;
|
||||||
|
@ -66,6 +66,7 @@ export class StatisticsComponent {
|
||||||
private _communityService:CommunityService,
|
private _communityService:CommunityService,
|
||||||
private _communitiesService:CommunitiesService,
|
private _communitiesService:CommunitiesService,
|
||||||
private _statisticsService: StatisticsService,
|
private _statisticsService: StatisticsService,
|
||||||
|
private _configService: ConfigurationService,
|
||||||
private titleCase: TitleCasePipe,
|
private titleCase: TitleCasePipe,
|
||||||
private sanitizer: DomSanitizer
|
private sanitizer: DomSanitizer
|
||||||
) {
|
) {
|
||||||
|
@ -105,7 +106,7 @@ export class StatisticsComponent {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
d
|
|
||||||
public ngOnDestroy() {
|
public ngOnDestroy() {
|
||||||
if(this.piwiksub){
|
if(this.piwiksub){
|
||||||
this.piwiksub.unsubscribe();
|
this.piwiksub.unsubscribe();
|
||||||
|
@ -143,21 +144,37 @@ d
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.createChartUrlMap();
|
this.createChartUrlMap();
|
||||||
this.initializeDisplayedCharts();
|
this.getCommunityInfo();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getCommunityInfo() {
|
||||||
|
console.log(`calling ${this.properties.adminToolsAPIURL}/communityFull/${this.communityId}`);
|
||||||
|
this._configService.getCommunityInformation(this.properties.adminToolsAPIURL, this.communityId).subscribe(
|
||||||
|
res => {
|
||||||
|
this.communityInfo = res;
|
||||||
|
/*for(let i=0; i<this.communityInfo.entities.length; i++){
|
||||||
|
|
||||||
|
if (this.communityInfo.entities[i]["isEnabled"] ) {
|
||||||
|
this.entitiesList.push(this.communityInfo.entities[i]['pid']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(this.entitiesList);*/
|
||||||
|
},
|
||||||
|
error => console.log(error),
|
||||||
|
() => this.initializeDisplayedCharts()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
if (this.statisticsDisplay.entities[entity] && this.statisticsSum[entity].total && this.communityInfo.entities.filter(x => x['pid'] == entity && x['isEnabled']===true).length ) {
|
||||||
console.log(`added ${entity} to allowedEntities`);
|
|
||||||
this.allowedEntities.push(entity);
|
|
||||||
this.allowedCharts[entity] = [];
|
this.allowedCharts[entity] = [];
|
||||||
for (let chart of this.chartCatsList){
|
for (let chart of this.chartCatsList){
|
||||||
if (this.statisticsSum[entity].total &&
|
if (this.statisticsSum[entity].total &&
|
||||||
|
@ -169,9 +186,13 @@ d
|
||||||
/*console.log(`added ${entity} - ${chart} to allowedCharts`);*/
|
/*console.log(`added ${entity} - ${chart} to allowedCharts`);*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!firstEntity){
|
if (this.allowedCharts[entity].length) {
|
||||||
firstEntity = entity;
|
console.log(`added ${entity} to allowedEntities`);
|
||||||
this.onChangeEntity(entity);
|
this.allowedEntities.push(entity);
|
||||||
|
if (!firstEntity){
|
||||||
|
firstEntity = entity;
|
||||||
|
this.onChangeEntity(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue