changed dashboard layout to show only enabled entities

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@51847 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
myrto.koukouli 2018-04-18 10:31:33 +00:00
parent 70d8375acc
commit eb6712b0b5
3 changed files with 68 additions and 31 deletions

View File

@ -2,7 +2,7 @@
<div class="uk-container uk-margin-bottom"> <div class="uk-container uk-margin-bottom">
<article class="uk-article "> <article *ngIf="communityInfo" class="uk-article ">
<div *ngIf="communityId == null || communityId == ''" class="uk-child-width-1-6@l uk-child-width-1-6@m uk-child-width-1-3@s uk-text-center uk-alert uk-alert-primary"> <div *ngIf="communityId == null || communityId == ''" class="uk-child-width-1-6@l uk-child-width-1-6@m uk-child-width-1-3@s uk-text-center uk-alert uk-alert-primary">
No community chosen No community chosen
</div> </div>
@ -53,33 +53,33 @@
</p> </p>
</div> </div>
<div *ngIf="communityId != null && communityId != ''" class="uk-child-width-1-6@l uk-child-width-1-6@m uk-child-width-1-3@s uk-text-center uk-grid" uk-grid=""> <div *ngIf="communityId != null && communityId != ''" class="uk-child-width-1-6@l uk-child-width-1-6@m uk-child-width-1-3@s uk-text-center uk-grid" uk-grid="">
<div class="uk-first-column"> <div *ngIf="publicationTotal != null && IsEntityEnabled('publication')" class="uk-first-column">
<div class="uk-card uk-card-default uk-card-small uk-card-body"> <div class="uk-card uk-card-default uk-card-small uk-card-body">
<div *ngIf="publicationTotal != null"> <div>
<a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/publications" ><h3 class="uk-card-title">{{publicationTotal}}</h3> <a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/publications" ><h3 class="uk-card-title">{{publicationTotal}}</h3>
<p>publications</p></a> <p>publications</p></a>
</div> </div>
</div> </div>
</div> </div>
<div> <div *ngIf="researchDataTotal != null && IsEntityEnabled('dataset')">
<div class="uk-card uk-card-default uk-card-small uk-card-body"> <div class="uk-card uk-card-default uk-card-small uk-card-body">
<div *ngIf="researchDataTotal != null"> <div>
<a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/datasets"><h3 class="uk-card-title">{{researchDataTotal}}</h3> <a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/datasets"><h3 class="uk-card-title">{{researchDataTotal}}</h3>
<p>research data</p></a> <p>research data</p></a>
</div> </div>
</div> </div>
</div> </div>
<div> <div *ngIf="softwareTotal != null && IsEntityEnabled('software')">
<div class="uk-card uk-card-default uk-card-small uk-card-body"> <div class="uk-card uk-card-default uk-card-small uk-card-body">
<div *ngIf="softwareTotal != null"> <div>
<a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/software"><h3 class="uk-card-title">{{softwareTotal}}</h3> <a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/software"><h3 class="uk-card-title">{{softwareTotal}}</h3>
<p>software</p></a> <p>software</p></a>
</div> </div>
</div> </div>
</div> </div>
<div> <div *ngIf="projectTotal != null && IsEntityEnabled('project')">
<div class="uk-card uk-card-default uk-card-small uk-card-body"> <div class="uk-card uk-card-default uk-card-small uk-card-body">
<div *ngIf="projectTotal != null"> <div>
<a routerLinkActive="router-link-active" routerLink="/search/find/projects"><h3 class="uk-card-title">{{projectTotal}}</h3> <a routerLinkActive="router-link-active" routerLink="/search/find/projects"><h3 class="uk-card-title">{{projectTotal}}</h3>
<p>projects</p></a> <p>projects</p></a>
</div> </div>
@ -93,9 +93,9 @@
</div> </div>
</div> </div>
</div> --> </div> -->
<div> <div *ngIf="contentProviderTotal != null && IsEntityEnabled('datasource')">
<div class="uk-card uk-card-default uk-card-small uk-card-body"> <div class="uk-card uk-card-default uk-card-small uk-card-body">
<div *ngIf="contentProviderTotal != null"> <div>
<a routerLinkActive="router-link-active" routerLink="/search/find/dataproviders"><h3 class="uk-card-title">{{contentProviderTotal}}</h3> <a routerLinkActive="router-link-active" routerLink="/search/find/dataproviders"><h3 class="uk-card-title">{{contentProviderTotal}}</h3>
<p>content providers</p></a> <p>content providers</p></a>
</div> </div>
@ -103,7 +103,7 @@
</div> </div>
</div> </div>
<div class="uk-grid-small uk-margin-medium uk-grid" uk-grid=""> <!--<div class="uk-grid-small uk-margin-medium uk-grid" uk-grid="">
<h2 class="uk-h3 uk-heading-line uk-text-primary"> <h2 class="uk-h3 uk-heading-line uk-text-primary">
Most recent research results Most recent research results
</h2> </h2>
@ -119,7 +119,7 @@
<li><results-comp [(results)]=publicationResults [(total)]=publicationTotal resultType="publication" [community]=community [params]=params></results-comp></li> <li><results-comp [(results)]=publicationResults [(total)]=publicationTotal resultType="publication" [community]=community [params]=params></results-comp></li>
<li><results-comp [(results)]=researchDataResults [(total)]=researchDataTotal resultType="dataset" [community]=community [params]=params></results-comp></li> <li><results-comp [(results)]=researchDataResults [(total)]=researchDataTotal resultType="dataset" [community]=community [params]=params></results-comp></li>
<li><results-comp [(results)]=softwareResults [(total)]=softwareTotal resultType="software" [community]=community [params]=params></results-comp></li> <li><results-comp [(results)]=softwareResults [(total)]=softwareTotal resultType="software" [community]=community [params]=params></results-comp></li>
</ul> </ul>-->
<!-- <div *ngIf="communityId != null && communityId != ''" class="uk-grid-small uk-margin-medium uk-grid" uk-grid=""> <!-- <div *ngIf="communityId != null && communityId != ''" class="uk-grid-small uk-margin-medium uk-grid" uk-grid="">
<div class="uk-width-expand@m"> <div class="uk-width-expand@m">
@ -134,16 +134,37 @@
</h2> </h2>
<results-comp [(results)]=researchDataResults [(total)]=researchDataTotal resultType="dataset" [community]=community [params]=params></results-comp> <results-comp [(results)]=researchDataResults [(total)]=researchDataTotal resultType="dataset" [community]=community [params]=params></results-comp>
</div> </div>
<div class="uk-width-expand@m"> <!--<div class="uk-width-expand@m">
<h2 class="uk-h3 uk-heading-line uk-text-primary"> <h2 class="uk-h3 uk-heading-line uk-text-primary">
<span>Most recent software</span> <span>Most recent software</span>
</h2> </h2>
<results-comp [(results)]=softwareResults [(total)]=softwareTotal resultType="software" [community]=community [params]=params></results-comp> <results-comp [(results)]=softwareResults [(total)]=softwareTotal resultType="software" [community]=community [params]=params></results-comp>
</div> </div>
</div> --> </div> -->
<div> <div>
<statistics-for-dashboard [currentMode]="'showInDashboard'"></statistics-for-dashboard> <div class="uk-margin-large-top">
<h2 class="uk-h3 uk-text-primary">
Most recent research results
</h2>
</div>
<ul class="uk-tab uk-margin-top" data-uk-tab="{connect: '#resultTabs'">
<li *ngIf="IsEntityEnabled('publication')" class="uk-active"><a href="#">publications</a></li>
<li *ngIf="IsEntityEnabled('dataset')"><a href="#">research data</a></li>
<li *ngIf="IsEntityEnabled('software')"><a href="#">software</a></li>
</ul>
<ul id="resultTabs" class="uk-switcher" style="min-height:450px;">
<li *ngIf="IsEntityEnabled('publication')"><results-comp [(results)]=publicationResults [(total)]=publicationTotal resultType="publication" [community]=community [params]=params></results-comp></li>
<li *ngIf="IsEntityEnabled('dataset')"><results-comp [(results)]=researchDataResults [(total)]=researchDataTotal resultType="dataset" [community]=community [params]=params></results-comp></li>
<li *ngIf="IsEntityEnabled('software')"><results-comp [(results)]=softwareResults [(total)]=softwareTotal resultType="software" [community]=community [params]=params></results-comp></li>
</ul>
</div> </div>
<statistics-for-dashboard [currentMode]="'showInDashboard'"></statistics-for-dashboard>
</article> </article>
</div> </div>

