[Trunk|Admin]:

1. app.component: use CommunitiesService with subject functionality (updateCommunities() & getCommunitiesState()).
2. wellcome.component: Change message & if user logged in, show communities he manages.


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@55412 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-04-23 11:33:35 +00:00
parent 497e523c70
commit 68ade81676
4 changed files with 151 additions and 21 deletions

View File

@ -54,12 +54,14 @@ export class AppComponent {
this.isPortalAdministrator = Session.isPortalAdministrator();
/*this.isPortalAdministrator = true;*/
}
this._communitiesService.updateCommunities(this.properties, this.properties.communityAPI + "communities");
this.route.queryParams.subscribe(data => {
this.communityId = ((data['communityId']) ? data['communityId'] : "");
this.communityType = null;
this.menuItems = [];
this.userMenuItems = [];
this._communitiesService.getCommunities(this.properties, this.properties.communityAPI + "communities").subscribe(
this._communitiesService.getCommunitiesState().subscribe(
communities => {
// this.community = community;
this.userMenuItems = [];

View File

@ -1,36 +1,154 @@
import { Component, Input } from '@angular/core';
import {Component, Input, OnInit} from '@angular/core';
import { Location } from '@angular/common';
import {Session} from "../../openaireLibrary/login/utils/helper.class";
import {MenuItem} from "../../openaireLibrary/sharedComponents/menu";
import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properties";
import {ActivatedRoute} from "@angular/router";
import {EnvironmentSpecificService} from "../../openaireLibrary/utils/properties/environment-specific.service";
import {CommunitiesService} from "../../openaireLibrary/connect/communities/communities.service";
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
@Component({
selector: 'wellcome',
template: `
<div class="image-front-topbar uk-section-default" tm-header-transparent="light" tm-header-transparent-placeholder="">
<div class="wellcomePage uk-width-1-1 uk-margin-left uk-margin-top uk-background-norepeat uk-background-cover uk-background-top-center uk-section uk-padding-remove-bottom uk-flex uk-flex-middle" uk-height-viewport="offset-top: true;offset-bottom: 20" style="box-sizing: border-box; min-height: calc(-113.367px + 100vh); height: calc(-113.367px + 100vh);">
<div class="uk-width-1-1">
<div class="uk-position-relative">
<div class="uk-container uk-margin-medium">
<div class="tm-header-placeholder uk-margin-medium" style=""></div>
<div class="search_box_bg uk-grid-large uk-flex-middle uk-grid uk-grid-stack" uk-grid="">
<!-- <div class="image-front-topbar uk-section-default" tm-header-transparent="light" tm-header-transparent-placeholder="">-->
<!-- <div class="wellcomePage uk-width-1-1 uk-margin-left uk-margin-top uk-background-norepeat uk-background-cover uk-background-top-center uk-section uk-padding-remove-bottom uk-flex uk-flex-middle" uk-height-viewport="offset-top: true;offset-bottom: 20" style="box-sizing: border-box; min-height: calc(-113.367px + 100vh); height: calc(-113.367px + 100vh);">-->
<!-- <div class="uk-width-1-1">-->
<!-- <div class="uk-position-relative">-->
<div class="uk-width-1-1@m uk-first-column">
<h1 class="uk-text-left uk-heading-hero uk-text-primary uk-scrollspy-inview uk-animation-slide-top" uk-scrollspy-class="" style="">
Research Community <br>Administration Dashboard
</h1>
<h2 class="uk-text-left uk-scrollspy-inview uk-animation-slide-top" uk-scrollspy-class="" style="">
Are you a community manager?<br> Configure your Research Community Dashboard
</h2>
</div>
<div class="image-front-topbar uk-section-default" tm-header-transparent="light" tm-header-transparent-placeholder="">
<div class="wellcomePage uk-width-1-1 uk-margin-left uk-margin-top uk-background-norepeat uk-background-cover uk-background-top-center uk-section uk-padding-remove-bottom" uk-height-viewport="offset-top: true;offset-bottom: 20" style="box-sizing: border-box; min-height: calc(-113.367px + 100vh); height: calc(-113.367px + 100vh);">
<div class="uk-position-relative">
<!-- <div class="image-front-topbar uk-section-secondary uk-section-overlap uk-position-relative uk-preserve-color" uk-scrollspy="{&quot;target&quot;:&quot;[uk-scrollspy-class]&quot;,&quot;cls&quot;:&quot;uk-animation-fade&quot;,&quot;delay&quot;:false}" tm-header-transparent="light" tm-header-transparent-placeholder="">-->
<!-- <div style=" min-height: calc(7.89999px + 60vh);"-->
<!-- class=" wellcomePage uk-background-norepeat uk-background-cover uk-section uk-padding-remove-bottom" >-->
<!-- <div class="uk-position-cover" style=""></div>-->
<!-- <div class="uk-position-relative uk-panel">-->
<!-- <div class="uk-position-relative uk-panel">-->
<div class="uk-container uk-section uk-margin-medium">
<!-- <div class="tm-header-placeholder uk-margin-medium" style=""></div>-->
<!-- <div class="search_box_bg uk-grid-large uk-flex-middle uk-grid uk-grid-stack" uk-grid="">-->
</div>
<!-- <div class="uk-width-1-1@m uk-first-column">-->
<!-- <h1 class="uk-text-left uk-heading-hero uk-text-primary uk-scrollspy-inview uk-animation-slide-top" uk-scrollspy-class="" style="">-->
<!-- Research Community <br>Administration Dashboard-->
<!-- </h1>-->
<!-- <h2 class="uk-text-left uk-scrollspy-inview uk-animation-slide-top" uk-scrollspy-class="" style="">-->
<!-- Are you a community manager?<br> Configure your Research Community Dashboard-->
<!-- </h2>-->
<!-- </div>-->
<h3 class="uk-margin-remove-bottom">Embrace Open Science with OpenAIRE Connect</h3>
<h5 class="uk-margin-remove-top">A platform to manage your community profile and to share, access and link community research results</h5>
<div *ngIf="communities.length == 0" class="uk-width-1-2 uk-inline uk-margin-large-top uk-margin-large-bottom">
<div class="uk-position-center ">
<div class="uk-width-medium uk-text-center">
<h5>Create and manage your research community page</h5>
<div>
<a class="uk-button portal-button" href="https://beta.connect.openaire.eu/how-to-create-community"> LEARN HOW</a>
</div>
</div>
</div>
<br>
</div>
<div *ngIf="communities.length > 0" class="uk-container uk-section uk-margin-medium">
<div class="uk-container">
<div class="uk-grid-match uk-grid-small uk-child-width-1-3@m uk-child-width-1-2@s uk-child-width-1-1@xs
uk-text-center" uk-grid>
<div *ngFor="let community of communities;">
<div class="uk-padding-small uk-height-max-medium uk-card uk-card-default">
<div class="uk-container" *ngIf="community" >
<span>
<div class="uk-card-media-top">
<a [queryParams]="{communityId: community.communityId}" routerLinkActive="router-link-active" routerLink="/dashboard">
<div style="" class="uk-margin-auto communitiesImageBox">
<img *ngIf= "community.logoUrl != null && community.logoUrl != '' "
src="{{community.logoUrl}}" alt="{{(community.title)?community.title:community.shortTitle}}
logo" class="uk-height-small uk-responsive-height uk-padding-small">
<span *ngIf= "community.logoUrl == null || community.logoUrl == '' " class="uk-icon uk-padding-small">
<svg width="50" height="37" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="2.5">
<circle fill="none" stroke="#000" stroke-width="1.1" cx="7.7" cy="8.6" r="3.5"></circle>
<path fill="none" stroke="#000" stroke-width="1.1"
d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3">
</path>
<path fill="none" stroke="#000" stroke-width="1.1"
d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1">
</path>
</svg>
</span>
</div>
<div class="uk-text-center">
<p class="uk-text-small uk-text-bold uk-margin-small uk-margin-small-top community-title">
<a>
<span class="uk-text-small uk-margin-small" *ngIf="community.title" >
{{community.title}}
</span>
<span class="uk-text-small uk-margin-small" *ngIf="!community.title && community.shortTitle" >
{{community.shortTitle}}
</span>
</a>
</p>
</div>
</a>
</div>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- </div>-->
</div>
</div>
</div>
</div>
</div>
<!-- </div>-->
`
})
export class WellcomeComponent {
export class WellcomeComponent implements OnInit {
properties: EnvProperties = null;
public communities: CommunityInfo[] = [];
constructor( private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService, private _communitiesService: CommunitiesService) {}
ngOnInit() {
this.propertiesService.loadEnvironment().then(es => {
this.propertiesService.setEnvProperties(es);
this.properties = this.propertiesService.envSpecific;
//this._communitiesService.getCommunities(this.properties, this.properties.communityAPI + 'communities').subscribe(
this._communitiesService.getCommunitiesState().subscribe(
communities => {
var countCommunities = 0;
var index_managerOfCommunity = null;
for (var i = 0; i < communities.length; i++) {
var com = communities[i];
if (Session.isPortalAdministrator() || Session.isCommunityCurator()) {
this.communities.push(communities[i]);
} else {
for (var manager of com.managers) {
if (manager == Session.getUserEmail()) {
countCommunities++;
index_managerOfCommunity = i;
this.communities.push(communities[i]);
break;
}
}
}
}
});
});
}
}

View File

@ -2,12 +2,17 @@ import { NgModule } from '@angular/core';
import {WellcomeComponent} from './wellcome.component';
import {WellcomeRoutingModule} from './wellcome-routing.module';
import {RouterModule} from '@angular/router';
import {CommunitiesService} from '../../openaireLibrary/connect/communities/communities.service';
//import { EnvironmentSpecificResolver} from '../../openaireLibrary/utils/properties/environmentSpecificResolver';
import { EnvironmentSpecificService} from '../../openaireLibrary/utils/properties/environment-specific.service';
import { CommonModule } from '@angular/common';
@NgModule({
imports: [
WellcomeRoutingModule, RouterModule
CommonModule, WellcomeRoutingModule, RouterModule
],
declarations: [WellcomeComponent],
providers: [EnvironmentSpecificService],
exports: [WellcomeComponent]
})
export class WellcomeModule { }

View File

@ -100,3 +100,8 @@
border-color:var(--portal-main-color) !important;
border-bottom-color: var(--portal-main-color) !important;
}
.communitiesImageBox{
width:284px; height:109px;
/*width:107px; height:57px;*/
}