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">
<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">
No community chosen
</div>
@ -53,33 +53,33 @@
</p>
</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 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 *ngIf="publicationTotal != null">
<div>
<a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/publications" ><h3 class="uk-card-title">{{publicationTotal}}</h3>
<p>publications</p></a>
</div>
</div>
</div>
<div>
<div *ngIf="researchDataTotal != null && IsEntityEnabled('dataset')">
<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>
<p>research data</p></a>
</div>
</div>
</div>
<div>
<div *ngIf="softwareTotal != null && IsEntityEnabled('software')">
<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>
<p>software</p></a>
</div>
</div>
</div>
<div>
<div *ngIf="projectTotal != null && IsEntityEnabled('project')">
<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>
<p>projects</p></a>
</div>
@ -93,9 +93,9 @@
</div>
</div>
</div> -->
<div>
<div *ngIf="contentProviderTotal != null && IsEntityEnabled('datasource')">
<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>
<p>content providers</p></a>
</div>
@ -103,7 +103,7 @@
</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">
Most recent research results
</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)]=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>
</ul>
</ul>-->
<!-- <div *ngIf="communityId != null && communityId != ''" class="uk-grid-small uk-margin-medium uk-grid" uk-grid="">
<div class="uk-width-expand@m">
@ -134,16 +134,37 @@
</h2>
<results-comp [(results)]=researchDataResults [(total)]=researchDataTotal resultType="dataset" [community]=community [params]=params></results-comp>
</div>
<div class="uk-width-expand@m">
<!--<div class="uk-width-expand@m">
<h2 class="uk-h3 uk-heading-line uk-text-primary">
<span>Most recent software</span>
</h2>
<results-comp [(results)]=softwareResults [(total)]=softwareTotal resultType="software" [community]=community [params]=params></results-comp>
</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>
<statistics-for-dashboard [currentMode]="'showInDashboard'"></statistics-for-dashboard>
</article>
</div>

View File

@ -48,6 +48,8 @@ export class CommunityComponent {
@Input() communityId = null;
public community = null;
public communityInfo = null;
constructor (
private route: ActivatedRoute,
private _router: Router,
@ -159,6 +161,14 @@ export class CommunityComponent {
// 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();
}
}
IsEntityEnabled(entity: string) {
return this.communityInfo.entities.some(x => x['pid'] == entity && x['isEnabled']===true);
}
}

View File

@ -1,5 +1,6 @@
<div>
<h2 class="uk-h3 uk-text-primary">
<div class="uk-margin-large-top">
<h2 class="uk-h3 uk-text-primary uk-heading-line">
<span>Most recent statistics</span>
</h2>
</div>
@ -20,3 +21,4 @@
</div>
</div>
</div>
</div>