Merge remote-tracking branch 'origin/develop'

This commit is contained in:
Konstantinos Triantafyllou 2025-10-19 22:49:59 +03:00
commit a25a301652
11 changed files with 149 additions and 1112 deletions

View File

@ -3,7 +3,7 @@
</div>
<div *ngIf="loading == false">
<div id="modal-container"></div>
<navbar #navbar *ngIf="hasHeader" portal="connect-admin" [header]="menuHeader" [communityId]="community ? community.communityId : null"
<navbar #navbar *ngIf="hasHeader" portal="connect-admin" [header]="menuHeader" [communityId]="community ? community.communityId : null"
[userMenuItems]=userMenuItems [menuItems]="menuItems" [user]="user">
<div *ngIf="showGetStarted" extra-s class="uk-margin-large-top uk-margin-left">
<a class="uk-button uk-button-primary uk-text-uppercase" href="https://connect.openaire.eu" (click)="navbar.closeCanvas()">Get Started</a>

@ -1 +1 @@
Subproject commit 1c762d0fcd1ed4de19756c99d37afef04c631e90
Subproject commit f219f32adbdcc408adf48f6b77585ea8f6d5ee8f

View File

@ -23,10 +23,6 @@ import {ConnectRIGuard} from "../openaireLibrary/connect/communityGuard/connectR
param: 'community'
}
},
{
path: 'stats',
loadChildren: () => import('./stats/stats.module').then(m => m.StatsModule)
},
{
path: 'customize-layout',
loadChildren: () => import('./customization/customization.module').then(m => m.CustomizationModule),

View File

@ -2,8 +2,7 @@
<div actions>
<div class="uk-section-xsmall uk-margin-top">
<div class="uk-flex uk-flex-middle">
<div
class="uk-width-expand@m uk-width-1-1 uk-grid uk-flex-middle uk-flex-right@m uk-flex-center uk-margin-remove-left"
<div class="uk-width-expand@m uk-width-1-1 uk-grid uk-flex-middle uk-flex-right@m uk-flex-center uk-margin-remove-left"
uk-grid>
<div class="uk-alert ">Any research product with an author affiliated to any of the organisations will be
tagged for your community and included in your gateway. Information about the organisation comes from the
@ -18,70 +17,73 @@
</div>
</div>
<div inner>
<div *ngIf="loading">
<loading></loading>
</div>
<div *ngIf="!loading">
<div *ngIf="propagatedOrganizations.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No affiliations for {{ community.shortTitle }}</div>
</div>
<div *ngIf="enhancedOrgsInfo ">
<no-load-paging (pageChange)="updatePage($event)" [page]="page" [totalResults]="propagatedOrganizations.length"
[pageSize]="pageSize"
[type]="'affiliation' + (propagatedOrganizations.length > 1?'s':'')">
</no-load-paging>
<div class="uk-grid uk-grid-large uk-child-width-1-1 uk-child-width-1-2@m uk-margin-top uk-margin-bottom"
uk-grid>
<div *ngFor="let affiliation of currentPage; let i=index">
<div class="uk-card uk-card-default">
<div class="uk-card-body uk-padding-medium">
<!--<div class="uk-flex uk-flex-center uk-height-xsmall">
<img class="uk-height-max-xsmall uk-blend-multiply uk-width-small" [src]="affiliation.logo_url | urlPrefix">
</div>-->
<h5 [title]="affiliation.title"
class="uk-margin-small-bottom">{{ affiliation.title ? affiliation.title : affiliation.acronym }}{{ affiliation.title == affiliation.acronym ? '' : ('(' + affiliation.acronym + ')') }}</h5>
<div class="uk-margin-small-bottom uk-text-left">
<span class="uk-label uk-label-small uk-label-warning"
*ngIf="!affiliation.tagged">not processed yet</span>
<span class="uk-label uk-label-small uk-margin-xsmall-left"
*ngIf="affiliation.subscribed">subscribed</span>
<div class="uk-text-small uk-margin-xsmall-top">
<div *ngIf="isAdmin()"><span class="uk-text-meta">ID: </span>{{ affiliation.id }}</div>
<div><span class="uk-text-meta"> <a
[href]="'https://' + ((properties.environment !== 'production')?'beta.':'') + this.community.communityId + '.openaire.eu/search/organization?organizationId='+ affiliation.id"
target="_blank"> View in the gateway</a></span></div>
<div *ngIf="affiliation.websiteURL"><span class="uk-text-meta">Website URL: </span> <a
[href]="affiliation.websiteURL">{{ affiliation.websiteURL }}</a></div>
<div *ngIf="affiliation.description"><span class="uk-text-meta">
Description <span *ngIf="affiliation.subscribed" (click)="openEdit(affiliation)" class="uk-link"> <icon name="edit" ></icon> </span></span>
</div>
</div>
<div [innerHTML]="affiliation.description"></div>
</div>
</div>
<!--<div *ngIf="affiliation.subscribed" class="uk-card-footer uk-padding-remove-vertical">
<div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid>
<div>
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="openEdit(affiliation)"
class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon name="edit" [flex]="true"></icon>
<span class="uk-margin-xsmall-left">Edit</span>
</a>
</div>
</div>
</div>
</div>-->
</div>
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<div *ngIf="loading" class="uk-position-center">
<loading></loading>
</div>
<div *ngIf="!loading">
<div *ngIf="enhancedOrganizations.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No affiliations for {{ community.shortTitle }}</div>
</div>
<div *ngIf="enhancedMap ">
<no-load-paging (pageChange)="updatePage($event)" [page]="page" [totalResults]="enhancedOrganizations.length"
[pageSize]="pageSize"
[type]="'affiliation' + (enhancedOrganizations.length > 1?'s':'')">
</no-load-paging>
<div class="uk-grid uk-grid-large uk-child-width-1-1 uk-child-width-1-2@m uk-margin-top uk-margin-bottom"
uk-grid uk-height-match="target: .uk-card-body; row: false;">
<div *ngFor="let affiliation of currentPage; let i=index">
<div class="uk-card uk-card-default">
<div class="uk-card-body">
<div class="uk-grid uk-flex-top" uk-grid>
<div class="uk-margin-right">
<img *ngIf="affiliation.logoUrl" class="uk-height-max-xsmall uk-blend-multiply" [src]="affiliation.logoUrl | urlPrefix">
<img *ngIf="!affiliation.logoUrl" class="uk-height-max-xsmall uk-blend-multiply" src="assets/common-assets/placeholder.png">
</div>
<h6 class="uk-margin-remove-top uk-width-expand" [title]="affiliation.title">{{ affiliation.title ? affiliation.title : affiliation.acronym }}{{ affiliation.title == affiliation.acronym ? '' : ('(' + affiliation.acronym + ')') }}</h6>
</div>
<div class="uk-margin-top uk-flex uk-flex-middle">
<span class="uk-label uk-label-small uk-label-warning"
*ngIf="!affiliation.tagged">not processed yet</span>
<span class="uk-label uk-label-small uk-label-secondary" [class.uk-margin-small-left]="!affiliation.tagged"
*ngIf="affiliation.subscribed">subscribed</span>
</div>
<div class="uk-margin-top uk-text-small">
<div *ngIf="isAdmin()"><span class="uk-text-meta">ID: </span>{{ affiliation.orgId }}</div>
<div *ngIf="affiliation.websiteURL"><span class="uk-text-meta">Website URL: </span> <a [href]="affiliation.websiteURL">{{ affiliation.websiteURL }}</a></div>
<div *ngIf="affiliation.description" class="uk-margin-top uk-text-meta">
Description
</div>
</div>
<div [innerHTML]="affiliation.description"></div>
</div>
<div class="uk-card-footer uk-padding-remove-vertical">
<div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid>
<div class="uk-padding-small uk-padding-remove-horizontal">
<a [href]="'https://' + ((properties.environment !== 'production')?'beta.':'') + this.community.communityId + '.openaire.eu/search/organization?organizationId='+ affiliation.orgId"
class="uk-button uk-button-link uk-flex uk-flex-middle" target="_blank">
<icon name="visibility" [flex]="true"></icon>
<span class="uk-margin-xsmall-left">View in gateway</span>
</a>
</div>
<div *ngIf="affiliation.subscribed">
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="openEdit(affiliation)"
class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon name="edit" [flex]="true"></icon>
<span class="uk-margin-xsmall-left">Edit</span>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@ -89,7 +91,7 @@
(alertOutput)="saveOrganization()" classTitle="uk-background-primary uk-light">
<form *ngIf="organizationFb" [formGroup]="organizationFb">
<div class="uk-grid uk-child-width-1-1" uk-grid>
<!--<div input placeholder="Description" [formInput]="organizationFb.get('description')"></div>-->
<div input placeholder="Logo URL" [formInput]="organizationFb.get('logoUrl')"></div>
<ckeditor [readonly]="false"
debounce="500"
[formControl]="organizationFb.get('description')"
@ -103,4 +105,4 @@
</div>
</form>
</modal-alert>
</modal-alert>

View File

@ -12,37 +12,45 @@ import {SearchOrganizationsService} from "../../openaireLibrary/services/searchO
import {AlertModalModule} from "../../openaireLibrary/utils/modal/alertModal.module";
import {InputModule} from "../../openaireLibrary/sharedComponents/input/input.module";
import {SharedModule} from "../../openaireLibrary/shared/shared.module";
import {UntypedFormBuilder, UntypedFormGroup, Validators} from "@angular/forms";
import {UntypedFormBuilder, UntypedFormGroup} from "@angular/forms";
import {AlertModal} from "../../openaireLibrary/utils/modal/alert";
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
import {NoLoadPaging} from "../../openaireLibrary/searchPages/searchUtils/no-load-paging.module";
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
import {Session} from "../../openaireLibrary/login/utils/helper.class";
import {Session, User} from "../../openaireLibrary/login/utils/helper.class";
import {UserManagementService} from "../../openaireLibrary/services/user-management.service";
import {CKEditorModule} from "ng2-ckeditor";
import {LoadingModule} from "../../openaireLibrary/utils/loading/loading.module";
import {IconsModule} from "../../openaireLibrary/utils/icons/icons.module";
import {CommunityInfo, PropagatedOrganization} from "../../openaireLibrary/connect/community/communityInfo";
import {UrlPrefixModule} from "../../openaireLibrary/utils/pipes/url-prefix.module";
export interface EnhancedOrganization extends PropagatedOrganization {
title: string;
acronym: string;
websiteURL: string;
propagated: boolean;
tagged: boolean
}
@Component({
selector: 'propagated-organizations',
templateUrl: './propagated-organizations.component.html',
standalone: true,
imports: [CommonModule, PageContentModule, OrganizationsServiceModule, AlertModalModule, InputModule, SharedModule, NoLoadPaging, CKEditorModule, IconsModule, LoadingModule]
imports: [CommonModule, PageContentModule, OrganizationsServiceModule, AlertModalModule, InputModule, SharedModule, NoLoadPaging, CKEditorModule, IconsModule, LoadingModule, UrlPrefixModule]
})
export class PropagatedOrganizationsComponent extends BaseComponent {
public propagatedOrganizations;
enhancedOrgsInfo;
idsToSearch;
community;
public enhancedOrganizations: EnhancedOrganization[] = [];
enhancedMap: Map<string, EnhancedOrganization>;
idsToSearch: string[];
community: CommunityInfo;
loading = true;
public page: number = 1;
public pageSize: number = 10;
public organizationFb: UntypedFormGroup;
public editingOrganization;
user;
public editOrganization: PropagatedOrganization;
user: User;
@ViewChild('organizationModal') organizationModal: AlertModal;
constructor(private httpClient: HttpClient, private communityService: CommunityService,
@ -61,77 +69,78 @@ export class PropagatedOrganizationsComponent extends BaseComponent {
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => {
this.community = community;
if (this.community) {
this.title = (this.community.shortTitle.toUpperCase() + (this.communityService.selectedSubCommunity?':'+this.communityService.selectedSubCommunity?.label:"") + ' | ' + OpenaireEntities.ORGANIZATIONS);
this.title = (this.community.shortTitle.toUpperCase() + (this.communityService.selectedSubCommunity ? ':' + this.communityService.selectedSubCommunity?.label : "") + ' | ' + OpenaireEntities.ORGANIZATIONS);
this.setMetadata();
this.getPropagatedOrgs();
this.getPropagatedOrganizations();
}
}));
}
//from community API
getPropagatedOrgs() {
this.subscriptions.push(this.httpClient.get(properties.communityAPI + this.community.communityId + "/propagationOrganizations").subscribe(res => {
getPropagatedOrganizations() {
this.subscriptions.push(this.communityService.getPropagatedOrganizations(this.community.communityId).subscribe(res => {
this.getTagged(res);
}));
}
getTagged(propagatedOrgs) {
getTagged(propagatedOrganizations: PropagatedOrganization[]) {
//from index
this.subscriptions.push(this.searchOrganizationsService.searchOrganizations("fq=communityId exact " + this.community.communityId,
"", 1, propagatedOrgs.length, [], properties).subscribe(res => {
"", 1, propagatedOrganizations.length, [], properties).subscribe(res => {
this.idsToSearch = [];
this.enhancedOrgsInfo = new Map();
this.enhancedMap = new Map();
for (let org of res[1]) {
this.enhancedOrgsInfo.set(org.id, {
id: org.id,
this.enhancedMap.set(org.id, {
orgId: org.id,
logoUrl: null,
subscribed: false,
title: org.title.name,
acronym: org.acronym,
tagged: true,
propagated: false,
subscribed: false,
description: "",
websiteURL: org.websiteURL
})
}
for (let org of propagatedOrgs) {
if (this.enhancedOrgsInfo.has(org.orgId)) {
this.enhancedOrgsInfo.get(org.orgId)['propagated'] = true;
this.enhancedOrgsInfo.get(org.orgId)['subscribed'] = org.subscribed;
this.enhancedOrgsInfo.get(org.orgId)['description'] = org.description;
for (let propagated of propagatedOrganizations) {
if (this.enhancedMap.has(propagated.orgId)) {
this.enhancedMap.get(propagated.orgId).propagated = true;
this.enhancedMap.get(propagated.orgId).subscribed = propagated.subscribed;
this.enhancedMap.get(propagated.orgId).description = propagated.description;
this.enhancedMap.get(propagated.orgId).logoUrl = propagated.logoUrl;
} else {
this.idsToSearch.push(org.orgId);
this.enhancedOrgsInfo.set(org.orgId, {
id: org.orgId,
this.idsToSearch.push(propagated.orgId);
this.enhancedMap.set(propagated.orgId, {
orgId: propagated.orgId,
logoUrl: propagated.logoUrl,
subscribed: propagated.subscribed,
description: propagated.description,
title: "n/a",
acronym: "n/a",
tagged: false,
propagated: true,
subscribed: org.subscribed,
description: org.description,
websiteURL: ""
})
}
}
if(this.idsToSearch.length > 0) {
if (this.idsToSearch.length > 0) {
this.enrichedOrgsNotTaggedYet();
}else {
} else {
this.prepareAffiliationsList();
}
}));
}
enrichedOrgsNotTaggedYet(){
//from index info
this.subscriptions.push(this.searchOrganizationsService.advancedSearchOrganizations("objIdentifier="+ this.idsToSearch.join(" or objIdentifier="),
1, this.idsToSearch.length, properties, "&type=organizations").subscribe(res => {
enrichedOrgsNotTaggedYet() {
//from index info
this.subscriptions.push(this.searchOrganizationsService.advancedSearchOrganizations("objIdentifier=" + this.idsToSearch.join(" or objIdentifier="),
1, this.idsToSearch.length, properties, "&type=organizations").subscribe(res => {
// advancedSearchOrganizations (params: string, page: number, size: number, properties:EnvProperties,
// refineParams:string=null, refineFields:string[] =null, refineQuery:string = null, minRef: boolean = false):any {
for (let org of res[1]) {
console.log(org)
this.enhancedOrgsInfo.get(org.id)['title'] = org.title.name;
this.enhancedOrgsInfo.get(org.id)['acronym'] = org.acronym;
this.enhancedOrgsInfo.get(org.id)['websiteURL'] = org.websiteURL;
this.enhancedMap.get(org.id).title= org.title.name;
this.enhancedMap.get(org.id).acronym = org.acronym;
this.enhancedMap.get(org.id).websiteURL = org.websiteURL;
}
this.prepareAffiliationsList();
}, error => {
@ -139,11 +148,12 @@ export class PropagatedOrganizationsComponent extends BaseComponent {
}));
}
prepareAffiliationsList(){
this.propagatedOrganizations = Array.from(this.enhancedOrgsInfo.values())
this.propagatedOrganizations.sort((a, b) => {
const nameA = (a.title?a.title:a.acronym).toLowerCase();
const nameB = (b.title?b.title:b.acronym).toLowerCase();
prepareAffiliationsList() {
this.enhancedOrganizations = Array.from(this.enhancedMap.values())
this.enhancedOrganizations.sort((a, b) => {
const nameA = (a.title ? a.title : a.acronym).toLowerCase();
const nameB = (b.title ? b.title : b.acronym).toLowerCase();
if (nameA < nameB) {
return -1;
}
@ -154,21 +164,26 @@ export class PropagatedOrganizationsComponent extends BaseComponent {
// names must be equal
return 0;
});
this.propagatedOrganizations.sort((a, b) => {
this.enhancedOrganizations.sort((a, b) => {
return (a.subscribed === b.subscribed) ? 0 : a.subscribed ? -1 : 1;
});
this.loading = false;
}
isAdmin(){
isAdmin() {
return Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user);
}
openEdit(org) {
this.editingOrganization = org
if (this.editingOrganization) {
this.organizationModal.alertTitle = 'Edit Organization: ' + this.editingOrganization.acronym;
openEdit(organization: EnhancedOrganization) {
this.editOrganization = <PropagatedOrganization> organization;
if (this.editOrganization) {
this.organizationModal.alertTitle = 'Edit Organization: ' + organization.acronym;
this.organizationModal.okButtonText = 'Update';
this.organizationFb = this.fb.group({
description: this.fb.control(this.editingOrganization.description),
orgId: this.fb.control(this.editOrganization.orgId),
subscribed: this.fb.control(this.editOrganization.subscribed),
logoUrl: this.fb.control(this.editOrganization.logoUrl),
description: this.fb.control(this.editOrganization.description),
});
this.organizationModal.okButtonLeft = false;
this.organizationModal.cancelButtonText = 'Cancel';
@ -178,28 +193,26 @@ export class PropagatedOrganizationsComponent extends BaseComponent {
saveOrganization() {
this.loading = true;
this.subscriptions.push(this.httpClient.post(properties.communityAPI + this.community.communityId
+ "/propagationOrganizations?organizationId=" + encodeURIComponent(this.editingOrganization.id) +
"&description=" + encodeURIComponent(this.organizationFb.value.description), "").subscribe(res => {
this.editingOrganization.description = this.organizationFb.value.description;
this.subscriptions.push(this.communityService.savePropagatedOrganization(this.community.communityId, this.organizationFb.value).subscribe(res => {
this.editOrganization.logoUrl = this.organizationFb.value.logoUrl;
this.editOrganization.description = this.organizationFb.value.description;
this._clearCacheService.purgeBrowserCache("Organization added/ updated", this.community.communityId);
this.loading = false;
}));
}
public updatePage(event) {
HelperFunctions.scroll();
this.page = event.value;
}
get currentPage(): any[] {
if (this.propagatedOrganizations) {
return this.propagatedOrganizations.slice((this.page - 1) * this.pageSize, this.page * this.pageSize);
get currentPage(): EnhancedOrganization[] {
if (this.enhancedOrganizations) {
return this.enhancedOrganizations.slice((this.page - 1) * this.pageSize, this.page * this.pageSize);
} else {
return [];
}
}
}
}

View File

@ -1,12 +0,0 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {StatsComponent} from './stats.component';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '',component: StatsComponent}
])
]
})
export class StatsRoutingModule { }

View File

@ -1,495 +0,0 @@
<div id="stats">
<div id="contentWrapper" class="content-wrapper">
<div>
<div class="contentPanel uk-margin-top">
<!-- <div *ngIf="errorMessage" class="uk-alert-danger uk-alert">{{ errorMessage }}</div>
<div *ngIf="loadingMessage" class="loading-big">
<div class="loader-big" style="text-align: center; padding-top: 170px; color: rgb(47, 64, 80); font-weight: bold;">{{ loadingMessage }}</div>
<div class="whiteFilm"></div>
</div> -->
<div *ngIf="statisticsSum" class="page-title uk-article-title">
Statistics
<mat-slide-toggle class="uk-margin-small-left" *ngIf="statisticsDisplay" title="Show/Hide all indicators" [checked]="statisticsDisplay.isActive"
(change)="toggleShowGraphAnalysisView()"></mat-slide-toggle>
</div>
<div *ngIf="updateErrorMessage" class="uk-alert uk-alert-danger" role="alert">{{updateErrorMessage}}</div>
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
<div *ngIf="showLoading" class="uk-animation-fade uk-width-1-1" role="alert"><img class="uk-align-center loading-gif"></div>
<div *ngIf="statisticsSum" class="uk-alert uk-alert-primary uk-margin-top-large">
<div class="uk-flex uk-flex-middle">
<span class="uk-margin-small-right uk-icon uk-icon-justify" uk-icon="warning"></span>
<span>
Options for showing/hiding statistics from the Community Gateway's Overview and Graph Analysis view.<br>
Indicators won't be shown in Community Gateway when the numbers are 0 or the dependent entity is deactivated in spite of their status.
</span>
</div>
</div>
<div *ngIf="!statisticsSum" class="uk-alert uk-alert-primary uk-margin-top-large">
<div class="uk-flex uk-flex-middle">
<span class="uk-margin-small-right uk-icon uk-icon-justify" uk-icon="warning"></span>
<span>
There are no available statistics for your community yet.<br>
</span>
</div>
</div>
<div *ngIf="communityId">
<div class="users-list">
<div class="col-md-12">
<article class="uk-article ">
<div *ngIf="statisticsDisplay && chartsInfoMap"
class="uk-margin uk-margin-top">
<div>
<ul class="uk-tab uk-margin-top" data-uk-tab="{connect:'#tabs'}">
<li *ngFor="let entity of entitiesList"
(click)="onChangeEntity(entity)">
<a href="#">{{ entitiesMap.get(entity) }}</a>
</li>
</ul>
<ul id="tabs" class="uk-switcher" style="min-height:450px;">
<li *ngFor="let entity of entitiesList">
<div *ngIf="(displayedEntity == entity)">
<div class="uk-heading-divider">
<h4 class="uk-text-capitalize">{{ entitiesMap.get(entity) }} <small *ngIf="deactivatedEntity" class="uk-text-danger uk-text-small">(this entity has been deactivated)</small></h4>
<div uk-grid>
<div class="uk-width-1-3">
<div class="uk-flex uk-flex-middle uk-padding uk-padding-remove-top" uk-grid>
<div class="uk-card portal-card uk-text-right uk-padding-small uk-width-1-2">
<div
class="uk-text-large">{{statisticsSum[entity].total|number}}</div>
<div>Total
{{ entity == 'dataset' ? 'research data' : entitiesMap.get(entity) }}</div>
</div>
<div class="uk-width-expand">
<table class="uk-table uk-table-striped uk-width-expand@m uk-width-1-1@l">
<thead>
<tr>
<th>Show</th>
<th class="uk-text-center">#</th>
</tr>
</thead>
<tbody>
<tr>
<th>In Graph Analysis</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].numbers.map['total'].showInMonitor"
(change)="$event.checked = statisticsDisplay.entities[entity].numbers.map['total'].showInMonitor;
toggleShowInMonitor(entity,'numbers','total')"></mat-slide-toggle>
</th>
</tr>
<tr>
<th>In Overview</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].numbers.map['total'].showInDashboard"
(change)="$event.checked = statisticsDisplay.entities[entity].numbers.map['total'].showInDashboard;
toggleShowInDashboard(entity,'numbers','total')"></mat-slide-toggle>
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="uk-width-1-3">
<div class="uk-flex uk-flex-middle uk-padding uk-padding-remove-top" uk-grid>
<div class="uk-card portal-card uk-text-right uk-padding-small uk-width-1-2">
<div
class="uk-text-large">{{statisticsSum[entity].projects|number}}</div>
<div>Total projects linked to
{{ entity == 'dataset' ? 'research data' : entitiesMap.get(entity) }}</div>
</div>
<div class="uk-width-expand">
<table class="uk-table uk-table-striped uk-width-expand@m uk-width-1-1@l">
<thead>
<tr>
<th>Show</th>
<th class="uk-text-center">#</th>
</tr>
</thead>
<tbody>
<tr>
<th>In Graph Analysis</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].numbers.map['project'].showInMonitor"
(change)="$event.checked = statisticsDisplay.entities[entity].numbers.map['project'].showInMonitor;
toggleShowInMonitor(entity,'numbers','project')"></mat-slide-toggle>
</th>
</tr>
<tr>
<th>In Overview</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].numbers.map['project'].showInDashboard"
(change)="$event.checked = statisticsDisplay.entities[entity].numbers.map['project'].showInDashboard;
toggleShowInDashboard(entity,'numbers','project')"></mat-slide-toggle>
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="uk-width-1-3">
<div class="uk-flex uk-flex-middle uk-padding uk-padding-remove-top" uk-grid>
<div class="uk-card portal-card uk-text-right uk-padding-small uk-width-1-2">
<div
class="uk-text-large">{{statisticsSum[entity].open_access|number}}</div>
<div>Open Access
{{ entity == 'dataset' ? 'research data' : entitiesMap.get(entity) }}</div>
</div>
<div class="uk-width-expand">
<table class="uk-table uk-table-striped uk-width-expand@m uk-width-1-1@l">
<thead>
<tr>
<th>Show</th>
<th class="uk-text-center">#</th>
</tr>
</thead>
<tbody>
<tr>
<th>In Graph Analysis</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].numbers.map['open'].showInMonitor"
(change)="$event.checked = statisticsDisplay.entities[entity].numbers.map['open'].showInMonitor;
toggleShowInMonitor(entity,'numbers','open')"></mat-slide-toggle>
</th>
</tr>
<tr>
<th>In Overview</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].numbers.map['open'].showInDashboard"
(change)="$event.checked = statisticsDisplay.entities[entity].numbers.map['open'].showInDashboard;
toggleShowInDashboard(entity,'numbers','open')"></mat-slide-toggle>
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="uk-width-1-3">
<div class="uk-flex uk-flex-middle uk-padding uk-padding-remove-top" uk-grid>
<div class="uk-card portal-card uk-text-right uk-padding-small uk-width-1-2">
<div
class="uk-text-large">{{statisticsSum[entity].closed_access|number}}</div>
<div>Closed Access
{{ entity == 'dataset' ? 'research data' : entitiesMap.get(entity) }}</div>
</div>
<div class="uk-width-expand">
<table class="uk-table uk-table-striped uk-width-expand@m uk-width-1-1@l">
<thead>
<tr>
<th>Show</th>
<th class="uk-text-center">#</th>
</tr>
</thead>
<tbody>
<tr>
<th>In Graph Analysis</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].numbers.map['closed'].showInMonitor"
(change)="$event.checked = statisticsDisplay.entities[entity].numbers.map['closed'].showInMonitor;
toggleShowInMonitor(entity,'numbers','closed')"></mat-slide-toggle>
</th>
</tr>
<tr>
<th>In Overview</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].numbers.map['closed'].showInDashboard"
(change)="$event.checked = statisticsDisplay.entities[entity].numbers.map['closed'].showInDashboard;
toggleShowInDashboard(entity,'numbers','closed')"></mat-slide-toggle>
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="uk-width-1-3">
<div class="uk-flex uk-flex-middle uk-padding uk-padding-remove-top" uk-grid>
<div class="uk-card portal-card uk-text-right uk-padding-small uk-width-1-2">
<div
class="uk-text-large">{{statisticsSum[entity].restricted|number}}</div>
<div>Restricted
{{ entity == 'dataset' ? 'research data' : entitiesMap.get(entity) }}</div>
</div>
<div class="uk-width-expand">
<table class="uk-table uk-table-striped uk-width-expand@m uk-width-1-1@l">
<thead>
<tr>
<th>Show</th>
<th class="uk-text-center">#</th>
</tr>
</thead>
<tbody>
<tr>
<th>In Graph Analysis</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].numbers.map['restricted'].showInMonitor"
(change)="$event.checked = statisticsDisplay.entities[entity].numbers.map['restricted'].showInMonitor;
toggleShowInMonitor(entity,'numbers','restricted')"></mat-slide-toggle>
</th>
</tr>
<tr>
<th>In Overview</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].numbers.map['restricted'].showInDashboard"
(change)="$event.checked = statisticsDisplay.entities[entity].numbers.map['restricted'].showInDashboard;
toggleShowInDashboard(entity,'numbers','restricted')"></mat-slide-toggle>
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="uk-width-1-3">
<div class="uk-flex uk-flex-middle uk-padding uk-padding-remove-top" uk-grid>
<div class="uk-card portal-card uk-text-right uk-padding-small uk-width-1-2">
<div
class="uk-text-large">{{statisticsSum[entity].embargo|number}}</div>
<div>Embargo
{{ entity == 'dataset' ? 'research data' : entitiesMap.get(entity) }}</div>
</div>
<div class="uk-width-expand">
<table class="uk-table uk-table-striped uk-width-expand@m uk-width-1-1@l">
<thead>
<tr>
<th>Show</th>
<th class="uk-text-center">#</th>
</tr>
</thead>
<tbody>
<tr>
<th>In Graph Analysis</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].numbers.map['embargo'].showInMonitor"
(change)="$event.checked = statisticsDisplay.entities[entity].numbers.map['embargo'].showInMonitor;
toggleShowInMonitor(entity,'numbers','embargo')"></mat-slide-toggle>
</th>
</tr>
<tr>
<th>In Overview</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].numbers.map['embargo'].showInDashboard"
(change)="$event.checked = statisticsDisplay.entities[entity].numbers.map['embargo'].showInDashboard;
toggleShowInDashboard(entity,'numbers','embargo')"></mat-slide-toggle>
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div *ngIf="statisticsDisplay.entities[entity].charts.map['timeline'] &&
chartsInfoMap[entity + 'Timeline']"
class="uk-grid">
<div class="uk-width-expand@m uk-width-3-4@l">
<div class=" iframeContainer uk-height-large uk-margin-top">
<iframe [src]=chartsInfoMap[displayedTimeline].url scrolling="no" class=""></iframe>
</div>
</div>
<div class="uk-margin-top">
<h6>Display options</h6>
<table class="uk-table uk-table-striped uk-width-expand@m uk-width-1-1@l">
<thead>
<tr>
<th>Show</th>
<th class="uk-text-center">#</th>
</tr>
</thead>
<tbody>
<tr>
<th>In Graph Analysis</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].charts.map['timeline'].showInMonitor"
(change)="$event.checked = statisticsDisplay.entities[entity].charts.map['timeline'].showInMonitor;
toggleShowInMonitor(entity,'charts','timeline')"></mat-slide-toggle>
</th>
</tr>
<tr>
<th>In Overview</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].charts.map['timeline'].showInDashboard"
(change)="$event.checked = statisticsDisplay.entities[entity].charts.map['timeline'].showInDashboard;
toggleShowInDashboard(entity,'charts','timeline')"></mat-slide-toggle>
</th>
</tr>
</tbody>
</table>
</div>
</div>
<hr>
<div *ngIf="statisticsDisplay.entities[entity].charts.map['graph'] &&
chartsInfoMap[entity + 'Graph']"
class="uk-grid">
<div class="uk-width-expand@m uk-width-3-4@l">
<div class=" iframeContainer uk-height-large uk-margin-top">
<iframe [src]=chartsInfoMap[displayedGraph].url scrolling="no" class=""></iframe>
</div>
</div>
<div class="uk-margin-top">
<h6>Display options</h6>
<table class="uk-table uk-table-striped uk-width-expand@m uk-width-1-1@l">
<thead>
<tr>
<th>Show</th>
<th class="uk-text-center">#</th>
</tr>
</thead>
<tbody>
<tr>
<th>In Graph Analysis</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].charts.map['graph'].showInMonitor"
(change)="$event.checked = statisticsDisplay.entities[entity].charts.map['graph'].showInMonitor;
toggleShowInMonitor(entity,'charts','graph')"></mat-slide-toggle>
</th>
</tr>
<tr>
<th>In Overview</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].charts.map['graph'].showInDashboard"
(change)="$event.checked = statisticsDisplay.entities[entity].charts.map['graph'].showInDashboard;
toggleShowInDashboard(entity,'charts','graph')"></mat-slide-toggle>
</th>
</tr>
</tbody>
</table>
</div>
</div>
<hr>
</div>
<div>
<h5 class="uk-text-uppercase uk-text-bold">{{ entitiesMap.get(entity) }} per project</h5>
</div>
<div class="uk-grid">
<div class="uk-width-3-4@l uk-width-1-1@m uk-first-column">
<ul class="uk-tab uk-margin-top" data-uk-tab="{connect: '#projectChartTabs'">
<li *ngIf="statisticsDisplay.entities[entity].charts.map['projectColumn'] && chartsInfoMap[entity + 'Projectcolumn']"
(click)="changeDisplayedProjectChart(entity + 'Projectcolumn')">
<a href="#">Columns</a>
</li>
<li *ngIf=" statisticsDisplay.entities[entity].charts.map['projectPie'] && chartsInfoMap[entity + 'Projectpie']"
(click)="changeDisplayedProjectChart(entity + 'Projectpie')">
<a href="#">Pie</a>
</li>
<li *ngIf=" statisticsDisplay.entities[entity].charts.map['projectTable'] && chartsInfoMap[entity + 'Projecttable']"
(click)="changeDisplayedProjectChart(entity + 'Projecttable')">
<a href="#">Table</a>
</li>
</ul>
<ul id="projectChartTabs" class="uk-switcher uk-margin">
<li>
<div *ngIf="displayedProjectChart == (entity + 'Projectcolumn')">
<div class=" iframeContainer uk-height-large uk-margin-top">
<iframe [src]=chartsInfoMap[displayedProjectChart].url scrolling="no" class=""></iframe>
</div>
</div>
</li>
<li>
<div *ngIf="displayedProjectChart == (entity + 'Projectpie')">
<div class=" iframeContainer uk-height-large uk-margin-top">
<iframe [src]=chartsInfoMap[displayedProjectChart].url scrolling="no" class=""></iframe>
</div>
</div>
</li>
<li>
<div *ngIf="displayedProjectChart == (entity + 'Projecttable')">
<div class=" iframeContainer uk-height-large uk-margin-top">
<iframe [src]=chartsInfoMap[displayedProjectChart].url scrolling="no" class=""></iframe>
</div>
</div>
</li>
</ul>
</div>
<div class="uk-width-1-4@l uk-width-1-1@m uk-margin-top uk-first-column">
<h6>Display options</h6>
<table class="uk-table uk-table-striped">
<thead>
<tr>
<th>Show</th>
<th>Column</th>
<th>Pie</th>
<th>Table</th>
<th>All</th>
</tr>
</thead>
<tbody>
<tr>
<th>In Graph Analysis</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].charts.map['projectColumn'].showInMonitor"
(change)="$event.checked = statisticsDisplay.entities[entity].charts.map['projectColumn'].showInMonitor;
toggleShowInMonitor(entity,'charts','projectColumn')"></mat-slide-toggle>
</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].charts.map['projectPie'].showInMonitor"
(change)="$event.checked = statisticsDisplay.entities[entity].charts.map['projectPie'].showInMonitor;
toggleShowInMonitor(entity,'charts','projectPie')"></mat-slide-toggle>
</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].charts.map['projectTable'].showInMonitor"
(change)="$event.checked = statisticsDisplay.entities[entity].charts.map['projectTable'].showInMonitor;
toggleShowInMonitor(entity,'charts','projectTable')"></mat-slide-toggle>
</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="showAllInMonitor"
(change)="$event.checked = showAllInMonitor;
toggleShowAllInMonitor(entity)"></mat-slide-toggle>
</th>
</tr>
<tr>
<th>In Overview</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].charts.map['projectColumn'].showInDashboard"
(change)="$event.checked = statisticsDisplay.entities[entity].charts.map['projectColumn'].showInDashboard;
toggleShowInDashboard(entity,'charts','projectColumn')"></mat-slide-toggle>
</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].charts.map['projectPie'].showInDashboard"
(change)="$event.checked = statisticsDisplay.entities[entity].charts.map['projectPie'].showInDashboard;
toggleShowInDashboard(entity,'charts','projectPie')"></mat-slide-toggle>
</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="statisticsDisplay.entities[entity].charts.map['projectTable'].showInDashboard"
(change)="$event.checked = statisticsDisplay.entities[entity].charts.map['projectTable'].showInDashboard;
toggleShowInDashboard(entity,'charts','projectTable')"></mat-slide-toggle>
</th>
<th class="uk-text-center">
<mat-slide-toggle [checked]="showAllInDashboard"
(change)="$event.checked = showAllInDashboard;
toggleShowAllInDashboard(entity)"></mat-slide-toggle>
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</article>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,452 +0,0 @@
import {Component, OnInit, ElementRef} from '@angular/core';
import {HelpContentService} from '../../openaireLibrary/services/help-content.service';
import {ActivatedRoute, Router} from '@angular/router';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import { Portal } from '../../domain/portal';
import {DomSanitizer, Title} from '@angular/platform-browser';
import {TitleCasePipe} from '@angular/common';
import {availableEntitiesMap, StatisticsDisplay, StatisticsSummary} from '../../openaireLibrary/connect/statistics/statisticsEntities';
import {ConfigurationService} from '../../openaireLibrary/utils/configuration/configuration.service';
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
import {CommunityCharts} from '../../openaireLibrary/connect/statistics/communityCharts';
import {properties} from '../../../environments/environment';
@Component({
selector: 'stats',
templateUrl: 'stats.component.html'
})
export class StatsComponent implements OnInit {
// errorMessage: string;
// loadingMessage: string;
public showLoading: boolean = true;
public errorMessage: string = '';
public updateErrorMessage: string = '';
communities: Portal[] = [];
communityId: string;
communityInfo = null;
deactivatedEntity: boolean;
displayedTimeline: string;
displayedGraph: string;
displayedProjectChart: string;
displayedEntity: string;
entitiesList: string[] = [];
entitiesMap: Map<string, string> = availableEntitiesMap;
statisticsSum: StatisticsSummary;
statisticsDisplay: StatisticsDisplay;
chartsInfoMap: {};
showAllInMonitor: boolean = false;
showAllInDashboard: boolean = false;
public properties: EnvProperties = null;
private communityName = null;
constructor(private element: ElementRef,
private contentService: HelpContentService,
private configService: ConfigurationService,
private route: ActivatedRoute,
private _router: Router,
private title: Title,
private sanitizer: DomSanitizer,
private titleCase: TitleCasePipe) {}
ngOnInit() {
this.properties = properties;
this.route.params.subscribe(
params => {
HelperFunctions.scroll();
this.title.setTitle('Administration Dashboard | Statistics');
this.communityId = params['community'];
this.getStatistics();
});
}
getStatistics() {
if(!Session.isLoggedIn()){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
// this.loadingMessage = 'Retrieving statistics';
// this.errorMessage = '';
this.showLoading = true;
this.updateErrorMessage = "";
this.errorMessage = "";
this.statisticsSum = null;
this.statisticsDisplay = null;
this.contentService.getCommunityStatistics(this.properties.statisticsAPIURL, this.communityId).subscribe(
stats => {
if(stats) {
this.statisticsSum = stats;
if(stats["other"]){ //hack because in stats API the entity name is "other" while in admin API is "orp". This component uses also "orp" name
this.statisticsSum["orp"]=stats["other"];
}
}else{
console.debug("Aaaa")
}
},
error => {
//this.loadingMessage = '';
//this.errorMessage = 'Failed to retrieve statistics for the chosen community!';
//console.log(error);
this.handleError('Failed to retrieve statistics for the chosen community!', error);
},
() => {
//this.loadingMessage = '';
this.getDisplayOptions();
}
);
}
}
getDisplayOptions() {
if(!Session.isLoggedIn()){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
this.contentService.getCommunityAdminStatisticsChoices(this.communityId)
.subscribe(
res => {
this.statisticsDisplay = res;
},
error => {
//console.log(error);
this.handleError('Failed to retrieve statistics\' choices for the chosen community!', error);
},
() => {
this.getCommunityInfo();
}
);
}
}
getCommunityInfo() {
if(!Session.isLoggedIn()){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
//console.log(`calling ${this.properties.adminToolsAPIURL}/communityFull/${this.communityId}`);
this.configService.portalAsObservable.subscribe(
res => {
console.debug(res);
if(res) {
this.communityInfo = res;
this.communityName = this.communityInfo.name;
}
},
error => this.handleError('Failed to retrieve information for the chosen community!', error),//console.log(error),
() => {
this.createChartUrlMap();
this.entitiesList = Array.from( this.entitiesMap.keys() );
this.onChangeEntity(this.entitiesList[0]);
}
);
}
}
onChangeEntity (entity: string) {
if(!Session.isLoggedIn()){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
this.showLoading = true;
this.deactivatedEntity = false;
this.displayedEntity = entity;
this.displayedTimeline = `${entity}Timeline`;
this.displayedGraph = `${entity}Graph`;
this.changeDisplayedProjectChart(`${entity}Projectcolumn`);
if (this.statisticsDisplay.entities[entity].charts.map['projectColumn'].showInMonitor &&
this.statisticsDisplay.entities[entity].charts.map['projectPie'].showInMonitor &&
this.statisticsDisplay.entities[entity].charts.map['projectTable'].showInMonitor) {
this.showAllInMonitor = true;
}
if (this.statisticsDisplay.entities[entity].charts.map['projectColumn'].showInDashboard &&
this.statisticsDisplay.entities[entity].charts.map['projectPie'].showInDashboard &&
this.statisticsDisplay.entities[entity].charts.map['projectTable'].showInDashboard) {
this.showAllInDashboard = true;
}
const activatedEntities = this.communityInfo['entities'];
if ( !activatedEntities.some(item => item.pid === entity) ) {
this.deactivatedEntity = true;
}
this.showLoading = false;
}
}
changeDisplayedProjectChart(chartName: string) {
this.displayedProjectChart = chartName;
}
createChartUrlMap() {
let communityCharts: CommunityCharts = new CommunityCharts(this.sanitizer);
this.chartsInfoMap = communityCharts.getChartsForCommunity(this.communityId, this.communityName, this.properties);
}
toggleShowAllInMonitor(entity: string) {
if(!Session.isLoggedIn()){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
this.showLoading = true;
this.updateErrorMessage = "";
//this.loadingMessage = 'Saving changes';
this.showAllInMonitor = !this.showAllInMonitor;
this.contentService.postCommunityAdminStatisticsChoices(
this.communityId,
entity,
'charts',
'projectColumn',
this.showAllInMonitor,
true).subscribe(
response => {},//console.log(JSON.stringify(response)),
error => {
//console.log(error);
//this.loadingMessage = '';
//this.errorMessage = 'The changes could not be saved';
this.handleUpdateError('The changes could not be saved', error);
},
() => {
this.contentService.postCommunityAdminStatisticsChoices(
this.communityId,
entity,
'charts',
'projectPie',
this.showAllInMonitor,
true).subscribe(
response => {},//console.log(JSON.stringify(response)),
error => {
//console.log(error);
//this.loadingMessage = '';
//this.errorMessage = 'The changes could not be saved';
this.handleUpdateError('The changes could not be saved', error);
},
() => {
this.contentService.postCommunityAdminStatisticsChoices(
this.communityId,
entity,
'charts',
'projectTable',
this.showAllInMonitor,
true).subscribe(
response => {},//console.log(JSON.stringify(response)),
error => {
//console.log(error);
//this.loadingMessage = '';
//this.errorMessage = 'The changes could not be saved';
this.handleUpdateError('The changes could not be saved' ,error);
},
() => {
this.statisticsDisplay.entities[entity]['charts'].map['projectColumn'].showInMonitor = this.showAllInMonitor;
this.statisticsDisplay.entities[entity]['charts'].map['projectPie'].showInMonitor = this.showAllInMonitor;
this.statisticsDisplay.entities[entity]['charts'].map['projectTable'].showInMonitor = this.showAllInMonitor;
//this.loadingMessage = '';
this.showLoading = false;
}
);
}
);
}
);
/*forkJoin didn't work properly - maybe try another way*/
/*Observable.forkJoin(
this.contentService.postCommunityAdminStatisticsChoices(
this.properties.adminToolsAPIURL,
this.communityId,
entity,
'charts',
'projectColumn',
this.showAllInMonitor,
true),
this.contentService.postCommunityAdminStatisticsChoices(
this.properties.adminToolsAPIURL,
this.communityId,
entity,
'charts',
'projectPie',
this.showAllInMonitor,
true),
this.contentService.postCommunityAdminStatisticsChoices(
this.properties.adminToolsAPIURL,
this.communityId,
entity,
'charts',
'projectTable',
this.showAllInMonitor,
true)
).subscribe(
response => console.log('All went well in forkJoin!'),
error => {
console.log(error);
this.loadingMessage = '';
this.errorMessage = 'The changes could not be saved';
},
() => {
this.statisticsDisplay.entities[entity]['charts'].map['projectColumn'].showInMonitor = this.showAllInMonitor;
this.statisticsDisplay.entities[entity]['charts'].map['projectPie'].showInMonitor = this.showAllInMonitor;
this.statisticsDisplay.entities[entity]['charts'].map['projectTable'].showInMonitor = this.showAllInMonitor;
this.loadingMessage = '';
}
);*/
}
}
toggleShowAllInDashboard(entity: string) {
if(!Session.isLoggedIn()){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
this.showLoading = true;
this.updateErrorMessage = "";
//this.loadingMessage = 'Saving changes';
this.contentService.postCommunityAdminStatisticsChoices(
this.communityId,
entity,
'charts',
'projectColumn',
!this.showAllInDashboard,
false).subscribe(
response => {},//console.log(JSON.stringify(response)),
error => {
//console.log(error);
//this.loadingMessage = '';
//this.errorMessage = 'The changes could not be saved';
this.handleUpdateError('The changed could not be saved', error);
},
() => {
this.contentService.postCommunityAdminStatisticsChoices(
this.communityId,
entity,
'charts',
'projectPie',
!this.showAllInDashboard,
false).subscribe(
response => {},//console.log(JSON.stringify(response)),
error => {
//console.log(error);
//this.loadingMessage = '';
//this.errorMessage = 'The changes could not be saved';
this.handleUpdateError('The changes could not be saved', error);
},
() => {
this.contentService.postCommunityAdminStatisticsChoices(
this.communityId,
entity,
'charts',
'projectTable',
!this.showAllInDashboard,
false).subscribe(
response => {},//console.log(JSON.stringify(response)),
error => {
//console.log(error);
//this.loadingMessage = '';
//this.errorMessage = 'The changes could not be saved';
this.handleUpdateError('The changes could not be saved', error);
},
() => {
this.showAllInDashboard = !this.showAllInDashboard;
this.statisticsDisplay.entities[entity]['charts'].map['projectColumn'].showInDashboard = this.showAllInDashboard;
this.statisticsDisplay.entities[entity]['charts'].map['projectPie'].showInDashboard = this.showAllInDashboard;
this.statisticsDisplay.entities[entity]['charts'].map['projectTable'].showInDashboard = this.showAllInDashboard;
//this.loadingMessage = '';
this.showLoading = false;
}
);
}
);
}
);
}
}
toggleShowGraphAnalysisView() {
this.contentService.statisticsIsActiveToggle(this.statisticsDisplay._id).subscribe(status => {
this.statisticsDisplay.isActive = status;
});
}
toggleShowInMonitor(entity: string, chartsOrNumbers: string, title: string) {
if(!Session.isLoggedIn()){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
this.updateErrorMessage = "";
this.contentService.postCommunityAdminStatisticsChoices(
this.communityId,
entity,
chartsOrNumbers,
title,
!this.statisticsDisplay.entities[entity][chartsOrNumbers].map[title].showInMonitor,
true).subscribe(
response => {},//console.log(JSON.stringify(response)),
error => this.handleUpdateError('The changes could not be saved', error),//console.log(error),
() => {
this.statisticsDisplay.entities[entity][chartsOrNumbers].map[title].showInMonitor = !this.statisticsDisplay.entities[entity][chartsOrNumbers].map[title].showInMonitor;
}
);
}
}
toggleShowInDashboard(entity: string, chartsOrNumbers: string, title: string) {
if(!Session.isLoggedIn()){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
this.updateErrorMessage = "";
this.contentService.postCommunityAdminStatisticsChoices(
this.communityId,
entity,
chartsOrNumbers,
title,
!this.statisticsDisplay.entities[entity][chartsOrNumbers].map[title].showInDashboard,
false).subscribe(
response => {},//console.log(JSON.stringify(response)),
error => this.handleUpdateError('The changes could not be saved', error),//console.log(error),
() => {
this.statisticsDisplay.entities[entity][chartsOrNumbers].map[title].showInDashboard = !this.statisticsDisplay.entities[entity][chartsOrNumbers].map[title].showInDashboard;
}
);
}
}
getCamelCaseString (inputString: string) {
return this.titleCase.transform(inputString);
}
handleUpdateError(message: string, error) {
this.updateErrorMessage = message;
console.log('Server responded: ' +error);
this.showLoading = false;
}
handleError(message: string, error) {
this.errorMessage = message;
console.log('Server responded: ' + error);
this.showLoading = false;
}
}

View File

@ -1,15 +0,0 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {StatsComponent} from './stats.component';
import {StatsRoutingModule} from './stats-routing.module';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
@NgModule({
imports: [
CommonModule, StatsRoutingModule, RouterModule, MatSlideToggleModule
],
declarations: [StatsComponent],
exports: [StatsComponent]
})
export class StatsModule { }

@ -1 +1 @@
Subproject commit c1a7e58801dd22326d0cfd709776b15654505e4f
Subproject commit 454938689d26a5ba78656df2e01cf9550a1f00bb

@ -1 +1 @@
Subproject commit b4ce5e4167fb07b5b0b0edd35820b6ae822fe766
Subproject commit f18296b4f87034e28b2db43ca55051fa3af18072