View File

@ -48,6 +48,8 @@ export class CommunityComponent {
@Input() communityId = null; @Input() communityId = null;
public community = null; public community = null;
public communityInfo = null;
constructor ( constructor (
private route: ActivatedRoute, private route: ActivatedRoute,
private _router: Router, private _router: Router,
@ -159,6 +161,14 @@ export class CommunityComponent {
// console.log(organizationTotal); // console.log(organizationTotal);
// }); // });
/**/
this.config.getCommunityInformation(this.properties.adminToolsAPIURL, this.communityId).subscribe(
res => {
this.communityInfo = res;
},
error => console.log(error)
);
} }
}); });
} }
@ -168,4 +178,8 @@ export class CommunityComponent {
this.piwiksub.unsubscribe(); this.piwiksub.unsubscribe();
} }
} }
IsEntityEnabled(entity: string) {
return this.communityInfo.entities.some(x => x['pid'] == entity && x['isEnabled']===true);
}
} }

View File

@ -1,20 +1,22 @@
<div> <div>
<h2 class="uk-h3 uk-text-primary"> <div class="uk-margin-large-top">
<span>Most recent statistics</span> <h2 class="uk-h3 uk-text-primary uk-heading-line">
</h2> <span>Most recent statistics</span>
</div> </h2>
<div *ngIf="!statisticsSum || (statisticsSum.total_projects==0) || (allowedEntities.length == 0)" class="uk-alert uk-alert-info" style="margin-top:40px;"> </div>
No statistics are available for {{ communityId.toUpperCase() }} <div *ngIf="!statisticsSum || (statisticsSum.total_projects==0) || (allowedEntities.length == 0)" class="uk-alert uk-alert-info" style="margin-top:40px;">
</div> No statistics are available for {{ communityId.toUpperCase() }}
<div> </div>
<div *ngFor="let entity of allowedEntities"> <div>
<div *ngIf="statisticsSum[entity].total>0 && allowedCharts[entity].length>0"> <div *ngFor="let entity of allowedEntities">
<div class="uk-text-uppercase uk-text-bold uk-heading-divider"> <div *ngIf="statisticsSum[entity].total>0 && allowedCharts[entity].length>0">
<h3>{{ entitiesMap.get(entity) }}</h3> <div class="uk-text-uppercase uk-text-bold uk-heading-divider">
</div> <h3>{{ entitiesMap.get(entity) }}</h3>
<div *ngIf="allowedCharts[entity]" class="uk-grid"> </div>
<div *ngFor="let chart of allowedCharts[entity]" class="uk-width-1-2@l uk-width-1-1@m uk-first-column"> <div *ngIf="allowedCharts[entity]" class="uk-grid">
<iframe [src]=chartsUrlMap[chart] width="750" height="450"></iframe> <div *ngFor="let chart of allowedCharts[entity]" class="uk-width-1-2@l uk-width-1-1@m uk-first-column">
<iframe [src]=chartsUrlMap[chart] width="750" height="450"></iframe>
</div>
</div> </div>
</div> </div>
</div> </div>