[Monitor|Trunk]

-remove isPublic/isActive and their funtionalities
-add visibility
-update stakeholder and indicator cards

-add beta version of stats tool



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@59675 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Argiro Kokogiannaki 2020-10-23 13:58:16 +00:00
parent 2f2c55cef7
commit 264a16c9bf
20 changed files with 444 additions and 1215 deletions

View File

@ -8,9 +8,10 @@ import {StakeholderService} from "./openaireLibrary/monitor/services/stakeholder
import {BehaviorSubject, Subscriber} from "rxjs";
import {LayoutService} from "./openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
import {MenuItem, RootMenuItem} from "./openaireLibrary/sharedComponents/menu";
import {Stakeholder, Topic} from "./openaireLibrary/monitor/entities/stakeholder";
import {Stakeholder, Topic, Visibility} from "./openaireLibrary/monitor/entities/stakeholder";
import {LinksResolver} from "./search/links-resolver";
import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component";
import {arrow_left} from "./openaireLibrary/utils/icons/icons";
@Component({
@ -107,9 +108,9 @@ export class AppComponent implements OnInit, OnDestroy {
if (isSearch) {
this.activeTopic = null;
} else if (params && params['topic'] && !this.activeTopic) {
this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.visibility));
} else {
this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.visibility));
}
this.setSideBar();
} else {
@ -129,9 +130,9 @@ export class AppComponent implements OnInit, OnDestroy {
if(isSearch) {
this.activeTopic = null;
} else if (params && params['topic']) {
this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.visibility));
} else {
this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.visibility));
}
}
@ -145,7 +146,9 @@ export class AppComponent implements OnInit, OnDestroy {
}));
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
this.buildMenu();
if(user){
this.buildMenu();
}
}, error => {
console.log("App couldn't fetch properties");
console.log(error);
@ -177,7 +180,7 @@ export class AppComponent implements OnInit, OnDestroy {
private setSideBar() {
let items: MenuItem[] = [];
this.stakeholder.topics.forEach((topic) => {
if (this.isPublicOrIsMember(topic.isPublic) && topic.isActive) {
if (this.isPublicOrIsMember(topic.visibility)) {
let topicItem: MenuItem = new MenuItem(topic.alias, topic.name, "", (
'/' + this.stakeholder.alias + '/' + topic.alias),
null, [], [], {});
@ -234,7 +237,7 @@ export class AppComponent implements OnInit, OnDestroy {
this.adminMenuItems.push(new MenuItem("indicators", "Indicators", "", "/admin/"+this.stakeholder.alias + '/indicators', false, [], [], {}, "<i uk-icon=\"image\"></i>"));
this.adminMenuItems.push(new MenuItem("users", "Users", "", "/admin/"+this.stakeholder.alias+"/users", false, [], [], {}, "<i uk-icon=\"users\"></i>"));
this.specialSideBarMenuItem = new MenuItem("back", "Manage profiles", "", "/admin",false, [], null, {});
this.specialSideBarMenuItem.icon = '<span class="uk-icon-button uk-icon portal-button " uk-icon="chevron-left"></span>';
this.specialSideBarMenuItem.icon = '<span class="uk-icon-button uk-icon portal-button " >' + arrow_left.data + '</span>'; // '<span class="uk-icon-button uk-icon portal-button " uk-icon="chevron-left"></span>';
}
this.userMenuItems = [];
@ -246,7 +249,6 @@ export class AppComponent implements OnInit, OnDestroy {
if (this.isAdmin()) {
this.userMenuItems.push(new MenuItem("", "Manage profiles",
"", "/admin", true, [], [], {}))
this.specialSideBarMenuItem = null;
}
if (this.user) {
this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {}));
@ -282,14 +284,17 @@ export class AppComponent implements OnInit, OnDestroy {
public isAdmin() {
return this.user && (Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || Session.isMonitorCurator(this.user));
}
public isPublicOrIsMember(isPublic: boolean): boolean {
if (isPublic) {
public isPublicOrIsMember(visibility: Visibility): boolean {
if(visibility == "PRIVATE"){
return false;
}
if (visibility == "PUBLIC") {
return true;
} else {
if (this.isViewPublic) { // preview for not members
return false;
} else if (this.isAdmin()) {
} else if(this.isAdmin()) {
// if user is member, return true
return true;
}

View File

@ -2,15 +2,10 @@
<div id="page_content_inner">
<div class="uk-padding-small md-bg-white" uk-grid>
<div *ngIf="filters" class="uk-width-2-3@m uk-width-1-1 uk-child-width-1-3@m uk-child-width-1-1" uk-grid>
<div>
<div dashboard-input [formInput]="filters.get('privacy')"
type="select" [options]="[all].concat(stakeholderUtils.isPublic)"
label="Privacy"></div>
</div>
<div>
<div dashboard-input [formInput]="filters.get('status')"
type="select" [options]="[all].concat(stakeholderUtils.isActive)"
label="Status"></div>
type="select" [options]="[all].concat(stakeholderUtils.visibility)"
label="Visibility"></div>
</div>
</div>
<div class="uk-width-expand@m uk-width-1-1 uk-flex uk-flex-middle uk-flex-right">
@ -18,189 +13,110 @@
<span class="uk-position-center-right"><i class="material-icons">search</i></span>
<div dashboard-input [formInput]="filters.get('keyword')" label="Locate profile"></div>
</div>
<div [class.uk-active]="grid" class="uk-margin-small-left">
<a [routerLink]="" class="uk-icon-button" (click)="changeGrid(true)"><i
class="material-icons">view_module</i></a>
</div>
<div [class.uk-active]="!grid" class="uk-margin-small-left">
<a [routerLink]="" class="uk-icon-button" (click)="changeGrid(false)"><i class="material-icons">list</i></a>
</div>
</div>
</div>
<h4 class="uk-text-bold main">Default Profiles</h4>
<div [class.uk-child-width-1-4@m]="grid"
[class.uk-child-width-1-3@s]="grid"
[class.uk-child-width-1-1]="!grid"
[class.list-view]="!grid"
class="uk-grid-match uk-grid-small"
<h6 class="main">Default Profiles</h6>
<div class = "uk-child-width-1-4@m uk-child-width-1-3@s uk-grid-match uk-grid-small"
uk-grid>
<loading *ngIf="loading"></loading>
<ng-template ngFor [ngForOf]="defaultStakeholders" let-stakeholder let-i="index">
<a *ngIf="stakeholder" [routerLink]="stakeholder.alias">
<div class="uk-card uk-card-default">
<div class=" uk-padding-small uk-card-header">
<div class="md-card-toolbar-actions uk-float-right" [class.uk-flex-middle]="!grid" [class.uk-flex]="!grid">
<span *ngIf="!grid" class="uk-margin-medium-right uk-flex uk-flex-middle">
<i class="material-icons md-24 uk-margin-small-right">{{stakeholderUtils.isPublicIcon.get(stakeholder.isPublic)}}</i>
{{(stakeholder.isPublic) ? 'Public' : 'Private'}}
</span>
<span *ngIf="!grid" class="uk-margin-medium-right uk-flex uk-flex-middle">
<i class="material-icons md-24 uk-margin-small-right"
[class.md-color-green-300]="stakeholder.isActive">{{stakeholderUtils.isActiveIcon}}</i>
{{(stakeholder.isActive) ? 'Active' : 'Inactive'}}
</span>
<div class="md-card-dropdown uk-inline">
<i uk-icon="more-vertical"
(click)="$event.stopPropagation();$event.preventDefault()"></i>
<div #element uk-dropdown="mode: click; pos: bottom-right; delay-hide: 0; flip: false">
<ul class="uk-nav uk-dropdown-nav">
<li><a (click)="$event.stopPropagation();editStakeholder(stakeholder, true);hide(element);$event.preventDefault()">Edit</a>
</li>
<li><a (click)="$event.stopPropagation();toggleStakeholderStatus(stakeholder);hide(element);$event.preventDefault()">
{{stakeholder.isActive ? 'Inactive' : 'Active'}}</a>
</li>
<li><a (click)="$event.stopPropagation();toggleStakeholderAccess(stakeholder);hide(element);$event.preventDefault()">
{{stakeholder.isPublic ? 'Private' : 'Public'}}</a>
</li>
<hr *ngIf="isAdministrator()" class="uk-nav-divider">
<li *ngIf="isAdministrator()"><a
(click)="$event.stopPropagation();deleteStakeholderOpen(stakeholder);hide(element);$event.preventDefault()">Delete</a>
</li>
</ul>
</div>
</div>
</div>
<div class="uk-card-title">{{stakeholder.name}}</div>
</div>
<div *ngIf="grid" class="uk-card-body">
<div class="uk-flex uk-flex-center" uk-grid>
<div class="uk-width-1-2 uk-text-center">
<i class="material-icons md-24">{{stakeholderUtils.isPublicIcon.get(stakeholder.isPublic)}}</i>
<div>{{(stakeholder.isPublic) ? 'Public' : 'Private'}}</div>
</div>
<div class="uk-width-1-2 uk-text-center">
<i class="material-icons md-24"
[class.md-color-green-300]="stakeholder.isActive">{{stakeholderUtils.isActiveIcon}}</i>
<div>{{(stakeholder.isActive) ? 'Active' : 'Inactive'}}</div>
</div>
</div>
</div>
</div>
</a>
<ng-template ngFor [ngForOf]="displayDefaultStakeholders" let-stakeholder let-i="index">
<ng-container *ngTemplateOutlet="stakeholderBox; context: {stakeholder:stakeholder}"></ng-container>
</ng-template>
<div *ngIf="!loading">
<div class="uk-card uk-card-default clickable" (click)="editStakeholder(null, true)">
<div class=" uk-padding-small uk-card-header">
<div class="uk-card-title"
[class.uk-flex-middle]="!grid"
[class.uk-flex]="!grid"
[class.uk-flex-center]="!grid">
<i *ngIf="!grid" class="material-icons md-36" uk-icon="plus"></i>
<span>Create a default profile</span>
</div>
</div>
<div *ngIf="grid" class="uk-card-body">
<div uk-grid>
<div class="uk-width-1-1">
Create a new default profile.
</div>
<div class="uk-width-1-1 uk-flex uk-flex-center">
<i class="material-icons md-48" uk-icon="plus"></i>
</div>
</div>
</div>
</div>
<ng-container *ngTemplateOutlet="newBox; context:
{text:'Create a new default profile.', isDefault:true}"></ng-container>
</div>
</div>
<h4 class="uk-text-bold">Profiles</h4>
<div [class.uk-child-width-1-4@m]="grid"
[class.uk-child-width-1-3@s]="grid"
[class.uk-child-width-1-1]="!grid"
[class.list-view]="!grid"
class="uk-grid-match uk-grid-small"
<div class="uk-grid-match uk-grid-small uk-child-width-1-4@m uk-child-width-1-3@s"
uk-grid>
<loading *ngIf="loading"></loading>
<ng-template ngFor [ngForOf]="displayStakeholders" let-stakeholder let-i="index">
<a *ngIf="stakeholder" [routerLink]="stakeholder.alias">
<div class="uk-card uk-card-default">
<div class=" uk-padding-small uk-card-header">
<div class="md-card-toolbar-actions uk-float-right" [class.uk-flex-middle]="!grid" [class.uk-flex]="!grid">
<span *ngIf="!grid" class="uk-margin-medium-right uk-flex uk-flex-middle">
<i class="material-icons md-24 uk-margin-small-right">{{stakeholderUtils.isPublicIcon.get(stakeholder.isPublic)}}</i>
{{(stakeholder.isPublic) ? 'Public' : 'Private'}}
</span>
<span *ngIf="!grid" class="uk-margin-medium-right uk-flex uk-flex-middle">
<i class="material-icons md-24 uk-margin-small-right"
[class.md-color-green-300]="stakeholder.isActive">{{stakeholderUtils.isActiveIcon}}</i>
{{(stakeholder.isActive) ? 'Active' : 'Inactive'}}
</span>
<div class="md-card-dropdown uk-inline">
<i uk-icon="more-vertical"
(click)="$event.stopPropagation();$event.preventDefault()"></i>
<div #element uk-dropdown="mode: click; pos: bottom-right; delay-hide: 0; flip: false">
<ul class="uk-nav uk-dropdown-nav">
<li><a
(click)="$event.stopPropagation();editStakeholder(stakeholder);hide(element);$event.preventDefault()">Edit</a>
</li>
<li><a (click)="$event.stopPropagation();toggleStakeholderStatus(stakeholder);hide(element);$event.preventDefault()">
{{stakeholder.isActive ? 'Inactive' : 'Active'}}</a>
</li>
<li><a (click)="$event.stopPropagation();toggleStakeholderAccess(stakeholder);hide(element);$event.preventDefault()">
{{stakeholder.isPublic ? 'Private' : 'Public'}}</a>
</li>
<hr class="uk-nav-divider">
<li><a
(click)="$event.stopPropagation();deleteStakeholderOpen(stakeholder);hide(element);$event.preventDefault()">Delete</a>
</li>
</ul>
</div>
</div>
</div>
<div class="uk-card-title">{{stakeholder.name}}</div>
</div>
<div *ngIf="grid" class="uk-card-body">
<div class="uk-flex uk-flex-center" uk-grid>
<div class="uk-width-1-2 uk-text-center">
<i class="material-icons md-24">{{stakeholderUtils.isPublicIcon.get(stakeholder.isPublic)}}</i>
<div>{{(stakeholder.isPublic) ? 'Public' : 'Private'}}</div>
</div>
<div class="uk-width-1-2 uk-text-center">
<i class="material-icons md-24"
[class.md-color-green-300]="stakeholder.isActive">{{stakeholderUtils.isActiveIcon}}</i>
<div>{{(stakeholder.isActive) ? 'Active' : 'Inactive'}}</div>
</div>
</div>
</div>
</div>
</a>
<ng-container *ngTemplateOutlet="stakeholderBox; context: {stakeholder:stakeholder}"></ng-container>
</ng-template>
<div *ngIf="!loading">
<div class="uk-card uk-card-default clickable" (click)="editStakeholder()">
<div class=" uk-padding-small uk-card-header">
<div class="uk-card-title"
[class.uk-flex-middle]="!grid"
[class.uk-flex]="!grid"
[class.uk-flex-center]="!grid">
<i *ngIf="!grid" class="material-icons md-36" uk-icon="plus"></i>
<span>Create a profile</span>
<ng-container *ngTemplateOutlet="newBox; context:
{text:'Create a new profile by selecting the type (Funder, Organization, Research Initiative or Project) and '+
' select indicators based on a default or a blank profile.', isDefault:false}"></ng-container>
</div>
</div>
</div>
</div>
<ng-template #stakeholderBox let-stakeholder="stakeholder" >
<div>
<div *ngIf="stakeholder" class="uk-card uk-card-default">
<div class="uk-padding-small uk-padding-remove-bottom">
<div class="md-card-toolbar-actions uk-float-right" >
<div class="md-card-dropdown uk-inline clickable">
<i uk-icon="more-vertical"
(click)="$event.stopPropagation();$event.preventDefault()"></i>
<div #element uk-dropdown="mode: click; pos: bottom-right; delay-hide: 0; flip: false">
<ul class="uk-nav uk-dropdown-nav">
<li><a (click)="$event.stopPropagation();editStakeholder(stakeholder, true);hide(element);$event.preventDefault()">Edit</a>
</li>
<ng-template ngFor [ngForOf]="stakeholderUtils.visibility" let-v>
<li *ngIf="stakeholder.visibility != v.value"><a (click)="changeStakeholderStatus(stakeholder, v.value);
hide(element)">
{{'Make ' + v.label.toLowerCase()}}</a>
</li>
</ng-template>
<hr *ngIf="isAdministrator()" class="uk-nav-divider">
<li *ngIf="isAdministrator()"><a
(click)="$event.stopPropagation();deleteStakeholderOpen(stakeholder);hide(element);$event.preventDefault()">Delete</a>
</li>
</ul>
</div>
</div>
<div *ngIf="grid" class="uk-card-body">
<div uk-grid>
<div class="uk-width-1-1">
Create a new profile by selecting the type (Funder, Organization, Research Initiative or Project) and
select indicators based on a default or a blank profile.
</div>
<div class="uk-width-1-1 uk-flex uk-flex-center">
<i class="material-icons md-48" uk-icon="plus"></i>
</div>
</div>
</div>
<div class="md-card-dropdown uk-inline clickable">
<i [attr.uk-icon]="stakeholderUtils.isPublicIcon.get(stakeholder.visibility)"
(click)="$event.stopPropagation();$event.preventDefault()"></i>
<div #element uk-dropdown="mode: click; pos: bottom-right; delay-hide: 0; flip: false">
<ul class="uk-nav uk-dropdown-nav">
<li *ngFor="let v of stakeholderUtils.visibility" [class.selectedVisibility]="v.value ==
stakeholder.visibility">
<a
*ngIf="stakeholder.visibility != v.value"
(click)="$event.stopPropagation();changeStakeholderStatus(stakeholder,v.value);hide(element);$event.preventDefault()">
<i [attr.uk-icon]="stakeholderUtils.isPublicIcon.get( v.value)"></i> {{v.label}}</a>
<a *ngIf="stakeholder.visibility == v.value">
<i [attr.uk-icon]="stakeholderUtils.isPublicIcon.get( v.value)"></i> {{v.label}} <icon
customClass="uk-text-secondary uk-float-right" [ratio]="0.5"
name="bullet"></icon></a>
</li>
</ul>
</div>
</div>
</div>
<div class="uk-padding-small uk-padding-remove-top">
<a class="" [routerLink]="stakeholder.alias">
<div class="uk-flex uk-flex-center" uk-grid>
{{stakeholder.name}}
</div>
</a>
</div>
</div>
</div>
</ng-template>
<ng-template #newBox let-text="text" let-isDefault="isDefault" >
<div *ngIf="!loading">
<div class="uk-card uk-card-default clickable" (click)="editStakeholder(null, isDefault)">
<div class="uk-card-body">
<div uk-grid>
<div class="uk-width-1-1">
{{text}}
</div>
<div class="uk-width-1-1 uk-flex uk-flex-center">
<i class="material-icons md-48" uk-icon="plus"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</ng-template>
<modal-alert #editStakeholderModal
id="edit_modal" [large]="true"
(alertOutput)="editStakeholderComponent.save(callback)"

View File

@ -2,7 +2,7 @@ import {Component, OnDestroy, OnInit, ViewChild} from "@angular/core";
import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service";
import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties";
import {EnvironmentSpecificService} from "../openaireLibrary/utils/properties/environment-specific.service";
import {Stakeholder} from "../openaireLibrary/monitor/entities/stakeholder";
import {Stakeholder, Visibility} from "../openaireLibrary/monitor/entities/stakeholder";
import {Subscriber, zip} from "rxjs";
import {StakeholderUtils} from "../utils/indicator-utils";
import {FormBuilder, FormGroup} from "@angular/forms";
@ -48,7 +48,6 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
/**
* Grid or List View
*/
public grid: boolean = true;
private subscriptions: any[] = [];
@ViewChild('editStakeholderModal') editStakeholderModal: AlertModal;
@ViewChild('deleteStakeholderModal') deleteStakeholderModal: AlertModal;
@ -100,33 +99,22 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
hide(element: any) {
UIkit.dropdown(element).hide();
}
public changeGrid(value) {
this.grid = value;
}
private buildFilters() {
this.filters = this.fb.group({
privacy: this.fb.control('all'),
status: this.fb.control('all'),
keyword: this.fb.control('')
});
this.subscriptions.push(this.filters.get('privacy').valueChanges.subscribe(value => {
this.onPrivacyChange(value);
}));
this.subscriptions.push(this.filters.get('status').valueChanges.subscribe(value => {
console.debug(value);
this.onStatusChange(value);
}));
this.subscriptions.push(this.filters.get('keyword').valueChanges.subscribe(value => {
this.onKeywordChange(value);
}));
}
onPrivacyChange(value) {
this.displayDefaultStakeholders = this.filterPrivacy(this.defaultStakeholders, value);
this.displayStakeholders = this.filterPrivacy(this.stakeholders, value);
}
onStatusChange(value) {
this.displayDefaultStakeholders = this.filterStatus(this.defaultStakeholders, value);
this.displayStakeholders = this.filterStatus(this.stakeholders, value);
@ -136,21 +124,12 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
this.displayDefaultStakeholders = this.filterByKeyword(this.defaultStakeholders, value);
this.displayStakeholders = this.filterByKeyword(this.stakeholders, value);
}
private filterPrivacy(stakeholders: Stakeholder[], value): Stakeholder[] {
if (value === 'all') {
return stakeholders;
} else {
return stakeholders.filter(stakeholder => stakeholder.isPublic === value);
}
}
private filterStatus(stakeholders: Stakeholder[], value): Stakeholder[] {
if (value === 'all') {
return stakeholders;
} else {
return stakeholders.filter(stakeholder => stakeholder.isActive === value);
return stakeholders.filter(stakeholder => stakeholder.visibility == value);
}
}
@ -227,7 +206,14 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
}
});
}
changeStakeholderStatus(stakeholder: Stakeholder, visibility:Visibility) {
let path = [
stakeholder._id
];
this.stakeholderService.toggleStatus(this.properties.monitorServiceAPIURL, path).subscribe(isActive => {
stakeholder.isActive = isActive;
});
}
toggleStakeholderStatus(stakeholder: Stakeholder) {
let path = [
stakeholder._id

View File

@ -10,6 +10,9 @@ import {AlertModalModule} from "../openaireLibrary/utils/modal/alertModal.module
import {ReactiveFormsModule} from "@angular/forms";
import {AdminDashboardGuard} from "../utils/adminDashboard.guard";
import {EditStakeholderModule} from "../general/edit-stakeholder/edit-stakeholder.module";
import {IconsModule} from "../openaireLibrary/utils/icons/icons.module";
import {IconsService} from "../openaireLibrary/utils/icons/icons.service";
import {bullet} from "../openaireLibrary/utils/icons/icons";
@NgModule({
declarations: [ManageStakeholdersComponent],
@ -21,7 +24,8 @@ import {EditStakeholderModule} from "../general/edit-stakeholder/edit-stakeholde
LoadingModule,
AlertModalModule,
ReactiveFormsModule,
EditStakeholderModule
EditStakeholderModule,
IconsModule
],
providers: [
AdminDashboardGuard, PreviousRouteRecorder,
@ -29,5 +33,7 @@ import {EditStakeholderModule} from "../general/edit-stakeholder/edit-stakeholde
exports: [ManageStakeholdersComponent]
})
export class ManageStakeholdersModule {
constructor(private iconsService: IconsService) {
this.iconsService.registerIcons([ bullet]);
}
}

View File

@ -48,7 +48,9 @@
<ul *ngIf="activeTopic && activeTopic.categories.length > 1"
class="categoriesTabs uk-tab ">
<ng-template ngFor [ngForOf]="activeTopic.categories" let-category let-i="index">
<li *ngIf="isPublicOrIsMember(category.isPublic) && category.isActive" [class.uk-active]="category.alias === activeCategory.alias">
<li *ngIf="isPublicOrIsMember(category.visibility)"
[class.uk-active]="category.alias ===
activeCategory.alias">
<a (click)="navigateTo(stakeholder.alias,activeTopic.alias, category.alias)"
class="uk-margin-remove-bottom uk-h4"
><span>{{category.name}}</span></a>
@ -60,7 +62,7 @@
<ul *ngIf="activeCategory && countSubCategoriesToShow(activeCategory) > 1"
class="uk-subnav uk-subnav-pill subCategoriesTabs ">
<ng-template ngFor [ngForOf]="activeCategory.subCategories" let-subCategory let-i="index">
<li *ngIf="isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive"
<li *ngIf="isPublicOrIsMember(subCategory.visibility)"
[ngClass]="(subCategory.alias === activeSubCategory.alias)?'uk-active':''">
<a (click)="navigateTo(stakeholder.alias,activeTopic.alias,activeCategory.alias, subCategory.alias)"
class="uk-margin-remove-bottom uk-h3"
@ -79,7 +81,7 @@
activeCategory.subCategories.length > 1?40:0)+(activeTopic &&
activeTopic.categories.length > 1?20:0)+(countSelectedFilters()
> 0?40:0))">
<div class="uk-margin-large-top uk-padding-large indicators">
<div class=" indicators">
<div *ngIf="privateStakeholder">
<div class="uk-text-center uk-height-medium">
<div class="uk-h3 "><i>
@ -129,7 +131,7 @@
<ng-template ngFor [ngForOf]="activeSubCategory.numbers" let-number let-i="index">
<h4 class="uk-width-1-1">{{number.title}}</h4>
<ng-template ngFor [ngForOf]="number.indicators" let-indicator let-j="index">
<div *ngIf="indicator.isActive && isPublicOrIsMember(indicator.isPublic)"
<div *ngIf="isPublicOrIsMember(indicator.visibility)"
[class.uk-width-1-3@m]="indicator.width === 'small'"
[class.uk-width-1-2@m]="indicator.width === 'medium'"
[class.uk-width-1-1]="indicator.width === 'large'" class=" uk-margin-bottom">
@ -160,7 +162,7 @@
<h3 *ngIf="chart.title && chart.title.length > 0" class="uk-width-1-1 uk-margin-top">{{chart.title}}</h3>
<ng-template ngFor [ngForOf]="chart.indicators" let-indicator let-j="index">
<div
*ngIf="indicator.isActive && isPublicOrIsMember(indicator.isPublic) && chartsActiveType.get(i + '-' + j)"
*ngIf="isPublicOrIsMember(indicator.visibility) && chartsActiveType.get(i + '-' + j)"
[class.uk-width-1-3@m]="indicator.width === 'small'"
[class.uk-width-1-2@m]="indicator.width === 'medium'"
[class.uk-width-1-1]="indicator.width === 'large'" class="uk-margin-bottom">

View File

@ -10,7 +10,14 @@ import {ErrorMessagesComponent} from '../openaireLibrary/utils/errorMessages.com
import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service";
import {Category, IndicatorPath, Stakeholder, SubCategory, Topic} from "../openaireLibrary/monitor/entities/stakeholder";
import {
Category,
IndicatorPath,
Stakeholder,
SubCategory,
Topic,
Visibility
} from "../openaireLibrary/monitor/entities/stakeholder";
import {StatisticsService} from "../utils/services/statistics.service";
import {IndicatorUtils, StakeholderUtils} from "../utils/indicator-utils";
import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
@ -123,7 +130,7 @@ export class MonitorComponent implements OnInit, OnDestroy {
,filterOperator: "or", valueIsExact: true, filterType: "checkbox", radioValue:""});
}
this.initializeFilters();
if(stakeholder.isActive && (stakeholder.isPublic || this.isPublicOrIsMember(stakeholder.isPublic))) {
if(this.isPublicOrIsMember(stakeholder.visibility)) {
this.seoService.createLinkForCanonicalURL(url, false);
this._meta.updateTag({content: url}, "property='og:url'");
var description = "Monitor Dashboard | " + this.stakeholder.name;
@ -253,20 +260,20 @@ export class MonitorComponent implements OnInit, OnDestroy {
private setView(params: Params) {
this.loading = false;
if (params['topic']) {
this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.visibility));
if (this.activeTopic) {
if (params['category']) {
this.activeCategory = this.activeTopic.categories.find(category =>
(category.alias === params['category']) && this.isPublicOrIsMember(category.isPublic) && category.isActive);
(category.alias === params['category']) && this.isPublicOrIsMember(category.visibility));
if (!this.activeCategory) {
this.navigateToError();
return;
}
} else {
this.activeCategory = this.activeTopic.categories.find(category => this.isPublicOrIsMember(category.isPublic) && category.isActive);
this.activeCategory = this.activeTopic.categories.find(category => this.isPublicOrIsMember(category.visibility));
if (this.activeCategory) {
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory =>
this.isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive);
this.isPublicOrIsMember(subCategory.visibility));
if (this.activeSubCategory) {
this.setIndicators();
}
@ -276,14 +283,14 @@ export class MonitorComponent implements OnInit, OnDestroy {
if (this.activeCategory) {
if (params['subCategory']) {
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory =>
(subCategory.alias === params['subCategory'] && this.isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive));
(subCategory.alias === params['subCategory'] && this.isPublicOrIsMember(subCategory.visibility)));
if (!this.activeSubCategory) {
this.navigateToError();
return;
}
} else {
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory =>
this.isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive);
this.isPublicOrIsMember(subCategory.visibility));
}
if (this.activeSubCategory) {
this.setIndicators();
@ -299,11 +306,11 @@ export class MonitorComponent implements OnInit, OnDestroy {
return;
}
} else {
this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.visibility));
if (this.activeTopic) {
this.activeCategory = this.activeTopic.categories.find(category => this.isPublicOrIsMember(category.isPublic) && category.isActive);
this.activeCategory = this.activeTopic.categories.find(category => this.isPublicOrIsMember(category.visibility));
if (this.activeCategory) {
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory => this.isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive);
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory => this.isPublicOrIsMember(subCategory.visibility));
if (this.activeSubCategory) {
this.setIndicators();
}
@ -362,7 +369,7 @@ export class MonitorComponent implements OnInit, OnDestroy {
let urls: Map<string, [number, number][]> = new Map<string, [number, number][]>();
this.activeSubCategory.numbers.forEach((section, i) => {
section.indicators.forEach((number, j) => {
if (number.isActive && this.isPublicOrIsMember(number.isPublic)) {
if (this.isPublicOrIsMember(number.visibility)) {
let url =this.indicatorUtils.getFullUrlWithFilters(this.stakeholder, number.indicatorPaths[0], this.getfl0(), this.periodFilter.selectedFromValue, this.periodFilter.selectedToValue, this.getCoFunded());
const pair = JSON.stringify([number.indicatorPaths[0].source, url]);
const indexes = urls.get(pair) ? urls.get(pair) : [];
@ -433,8 +440,11 @@ export class MonitorComponent implements OnInit, OnDestroy {
return this.user && (Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || Session.isMonitorCurator(this.user));
}
public isPublicOrIsMember(isPublic: boolean): boolean {
if (isPublic) {
public isPublicOrIsMember(visibility: Visibility): boolean {
if(visibility == "PRIVATE"){
return false;
}
if (visibility == "PUBLIC") {
return true;
} else {
if (this.isViewPublic) { // preview for not members
@ -449,8 +459,8 @@ export class MonitorComponent implements OnInit, OnDestroy {
public countSubCategoriesToShow(category:Category): number {
let counter = 0;
for (let sub of category.subCategories) {
if(sub.isActive) {
if (sub.isPublic) {
if(sub.visibility != "PRIVATE") {
if (sub.visibility == "PUBLIC") {
// return true;
counter++;
}else if (this.isAdmin()) {

View File

@ -40,7 +40,7 @@
<div class="menu_title uk-width-expand">
{{topic.name}}
<!--<i
class="material-icons md-18 uk-margin-small-left">{{topic.isPublic ? 'public' : 'lock'}}</i>
class="material-icons md-18 uk-margin-small-left">{{topic.visibility ? 'public' : 'lock'}}</i>
<i class="material-icons md-18"
[class.md-color-green-300]="topic.isActive">brightness_1</i>-->
</div>
@ -50,12 +50,12 @@
class="uk-padding-remove-horizontal">
<ul class="uk-nav uk-dropdown-nav uk-list">
<li><a (click)="editTopicOpen(i); hide(element)">Edit</a></li>
<li><a (click)="toggleTopicStatus(topic); hide(element)">
<!--<li><a (click)="toggleTopicStatus(topic); hide(element)">
{{topic.isActive ? 'Inactive' : 'Active'}}</a>
</li>
<li><a (click)="toggleTopicAccess(topic); hide(element)">
<li><a (click)="toggleTopicStatus(topic); hide(element)">
{{topic.isPublic?'Private':'Public'}}</a>
</li>
</li>-->
<hr *ngIf="!topic.defaultId" class="uk-nav-divider">
<li *ngIf="!topic.defaultId"><a (click)="deleteTopicOpen(i, 'delete'); hide(element)">Delete</a>
<!-- <ng-container *ngIf="!stakeholder.defaultId">-->
@ -117,7 +117,7 @@
<!--<div class="md-card-toolbar-actions" >
<div class="md-card-dropdown uk-inline">
<i uk-icon="more-vertical"></i>
<i uk-icon="more-vertical" class="clickable"></i>
<div #element uk-dropdown="mode: click; pos: bottom-right; delay-hide: 0; flip: false"
class="uk-padding-remove-horizontal">
<ul class="uk-nav uk-dropdown-nav">
@ -127,7 +127,7 @@
{{indicator.isActive ? 'Inactive' : 'Active'}}</a>
</li>
<li *ngIf="!editing"><a (click)="toggleIndicatorAccess(chart._id, indicator);hide(element)">
{{indicator.isPublic ? 'Private' : 'Public'}}</a>
{{indicator.visibility ? 'Private' : 'Public'}}</a>
</li>
<hr *ngIf="!indicator.defaultId " class="uk-nav-divider">
<li *ngIf="!editing && !indicator.defaultId "><a
@ -190,8 +190,8 @@
label="Icon(SVG)" type="textarea">
</div>
<div class="uk-form-row uk-flex uk-flex-middle">
<div dashboard-input class="uk-width-small" [formInput]="form.get('isPublic')"
label="Accessibility" [options]="stakeholderUtils.isPublic" type="select">
<div dashboard-input class="uk-width-small" [formInput]="form.get('visibility')"
label="Accessibility" [options]="stakeholderUtils.visibility" type="select">
</div>
<div dashboard-input class="uk-margin-small-left uk-width-small" [formInput]="form.get('isActive')"
label="Visibility" [options]="stakeholderUtils.isActive" type="select">

View File

@ -6,7 +6,7 @@ import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../openaireLibrary/utils/errorMessages.component';
import {Stakeholder, Topic} from "../openaireLibrary/monitor/entities/stakeholder";
import {Stakeholder, Topic, Visibility} from "../openaireLibrary/monitor/entities/stakeholder";
import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service";
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
import {AlertModal} from "../openaireLibrary/utils/modal/alert";
@ -15,6 +15,7 @@ import {FormBuilder, FormGroup, Validators} from "@angular/forms";
import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
import {IndicatorUtils, StakeholderUtils} from "../utils/indicator-utils";
import {IDeactivateComponent} from "../openaireLibrary/utils/can-exit.guard";
import {visit} from "@angular/compiler-cli/src/ngtsc/util/src/visitor";
declare var UIkit;
@ -96,8 +97,7 @@ export class StakeholderComponent implements OnInit, OnDestroy, IDeactivateCompo
this.stakeholderUtils.aliasValidator(topics)
]
),
isActive: this.fb.control(topic.isActive),
isPublic: this.fb.control(topic.isPublic),
visibility: this.fb.control(topic.visibility),
defaultId: this.fb.control(topic.defaultId),
categories: this.fb.control(topic.categories),
icon: this.fb.control(topic.icon)
@ -116,7 +116,7 @@ export class StakeholderComponent implements OnInit, OnDestroy, IDeactivateCompo
public editTopicOpen(index = -1) {
this.index = index;
if (index === -1) {
this.buildTopic(new Topic(null, null, null, true, true));
this.buildTopic(new Topic(null, null, null, "PUBLIC"));
} else {
this.buildTopic(this.stakeholder.topics[index]);
}
@ -202,14 +202,14 @@ export class StakeholderComponent implements OnInit, OnDestroy, IDeactivateCompo
});
}
toggleTopicStatus(topic: Topic) {
toggleTopicStatus(topic: Topic, visibility:Visibility) {
let path = [
this.stakeholder._id,
topic._id
];
this.stakeholderService.toggleStatus(this.properties.monitorServiceAPIURL, path).subscribe(isActive => {
topic.isActive = isActive;
UIkit.notification('Topic has been successfully changed to ' + (isActive ? 'active' : 'inactive'), {
this.stakeholderService.toggleVisibility(this.properties.monitorServiceAPIURL, path, visibility).subscribe(visibility => {
topic.visibility = visibility;
UIkit.notification('Topic has been successfully changed to ' + visibility.toLowerCase(), {
status: 'success',
timeout: 3000,
pos: 'top-left'
@ -223,14 +223,14 @@ export class StakeholderComponent implements OnInit, OnDestroy, IDeactivateCompo
});
}
toggleTopicAccess(topic: Topic) {
/*toggleTopicAccess(topic: Topic) {
let path = [
this.stakeholder._id,
topic._id
];
this.stakeholderService.toggleAccess(this.properties.monitorServiceAPIURL, path).subscribe(isPublic => {
topic.isPublic = isPublic;
UIkit.notification('Topic has been successfully changed to ' + (isPublic?'public':'private'), {
this.stakeholderService.toggleAccess(this.properties.monitorServiceAPIURL, path).subscribe(visibility => {
topic.visibility = visibility;
UIkit.notification('Topic has been successfully changed to ' + (visibility?'public':'private'), {
status: 'success',
timeout: 3000,
pos: 'top-left'
@ -242,8 +242,10 @@ export class StakeholderComponent implements OnInit, OnDestroy, IDeactivateCompo
pos: 'top-left'
});
});
}
}*/
satinizeHTML(html){
return this.sanitizer.bypassSecurityTrustHtml(html);
}
}

View File

@ -6,49 +6,27 @@
type="select" [options]="[all].concat(indicatorUtils.allChartTypes)"
label="Chart Type"></div>
</div>
<div>
<div dashboard-input [formInput]="filters.get('privacy')"
type="select" [options]="[all].concat(indicatorUtils.isPublic)"
label="Privacy"></div>
</div>
<div>
<div dashboard-input [formInput]="filters.get('status')"
type="select" [options]="[all].concat(indicatorUtils.isActive)"
type="select" [options]="[all].concat(stakeholderUtils.visibility)"
label="Status"></div>
</div>
</div>
<div class="uk-width-expand@m uk-width-1-1 uk-flex uk-flex-middle uk-flex-right">
<div class="uk-inline uk-width-medium">
<span class="uk-position-center-right"><i class="material-icons">search</i></span>
<span class="uk-position-center-right"><i uk-icon="search" class="uk-icon"></i></span>
<div dashboard-input [formInput]="filters.get('keyword')" label="Locate indicator"></div>
</div>
<div [class.uk-active]="grid" class="uk-margin-small-left">
<a [routerLink]="" class="uk-icon-button " (click)="changeGrid(true)"><i
class="material-icons">view_module</i></a>
</div>
<div [class.uk-active]="!grid" class="uk-margin-small-left">
<a [routerLink]="" class="uk-icon-button" (click)="changeGrid(false)"><i class="material-icons">list</i></a>
</div>
</div>
</div>
<div class="uk-child-width-1-2 uk-flex-middle" uk-grid>
<!-- <div>
<ul class="uk-breadcrumb">
<li><span>{{stakeholder.topics[topicIndex].name}}</span></li>
<li>
<span>{{stakeholder.topics[topicIndex].categories[categoryIndex].name}}</span></li>
<li>
<span class="md-color-blue-900 uk-text-bold">
{{stakeholder.topics[topicIndex].categories[categoryIndex].subCategories[subcategoryIndex].name}}
</span>
</li>
</ul>
</div>-->
<div class=" ">
<div class="uk-flex uk-flex-right">
<a class="md-btn md-btn-primary waves-button waves-effect">
<i class="material-icons uk-margin-small-right">remove_red_eye</i>
<a class="uk-button uk-button-primary">
<icon name="preview"></icon>
Preview
<i class="material-icons uk-margin-small-left">keyboard_arrow_down</i>
<i uk-icon="chevron-down" class="uk-icon"></i>
</a>
<div #element uk-dropdown="mode: click; pos: bottom-right; offset: 5; delay-hide: 0; flip: false"
class="uk-padding-remove-horizontal">
@ -61,13 +39,13 @@
</div>
</div>
</div>
<h4 class="uk-text-bold">Number Indicators</h4>
<h6 class="uk-text-bold">Number Indicators</h6>
<div *ngIf="numberSections">
<ng-template ngFor [ngForOf]="displayNumbers" let-number let-i="index">
<div [class.list-view]="!grid" [id]="'number-' + number._id" [class.section]="isAdministrator"
<div [id]="'number-' + number._id" [class.section]="isAdministrator"
class="uk-grid-match uk-grid-small uk-grid uk-margin-top"
uk-sortable="group: number" uk-grid>
<div *ngIf="grid" class="tools disable-sortable uk-sortable-nodrag">
<div class="tools disable-sortable uk-sortable-nodrag">
<div *ngIf="isAdministrator" class="actions">
<a [class.uk-disabled]="editing" class="" (click)="createSection(i, 'number')"
title="Create a new section"><i
@ -89,7 +67,7 @@
<!-- </ng-container>-->
</div>
</div>
<div *ngIf="grid && numberSections.at(i)"
<div *ngIf="numberSections.at(i)"
class="uk-form-row uk-width-1-1 uk-grid-medium uk-flex uk-flex-middle uk-margin-bottom disable-sortable uk-sortable-nodrag"
uk-grid>
<div dashboard-input class="uk-width-2-3 uk-width-1-3@m" [formInput]="numberSections.at(i).get('title')"
@ -101,43 +79,31 @@
</button>
</div>
</div>
<div *ngIf="!grid && number.title" class="uk-width-1-1 disable-sortable uk-sortable-nodrag">
<h4>{{number.title}}</h4>
</div>
<ng-template ngFor [ngForOf]="number.indicators" let-indicator let-j="index">
<div *ngIf="indicator" [id]="indicator._id"
[class.uk-width-1-5@m]="grid && indicator.width === 'small'"
[class.uk-width-1-3@m]="grid && indicator.width === 'medium'"
[class.uk-width-1-2@m]="!grid || indicator.width === 'large'"
[class.uk-width-1-5@m]="indicator.width === 'small'"
[class.uk-width-1-3@m]=" indicator.width === 'medium'"
[class.uk-width-1-2@m]=" indicator.width === 'large'"
[class.disable-sortable]="!canReorder"
[class.uk-sortable-nodrag]="!canReorder">
<div class="uk-card uk-card-default" [class.md-card-hover]="canReorder">
<div class="uk-padding-small uk-card-header">
<div class="md-card-toolbar-actions uk-float-right" [class.uk-flex-middle]="!grid" [class.uk-flex]="!grid">
<ng-template [ngIf]="!grid">
<div class="uk-margin-medium-right uk-flex uk-flex-middle">
<i class="material-icons md-24 uk-margin-small-right">{{indicatorUtils.isPublicIcon.get(indicator.isPublic)}}</i>
{{(indicator.isPublic) ? 'Public' : 'Private'}}
</div>
<div class="uk-margin-medium-right uk-flex uk-flex-middle">
<i class="material-icons md-24 uk-margin-small-right"
[class.md-color-green-300]="indicator.isActive">{{indicatorUtils.isActiveIcon}}</i>
{{(indicator.isActive) ? 'Active' : 'Inactive'}}
</div>
</ng-template>
<div class="uk-padding-small ">
<ng-container *ngTemplateOutlet="visibilityOptions; context:{indicator: indicator}"></ng-container>
<div class="md-card-toolbar-actions uk-float-right" >
<div class="md-card-dropdown uk-inline">
<i uk-icon="more-vertical"></i>
<i uk-icon="more-vertical" class="clickable"></i>
<div #element uk-dropdown="mode: click; pos: bottom-right; delay-hide: 0; flip: false"
class="uk-padding-remove-horizontal">
<ul class="uk-nav uk-dropdown-nav uk-margin-left">
<li *ngIf="isAdministrator && !indicator.defaultId && !editing"><a
(click)="editNumberIndicatorOpen(number, indicator._id)">Edit</a></li>
<li *ngIf="!editing"><a (click)="toggleIndicatorStatus(number._id, indicator);hide(element)">
{{indicator.isActive ? 'Inactive' : 'Active'}}</a>
</li>
<li *ngIf="!editing"><a (click)="toggleIndicatorAccess(number._id, indicator);hide(element)">
{{indicator.isPublic ? 'Private' : 'Public'}}</a>
</li>
<ng-template ngFor [ngForOf]="stakeholderUtils.visibility" let-v>
<li *ngIf="indicator.visibility != v.value"><a (click)="toggleIndicatorStatus(number._id,
indicator, v.value); hide(element)">
{{'Make ' + v.label.toLowerCase()}}</a>
</li>
</ng-template>
<hr *ngIf="isAdministrator && !indicator.defaultId" class="uk-nav-divider">
<li *ngIf="isAdministrator && !indicator.defaultId && !editing"><a
(click)="deleteIndicatorOpen(number, indicator._id, 'number', 'delete');hide(element)">Delete</a>
@ -150,47 +116,26 @@
</div>
</div>
</div>
<div class="uk-card-title">
{{indicator.name ? indicator.name : 'No title available'}}
</div>
</div>
<div *ngIf="grid" class="uk-card-body">
<div class="">
<div class="uk-flex uk-flex-center" uk-grid>
<div class="">
{{indicator.name ? indicator.name : 'No title available'}}
</div>
<div class="uk-width-1-1">
{{indicator.description}}
</div>
<div class="uk-width-1-2 uk-text-center"
title="{{indicator.isPublic?'Visible to all users':'Visible to members'}}">
<i class="material-icons md-24">{{indicatorUtils.isPublicIcon.get(indicator.isPublic)}}</i>
<div>{{(indicator.isPublic) ? 'Public' : 'Private'}}</div>
</div>
<div class="uk-width-1-2 uk-text-center"
title="{{indicator.isActive?'Included in the indicators list':'Available only through administration dashboard'}}">
<i class="material-icons md-24"
[class.md-color-green-300]="indicator.isActive">{{indicatorUtils.isActiveIcon}}</i>
<div>{{(indicator.isActive) ? 'Active' : 'Inactive'}}</div>
</div>
</div>
</div>
</div>
</div>
</ng-template>
<div *ngIf="isAdministrator" class="disable-sortable uk-sortable-nodrag"
[class.uk-width-1-3@m]="grid"
[class.uk-width-1-1@m]="!grid">
<div *ngIf="isAdministrator" class="disable-sortable uk-sortable-nodrag uk-width-1-3@m">
<div class="uk-card uk-card-default clickable" (click)="editNumberIndicatorOpen(number)">
<div class="uk-padding-small uk-card-header">
<div class="uk-card-title"
[class.uk-flex-middle]="!grid"
[class.uk-flex]="!grid"
[class.uk-flex-center]="!grid">
<i *ngIf="!grid" uk-icon="plus"></i>
<span>Create a custom Indicator</span>
</div>
</div>
<div *ngIf="grid" class="uk-card-body">
<div uk-grid>
<div class="uk-width-1-1">
<div class="uk-card-body">
<div uk-grid class="uk-text-center">
<div class="uk-width-1-1 uk-text-center">
Create a new number Indicator
</div>
<div class="uk-width-1-1 uk-flex uk-flex-center">
@ -202,7 +147,7 @@
</div>
</div>
</ng-template>
<div *ngIf="grid && isAdministrator" class="new-section uk-margin-top">
<div *ngIf="isAdministrator" class="new-section uk-margin-top">
<div class="tools uk-flex uk-flex-middle">
<button class="uk-margin-small-right uk-icon-button portal-button" (click)="createSection(-1, 'number')">
<i uk-icon="plus"></i>
@ -211,13 +156,13 @@
</div>
</div>
</div>
<h4 class="uk-text-bold">Chart Indicators</h4>
<h6 class="uk-text-bold">Chart Indicators</h6>
<div *ngIf="chartSections">
<ng-template ngFor [ngForOf]="displayCharts" let-chart let-i="index">
<div [class.list-view]="!grid" [id]="'chart-' + chart._id"
<div [id]="'chart-' + chart._id"
class="uk-grid-match section uk-grid-small uk-grid uk-margin-top"
uk-sortable="group: chart" uk-grid>
<div *ngIf="grid" class="tools disable-sortable uk-sortable-nodrag">
<div class="tools disable-sortable uk-sortable-nodrag">
<div class="actions">
<a [class.uk-disabled]="editing" class="" (click)="createSection(i)"
title="Create a new section"><i
@ -240,7 +185,7 @@
<!-- </ng-container>-->
</div>
</div>
<div *ngIf="grid && chartSections.at(i)"
<div *ngIf="chartSections.at(i)"
class="uk-form-row uk-width-1-1 uk-grid-medium uk-flex uk-flex-middle uk-margin-bottom disable-sortable uk-sortable-nodrag"
uk-grid>
<div dashboard-input class="uk-width-2-3 uk-width-1-3@m" [formInput]="chartSections.at(i).get('title')"
@ -252,56 +197,30 @@
</button>
</div>
</div>
<div *ngIf="!grid && chart.title" class="uk-width-1-1 disable-sortable uk-sortable-nodrag">
<h4>{{chart.title}}</h4>
</div>
<ng-template ngFor [ngForOf]="chart.indicators" let-indicator let-j="index">
<div *ngIf="indicator" [id]="indicator._id"
[class.uk-width-1-3@m]="grid && indicator.width === 'small'"
[class.uk-width-1-2@m]="grid && indicator.width === 'medium'"
[class.uk-width-1-1@m]="!grid || indicator.width === 'large'"
[class.uk-width-1-3@m]="indicator.width === 'small'"
[class.uk-width-1-2@m]=" indicator.width === 'medium'"
[class.uk-width-1-1@m]="indicator.width === 'large'"
[class.disable-sortable]="!canReorder"
[class.uk-sortable-nodrag]="!canReorder">
<div class="uk-card uk-card-default" [class.md-card-hover]="canReorder">
<div class="uk-padding-small uk-card-header">
<div class="md-card-toolbar-actions uk-float-right" [class.uk-flex-middle]="!grid" [class.uk-flex]="!grid">
<ng-template [ngIf]="!grid">
<div *ngFor="let indicatorPath of indicator.indicatorPaths"
class="uk-margin-medium-right uk-text-capitalize uk-flex uk-flex-middle">
<i class="material-icons md-24 uk-margin-small-right">
{{indicatorUtils.chartTypesIcons.get(indicatorPath.type)}}
</i>
{{indicatorPath.type + ' Chart'}}
</div>
</ng-template>
<div *ngIf="!grid" class="uk-margin-medium-right uk-flex uk-flex-middle"
title="{{indicator.isPublic?'Visible to all users':'Visible to members'}}">
<i class="material-icons md-24 uk-margin-small-right">
{{indicatorUtils.isPublicIcon.get(indicator.isPublic)}}
</i>
{{(indicator.isPublic) ? 'Public' : 'Private'}}
</div>
<div *ngIf="!grid" class="uk-margin-medium-right uk-flex uk-flex-middle"
title="{{indicator.isActive?'Included in the indicators list':'Available only through administration dashboard'}}">
<i class="material-icons md-24 uk-margin-small-right"
[class.md-color-green-300]="indicator.isActive">
{{indicatorUtils.isActiveIcon}}
</i>
{{(indicator.isActive) ? 'Active' : 'Inactive'}}
</div>
<div class="uk-padding-small uk-padding-remove-bottom ">
<ng-container *ngTemplateOutlet="visibilityOptions; context:{indicator: indicator}"></ng-container>
<div class="md-card-toolbar-actions uk-float-right" >
<div class="md-card-dropdown uk-inline">
<i uk-icon="more-vertical"></i>
<i uk-icon="more-vertical" class="clickable"></i>
<div #element uk-dropdown="mode: click; pos: bottom-right; delay-hide: 0; flip: false"
class="uk-padding-remove-horizontal">
<ul class="uk-nav uk-dropdown-nav uk-margin-left">
<li *ngIf="!editing"><a (click)="editChartIndicatorOpen(chart, indicator._id);hide(element)">Edit</a>
</li>
<li *ngIf="!editing"><a (click)="toggleIndicatorStatus(chart._id, indicator);hide(element)">
{{indicator.isActive ? 'Inactive' : 'Active'}}</a>
</li>
<li *ngIf="!editing"><a (click)="toggleIndicatorAccess(chart._id, indicator);hide(element)">
{{indicator.isPublic ? 'Private' : 'Public'}}</a>
</li>
<ng-template ngFor [ngForOf]="stakeholderUtils.visibility" let-v>
<li *ngIf="indicator.visibility != v.value"><a (click)="toggleIndicatorStatus(chart._id,
indicator, v.value); hide(element)">
{{'Make ' + v.label.toLowerCase()}}</a>
</li>
</ng-template>
<hr *ngIf="!indicator.defaultId " class="uk-nav-divider">
<li *ngIf="!editing && !indicator.defaultId "><a
(click)="deleteIndicatorOpen(chart, indicator._id, 'chart', 'delete');hide(element)">
@ -313,40 +232,18 @@
</div>
</div>
</div>
<div class="">
{{indicator.name}}
</div>
</div>
<div *ngIf="grid" class="uk-card-body">
<div class="uk-flex uk-flex-center" uk-grid>
<div class="uk-width-1-3 uk-text-center"
[ngClass]="'uk-child-width-1-' + indicator.indicatorPaths.length" uk-grid>
<div *ngFor="let indicatorPath of indicator.indicatorPaths">
<i class="material-icons md-24">
{{indicatorUtils.chartTypesIcons.get(indicatorPath.type)}}
</i>
<div class="uk-text-capitalize">{{indicatorPath.type + ' Chart'}}</div>
</div>
</div>
<div class="uk-width-1-3 uk-text-center"
title="{{indicator.isPublic?'Visible to all users':'Visible to members'}}">
<i class="material-icons md-24">
{{indicatorUtils.isPublicIcon.get(indicator.isPublic)}}
</i>
<div>{{(indicator.isPublic) ? 'Public' : 'Private'}}</div>
</div>
<div class="uk-width-1-3 uk-text-center"
title="{{indicator.isActive?'Included in the indicators list':'Available only through administration dashboard'}}">
<i class="material-icons md-24" [class.md-color-green-300]="indicator.isActive">
{{indicatorUtils.isActiveIcon}}
</i>
<div>{{(indicator.isActive) ? 'Active' : 'Inactive'}}</div>
</div>
<div class="uk-padding-small uk-padding-remove-top">
<div class="">
<div class="uk-text-center">
{{indicator.name}}
</div>
<iframe *ngIf="indicator.indicatorPaths[0] && indicator.indicatorPaths[0].source !== 'image' &&
safeUrls.get(indicatorUtils.getFullUrl(stakeholder, indicator.indicatorPaths[0]))"
[src]="safeUrls.get(indicatorUtils.getFullUrl(stakeholder, indicator.indicatorPaths[0]))"
class="uk-width-1-1 uk-height-medium"></iframe>
<!-- <div>Uncomment for iframes preview</div>-->
<div *ngIf="indicator.indicatorPaths[0] && indicator.indicatorPaths[0].source === 'image'">
<img class="uk-width-1-1 uk-height-medium" [src]="indicator.indicatorPaths[0].url">
</div>
@ -358,21 +255,11 @@
</div>
</div>
</ng-template>
<div class="disable-sortable uk-sortable-nodrag"
[class.uk-width-1-3@m]="grid"
[class.uk-width-1-1@m]="!grid">
<div class="disable-sortable uk-sortable-nodrag uk-width-1-2@m">
<div class="uk-card uk-card-default clickable" (click)="editChartIndicatorOpen(chart)">
<div class="uk-padding-small uk-card-header">
<div class=""
[class.uk-flex-middle]="!grid"
[class.uk-flex]="!grid"
[class.uk-flex-center]="!grid">
<i *ngIf="!grid" uk-icon="plus"></i>
<span>Create a custom Indicator</span>
</div>
</div>
<div *ngIf="grid" class="uk-card-body">
<div uk-grid>
<div class="uk-card-body">
<div >
<div class="uk-text-bold">Create a custom indicator</div>
<div class="uk-width-1-1">
Use our advance tool to create a custom Indicator that suit the needs of your funding
KPI's.
@ -386,7 +273,7 @@
</div>
</div>
</ng-template>
<div *ngIf="grid" class="new-section uk-margin-top">
<div class="new-section uk-margin-top">
<div class="tools uk-flex uk-flex-middle">
<button [disabled]="editing" class="uk-margin-small-right uk-icon-button portal-button" (click)="createSection()">
<i uk-icon="plus"></i>
@ -407,11 +294,8 @@
label="Description" type="textarea">
</div>
<div class="uk-form-row uk-flex uk-flex-middle">
<div dashboard-input class="uk-width-small" [formInput]="numberIndicatorFb.get('isPublic')"
label="Accessibility" [options]="indicatorUtils.isPublic" type="select">
</div>
<div dashboard-input class="uk-margin-small-left uk-width-small" [formInput]="numberIndicatorFb.get('isActive')"
label="Visibility" [options]="indicatorUtils.isActive" type="select">
<div dashboard-input class="uk-width-small" [formInput]="numberIndicatorFb.get('visibility')"
label="Visibility" [options]="stakeholderUtils.visibility" type="select">
</div>
<div dashboard-input class="uk-margin-small-left uk-width-small" [formInput]="numberIndicatorFb.get('width')"
type="select" [options]="indicatorUtils.indicatorSizes"
@ -472,11 +356,8 @@
label="Description" type="textarea">
</div>
<div class="uk-form-row uk-flex uk-flex-middle">
<div dashboard-input class="uk-width-small" [formInput]="chartIndicatorFb.get('isPublic')"
label="Accessibility" [options]="indicatorUtils.isPublic" type="select">
</div>
<div dashboard-input class="uk-margin-small-left uk-width-small" [formInput]="chartIndicatorFb.get('isActive')"
label="Visibility" [options]="indicatorUtils.isActive" type="select">
<div dashboard-input class="uk-width-small" [formInput]="chartIndicatorFb.get('visibility')"
label="Visibility" [options]="stakeholderUtils.visibility" type="select">
</div>
<div dashboard-input class="uk-margin-small-left uk-width-small" [formInput]="chartIndicatorFb.get('width')"
type="select" [options]="indicatorUtils.indicatorSizes"
@ -609,3 +490,22 @@
<!-- You are about to delete this section and its indicators permanently.-->
<!-- Are you sure you want to proceed?-->
<!--</modal-alert>-->
<ng-template #visibilityOptions let-indicator="indicator" >
<span class="uk-invisible-hover uk-padding-remove" (click)="$event.stopPropagation();$event.preventDefault()">
<i [attr.uk-icon]="stakeholderUtils.isPublicIcon.get(indicator.visibility)" class="clickable"></i>
<div #element uk-dropdown="mode: click; pos: bottom-left; delay-hide: 0; flip: false">
<ul class="uk-nav uk-dropdown-nav">
<li *ngFor="let v of stakeholderUtils.visibility" [class.selectedVisibility]="v.value == indicator.visibility">
<a
*ngIf="indicator.visibility != v.value"
(click)="$event.stopPropagation();toggleIndicatorStatus(indicator._id, indicator,v.value);hide(element);$event.preventDefault()">
<i [attr.uk-icon]="stakeholderUtils.isPublicIcon.get( v.value)"></i> {{v.label}}</a>
<a *ngIf="indicator.visibility == v.value">
<i [attr.uk-icon]="stakeholderUtils.isPublicIcon.get( v.value)"></i> {{v.label}} <icon
customClass="uk-text-secondary uk-float-right" [ratio]="0.5"
name="bullet"></icon></a>
</li>
</ul>
</div>
</span>
</ng-template>

View File

@ -9,8 +9,15 @@ import {
SimpleChanges,
ViewChild
} from "@angular/core";
import {Indicator, IndicatorPath, IndicatorType, Section, Stakeholder} from "../openaireLibrary/monitor/entities/stakeholder";
import {IndicatorUtils} from "../utils/indicator-utils";
import {
Indicator,
IndicatorPath,
IndicatorType,
Section,
Stakeholder,
Visibility
} from "../openaireLibrary/monitor/entities/stakeholder";
import {IndicatorUtils, StakeholderUtils} from "../utils/indicator-utils";
import {FormArray, FormBuilder, FormControl, FormGroup, Validators} from "@angular/forms";
import {AlertModal} from "../openaireLibrary/utils/modal/alert";
import {StatisticsService} from "../utils/services/statistics.service";
@ -45,6 +52,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
public user = null;
public preview: string;
public indicatorUtils: IndicatorUtils = new IndicatorUtils();
public stakeholderUtils: StakeholderUtils = new StakeholderUtils();
public numberIndicatorFb: FormGroup;
public chartIndicatorFb: FormGroup;
public chartSections: FormArray;
@ -71,7 +79,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
/**
* Toggles
*/
public grid: boolean = true;
// public grid: boolean = true;
public editing: boolean = false;
/** Safe Urls*/
public safeUrls: Map<string, SafeResourceUrl> = new Map<string, SafeResourceUrl>([]);
@ -91,7 +99,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
public indicatorChildrenActionOnDelete: string;
urlParameterizedMessage = "";
constructor(private layoutService: LayoutService,
constructor(private layoutService: LayoutService,
private stakeholderService: StakeholderService,
private statisticsService: StatisticsService,
private userManagementService: UserManagementService,
@ -203,24 +211,17 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
hide(element: any) {
UIkit.dropdown(element).hide();
}
public changeGrid(value) {
this.grid = value;
}
private buildFilters() {
this.filters = this.fb.group({
chartType: this.fb.control('all'),
privacy: this.fb.control('all'),
status: this.fb.control('all'),
keyword: this.fb.control('')
});
this.subscriptions.push(this.filters.get('chartType').valueChanges.subscribe(value => {
this.onChartTypeChange(value);
}));
this.subscriptions.push(this.filters.get('privacy').valueChanges.subscribe(value => {
this.onPrivacyChange(value);
}));
this.subscriptions.push(this.filters.get('status').valueChanges.subscribe(value => {
this.onStatusChange(value);
}));
@ -255,10 +256,9 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
}
filterCharts() {
this.displayCharts = this.filterChartType(this.filterPrivacy(
this.displayCharts = this.filterChartType(
this.filterStatus(this.filterByKeyword(HelperFunctions.copy(this.charts), this.filters.value.keyword),
this.filters.value.status),
this.filters.value.privacy),
this.filters.value.chartType
);
this.displayCharts.forEach(section => {
@ -276,10 +276,9 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
}
filterNumbers() {
this.displayNumbers = this.filterPrivacy(this.filterStatus(
this.displayNumbers = this.filterStatus(
this.filterByKeyword(HelperFunctions.copy(this.numbers), this.filters.value.keyword),
this.filters.value.status),
this.filters.value.privacy);
this.filters.value.status);
this.buildSections();
}
@ -287,11 +286,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
this.displayCharts = this.filterChartType(HelperFunctions.copy(this.charts), value);
}
onPrivacyChange(value) {
this.displayCharts = this.filterPrivacy(HelperFunctions.copy(this.charts), value);
this.displayNumbers = this.filterPrivacy(HelperFunctions.copy(this.numbers), value);
}
onStatusChange(value) {
this.displayCharts = this.filterStatus(HelperFunctions.copy(this.charts), value);
this.displayNumbers = this.filterStatus(HelperFunctions.copy(this.numbers), value);
@ -311,18 +306,12 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
return sections;
}
private filterPrivacy(sections: Section[], value): Section[] {
if (value !== 'all') {
sections.forEach(section =>
section.indicators = section.indicators.filter(indicator => indicator.isPublic === value));
}
return sections;
}
private filterStatus(sections: Section[], value): Section[] {
if (value !== 'all') {
sections.forEach(section =>
section.indicators = section.indicators.filter(indicator => indicator.isActive === value));
section.indicators = section.indicators.filter(indicator => indicator.visibility === value));
}
return sections;
}
@ -371,8 +360,8 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
}
get canReorder(): boolean {
return this.filters.value.chartType === 'all' && this.filters.value.privacy === 'all' &&
this.filters.value.status === 'all' && this.filters.value.keyword === '' && this.grid && !this.editing;
return this.filters.value.chartType === 'all' &&
this.filters.value.status === 'all' && this.filters.value.keyword === '' && !this.editing;
}
get canEdit() {
@ -578,8 +567,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
_id: this.fb.control(this.indicator._id),
name: this.fb.control(this.indicator.name, Validators.required),
description: this.fb.control(this.indicator.description),
isPublic: this.fb.control(this.indicator.isPublic),
isActive: this.fb.control(this.indicator.isActive),
visibility: this.fb.control(this.indicator.visibility),
indicatorPaths: this.fb.array([], Validators.required),
type: this.fb.control(this.indicator.type),
width: this.fb.control(this.indicator.width),
@ -589,13 +577,12 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
this.addNumberIndicatorPath(this.statisticsService.getNumberUrl(indicatorPath.source,this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath)),indicatorPath.parameters, indicatorPath.source, this.getJsonPathAsFormArray(indicatorPath));
});
} else {
this.indicator = new Indicator('', '', 'number', 'small', true, true, []);
this.indicator = new Indicator('', '', 'number', 'small', "PUBLIC", []);
this.numberIndicatorFb = this.fb.group({
_id: this.fb.control(this.indicator._id),
name: this.fb.control(this.indicator.name, Validators.required),
description: this.fb.control(this.indicator.description),
isPublic: this.fb.control(this.indicator.isPublic),
isActive: this.fb.control(this.indicator.isActive),
visibility: this.fb.control(this.indicator.visibility),
indicatorPaths: this.fb.array([], Validators.required),
type: this.fb.control(this.indicator.type),
width: this.fb.control(this.indicator.width),
@ -631,8 +618,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
_id: this.fb.control(this.indicator._id),
name: this.fb.control(this.indicator.name),
description: this.fb.control(this.indicator.description),
isPublic: this.fb.control(this.indicator.isPublic),
isActive: this.fb.control(this.indicator.isActive),
visibility: this.fb.control(this.indicator.visibility),
indicatorPaths: this.fb.array([]),
width: this.fb.control(this.indicator.width),
defaultId: this.fb.control(this.indicator.defaultId)
@ -643,13 +629,12 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath);
});
} else {
this.indicator = new Indicator('', '', 'chart', 'medium', true, true, []);
this.indicator = new Indicator('', '', 'chart', 'medium', "PUBLIC",[]);
this.chartIndicatorFb = this.fb.group({
_id: this.fb.control(this.indicator._id),
name: this.fb.control(this.indicator.name),
description: this.fb.control(this.indicator.description),
isPublic: this.fb.control(this.indicator.isPublic),
isActive: this.fb.control(this.indicator.isActive),
visibility: this.fb.control(this.indicator.visibility),
indicatorPaths: this.fb.array([]),
width: this.fb.control(this.indicator.width, Validators.required),
defaultId: this.fb.control(this.indicator.defaultId)
@ -817,7 +802,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
});
}
toggleIndicatorStatus(sectionId: string, indicator: Indicator) {
toggleIndicatorStatus(sectionId: string, indicator: Indicator, visibility:Visibility) {
this.editing = true;
let path = [
this.stakeholder._id,
@ -827,9 +812,9 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
sectionId,
indicator._id
];
this.stakeholderService.toggleStatus(this.properties.monitorServiceAPIURL, path).subscribe(isActive => {
indicator.isActive = isActive;
UIkit.notification('Indicator has been successfully changed to ' + (isActive?'active':'inactive'), {
this.stakeholderService.toggleVisibility(this.properties.monitorServiceAPIURL, path, visibility).subscribe(visibility => {
indicator.visibility = visibility;
UIkit.notification('Indicator has been successfully changed to ' + visibility.toLowerCase, {
status: 'success',
timeout: 3000,
pos: 'top-left'
@ -845,7 +830,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
});
}
toggleIndicatorAccess(sectionId: string, indicator: Indicator) {
/*toggleIndicatorAccess(sectionId: string, indicator: Indicator) {
this.editing = true;
let path = [
this.stakeholder._id,
@ -855,9 +840,9 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
sectionId,
indicator._id
];
this.stakeholderService.toggleAccess(this.properties.monitorServiceAPIURL, path).subscribe(isPublic => {
indicator.isPublic = isPublic;
UIkit.notification('Indicator has been successfully changed to ' + (isPublic?'public':'private'), {
this.stakeholderService.toggleAccess(this.properties.monitorServiceAPIURL, path).subscribe(visibility => {
indicator.visibility = visibility;
UIkit.notification('Indicator has been successfully changed to ' + (visibility?'public':'private'), {
status: 'success',
timeout: 3000,
pos: 'top-left'
@ -871,7 +856,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
});
this.editing = false;
});
}
}*/
saveSection(section: Section, index: number, type: IndicatorType = "chart") {
this.editing = true;

View File

@ -14,7 +14,7 @@
<div *ngIf="stakeholder && stakeholder.topics[topicIndex]" class="menu_section">
<ul class="uk-list">
<li class="uk-margin-bottom md-bg-blue-900 uk-padding-small">
<a [routerLink]="'/admin/' + stakeholder.alias + '/general'" class="uk-link">
<a [routerLink]="'/admin/' + stakeholder.alias" class="uk-link">
<span class="" uk-icon="icon:close;ratio:2"></span>
</a>
@ -33,11 +33,10 @@
<!-- <span [innerHTML]="satinizeHTML(topic.icon)"></span>-->
</span>
<div class="menu_title uk-width-expand uk-text-center">
<ng-container *ngTemplateOutlet="visibilityOptions; context:
{i:i, type: 'topic',
visibility: stakeholder.topics[i].visibility}"></ng-container>
{{topic.name}}
<!--<i
class="material-icons md-18 uk-margin-small-left">{{topic.isPublic ? 'public' : 'lock'}}</i>
<i class="material-icons md-18"
[class.md-color-green-300]="topic.isActive">brightness_1</i>-->
</div>
<div class="uk-invisible-hover" (click)="$event.stopPropagation();$event.preventDefault()">
<i class=" onHover" uk-icon="more-vertical"></i>
@ -45,12 +44,12 @@
class="uk-padding-remove-horizontal">
<ul class="uk-nav uk-dropdown-nav uk-list">
<li><a (click)="editTopicOpen(i); hide(element)">Edit</a></li>
<li><a (click)="toggleTopicStatus(i); hide(element)">
{{topic.isActive ? 'Inactive' : 'Active'}}</a>
</li>
<li><a (click)="toggleTopicAccess(i); hide(element)">
{{topic.isPublic?'Private':'Public'}}</a>
</li>
<ng-template ngFor [ngForOf]="stakeholderUtils.visibility" let-v>
<li *ngIf="topic.visibility != v.value"><a (click)="toggleTopicStatus(i, v.value);
hide(element)">
{{'Make ' + v.label.toLowerCase()}}</a>
</li>
</ng-template>
<hr *ngIf="!topic.defaultId" class="uk-nav-divider">
<li *ngIf="!topic.defaultId"><a (click)="deleteTopicOpen(i, 'delete'); hide(element)">Delete</a>
<!-- <ng-container *ngIf="!stakeholder.defaultId">-->
@ -75,134 +74,6 @@
</ul>
</li>
</ul>
<!-- <ul class="uk-list">
<li class="uk-margin-bottom md-bg-blue-900 uk-padding-small">
<a [routerLink]="'../'" class="md-color-white">
<span class="menu_icon"><i class="material-icons md-color-white">arrow_back</i></span>
<div class="menu_title uk-width-expand">
{{stakeholder.topics[topicIndex].name.toUpperCase()}}
</div>
<div class="menu_on_hover"
(click)="$event.stopPropagation();$event.preventDefault()">
<i class="onHover " uk-icon="more-vertical"></i>
<div #element uk-dropdown="mode: click; pos: bottom-right; offset: 5; delay-hide: 0; flip: false"
class="uk-padding-remove-horizontal">
<ul class="uk-nav uk-dropdown-nav uk-list">
<li><a (click)="editTopicOpen(); hide(element)">Edit</a></li>
<li><a (click)="toggleTopicStatus(); hide(element)">
{{stakeholder.topics[topicIndex].isActive ? 'Inactive' : 'Active'}}</a>
</li>
<li><a (click)="toggleTopicAccess(); hide(element)">
{{stakeholder.topics[topicIndex].isPublic ? 'Private' : 'Public'}}</a>
</li>
<hr *ngIf="!stakeholder.topics[topicIndex].defaultId" class="uk-nav-divider">
<li *ngIf="!stakeholder.topics[topicIndex].defaultId"><a
(click)="deleteTopicOpen('delete'); hide(element)">Delete
</a>
&lt;!&ndash; <ng-container *ngIf="!stakeholder.defaultId">&ndash;&gt;
&lt;!&ndash; <a (click)="deleteTopicOpen('delete'); hide(element)">Delete from all profiles</a>&ndash;&gt;
&lt;!&ndash; <a (click)="deleteTopicOpen('disconnect'); hide(element)">Delete and disconnect from all profiles</a>&ndash;&gt;
&lt;!&ndash; </ng-container>&ndash;&gt;
</li>
</ul>
</div>
</div>
</a>
</li>
<ng-template ngFor [ngForOf]="stakeholder.topics[topicIndex].categories" let-category let-i="index">
<li [class.current_section]="categoryIndex === i"
[class.act_section]="selectedCategoryIndex === i && toggle"
[title]="category.name+': '+(category.isActive?'Active':'Inactive')+', '+(category.isPublic?'Public':'Private')"
class="submenu_trigger">
<a href="#" (click)="toggleCategory(i);$event.preventDefault()" class="uk-flex">
<span *ngIf="category.icon" class="menu_icon"><i
class="material-icons">{{category.icon}}</i></span>
<div class="menu_title uk-width-expand" >
{{category.name}}
</div>
<div class="menu_on_hover"
(click)="$event.stopPropagation();$event.preventDefault()">
<i class=" onHover" uk-icon="more-vertical"></i>
<div #element uk-dropdown="mode: click; pos: bottom-right; offset: 5; delay-hide: 0; flip: false"
class="uk-padding-remove-horizontal">
<ul class="uk-nav uk-dropdown-nav">
<li><a (click)="editCategoryOpen(i); hide(element)">Edit</a></li>
<li><a (click)="toggleCategoryStatus(i); hide(element)">
{{category.isActive ? 'Inactive' : 'Active'}}</a>
</li>
<li><a (click)="toggleCategoryAccess(i); hide(element)">
{{category.isPublic ? 'Private' : 'Public'}}</a>
</li>
<hr *ngIf="!stakeholder.topics[topicIndex].categories[i].defaultId" class="uk-nav-divider">
<li *ngIf="!stakeholder.topics[topicIndex].categories[i].defaultId"><a
(click)="deleteCategoryOpen(i, 'delete'); hide(element)">Delete</a>
&lt;!&ndash; <ng-container *ngIf="!stakeholder.defaultId">&ndash;&gt;
&lt;!&ndash; <a (click)="deleteCategoryOpen(i, 'delete'); hide(element)">Delete from all profiles</a>&ndash;&gt;
&lt;!&ndash; <a (click)="deleteCategoryOpen(i, 'disconnect'); hide(element)">Delete and disconnect from all profiles</a>&ndash;&gt;
&lt;!&ndash; </ng-container>&ndash;&gt;
</li>
</ul>
</div>
</div>
</a>
<ul [style.display]="((selectedCategoryIndex === i && toggle)?'block':'none')">
<ng-template ngFor [ngForOf]="stakeholder.topics[topicIndex].categories[i].subCategories"
let-subcategory let-j="index">
<li [class.act_item]="categoryIndex === i && subCategoryIndex === j"
[title]="subcategory.name +': ' + (subcategory.isActive?'Active':'Inactive')+', '+(subcategory.isPublic?'Public':'Private')">
<a href="#" (click)="chooseSubcategory(i, j);$event.preventDefault()" class="uk-flex">
<span *ngIf="subcategory.icon" class="menu_icon uk-margin-small-right"><i
class="material-icons">{{subcategory.icon}}</i></span>
<div class="menu_title uk-width-expand ">
{{subcategory.name}}
&lt;!&ndash; <i class="material-icons md-18 uk-margin-small-left">{{subcategory.isPublic ? 'public' : 'lock'}}</i>
<i class="material-icons md-18"
[class.md-color-green-300]="subcategory.isActive">brightness_1</i>&ndash;&gt;
</div>
<div class="menu_on_hover"
(click)="$event.stopPropagation();$event.preventDefault()">
<i class=" onHover" uk-icon="more-vertical"></i>
<div #element uk-dropdown="mode: click; pos: bottom-right; offset: 5; delay-hide: 0; flip: false"
class="uk-padding-remove-horizontal">
<ul class="uk-nav uk-dropdown-nav">
<li><a (click)="editSubCategoryOpen(j); hide(element)">Edit</a></li>
<li><a (click)="toggleSubcategoryStatus(j); hide(element)">
{{subcategory.isActive ? 'Inactive' : 'Active'}}</a>
</li>
<li><a (click)="toggleSubcategoryAccess(j); hide(element)">
{{subcategory.isPublic ? 'Private' : 'Public'}}</a>
</li>
<hr *ngIf="!stakeholder.topics[topicIndex].categories[i].subCategories[j].defaultId"
class="uk-nav-divider">
<li *ngIf="!stakeholder.topics[topicIndex].categories[i].subCategories[j].defaultId"><a
(click)="deleteSubcategoryOpen(j, 'delete'); hide(element)">Delete</a>
&lt;!&ndash; <ng-container *ngIf="!stakeholder.defaultId">&ndash;&gt;
&lt;!&ndash; <a (click)="deleteSubcategoryOpen(j, 'delete'); hide(element)">Delete from all profiles</a>&ndash;&gt;
&lt;!&ndash; <a (click)="deleteSubcategoryOpen(j, 'disconnect'); hide(element)">Delete and disconnect from all profiles</a>&ndash;&gt;
&lt;!&ndash; </ng-container>&ndash;&gt;
</li>
</ul>
</div>
</div>
</a>
</li>
</ng-template>
<li>
<a href="#" (click)="editSubCategoryOpen();$event.preventDefault()">
<span class="menu_icon"><i uk-icon="plus"></i></span>
<span class="menu_title">Create new Subcategory</span>
</a>
</li>
</ul>
</li>
</ng-template>
<li>
<a href="#" (click)="editCategoryOpen();$event.preventDefault()">
<span class="menu_icon"><i uk-icon="plus"></i></span>
<span class="menu_title">Create new Category</span>
</a>
</li>
</ul>-->
</div>
</div>
<div *ngIf="!isSmallScreen" id="sidebar_switcher_toggle" class="clickable "
@ -225,7 +96,11 @@
[class.uk-active]="category.alias === stakeholder.topics[topicIndex].categories[categoryIndex].alias">
<a (click)="toggleCategory(i)"
class="uk-margin-remove-bottom uk-h4"
><span>{{category.name}}</span>
>
<ng-container *ngTemplateOutlet="visibilityOptions; context:
{i:i, type: 'cat',
visibility: stakeholder.topics[topicIndex].categories[i].visibility}"></ng-container>
<span> {{category.name}}</span>
<span class="uk-invisible-hover"
(click)="$event.stopPropagation();$event.preventDefault()">
<i class=" onHover" uk-icon="more-vertical"></i>
@ -233,12 +108,12 @@
class="uk-padding-remove-horizontal">
<ul class="uk-nav uk-dropdown-nav">
<li><a (click)="editCategoryOpen(i); hide(element)">Edit</a></li>
<li><a (click)="toggleCategoryStatus(i); hide(element)">
{{category.isActive ? 'Inactive' : 'Active'}}</a>
</li>
<li><a (click)="toggleCategoryAccess(i); hide(element)">
{{category.isPublic ? 'Private' : 'Public'}}</a>
</li>
<ng-template ngFor [ngForOf]="stakeholderUtils.visibility" let-v>
<li *ngIf="category.visibility != v.value"><a (click)="toggleCategoryStatus(i, v.value);
hide(element)">
{{'Make ' + v.label.toLowerCase()}}</a>
</li>
</ng-template>
<hr *ngIf="!stakeholder.topics[topicIndex].categories[i].defaultId" class="uk-nav-divider">
<li *ngIf="!stakeholder.topics[topicIndex].categories[i].defaultId"><a
(click)="deleteCategoryOpen(i, 'delete'); hide(element)">Delete</a>
@ -265,8 +140,11 @@
<li
[class.uk-active]="(subCategory.alias ===
stakeholder.topics[topicIndex].categories[categoryIndex].subCategories[subCategoryIndex].alias)" class=" uk-visible-toggle uk-flex uk-flex-middle">
<ng-container *ngTemplateOutlet="visibilityOptions; context:
{i:i, type: 'sub',
visibility: stakeholder.topics[topicIndex].categories[categoryIndex].subCategories[i].visibility}"></ng-container>
<a (click)="chooseSubcategory(categoryIndex, i);$event.preventDefault()"
class="uk-margin-remove-bottom uk-h3"
class="uk-margin-remove-bottom"
><span>{{subCategory.name}}</span>
</a>
@ -277,12 +155,12 @@
class="uk-padding-remove-horizontal">
<ul class="uk-nav uk-dropdown-nav">
<li><a (click)="editSubCategoryOpen(i); hide(element)">Edit</a></li>
<li><a (click)="toggleSubcategoryStatus(i); hide(element)">
{{subCategory.isActive ? 'Inactive' : 'Active'}}</a>
</li>
<li><a (click)="toggleSubcategoryAccess(i); hide(element)">
{{subCategory.isPublic ? 'Private' : 'Public'}}</a>
</li>
<ng-template ngFor [ngForOf]="stakeholderUtils.visibility" let-v>
<li *ngIf="subCategory.visibility != v.value"><a (click)="toggleSubcategoryStatus(i, v.value);
hide(element)">
{{'Make ' + v.label.toLowerCase()}}</a>
</li>
</ng-template>
<hr *ngIf="!stakeholder.topics[topicIndex].categories[categoryIndex].subCategories[i].defaultId"
class="uk-nav-divider">
<li *ngIf="!stakeholder.topics[topicIndex].categories[categoryIndex].subCategories[i].defaultId"><a
@ -305,7 +183,7 @@
</div>
</div>
<div id="page_content_inner" style="margin-top: 140px;">
<div id="page_content_inner" style="margin-top: 40px;">
<indicators *ngIf="stakeholder" [properties]="properties"
[topicIndex]="topicIndex"
[categoryIndex]="categoryIndex"
@ -319,46 +197,7 @@
</div>
Are you sure you want to proceed?
</modal-alert>
<!--<modal-alert #deleteModal>-->
<!-- You are about to delete <span class="uk-text-bold" *ngIf="element">"{{element.name}}"</span> {{type}} permanently.-->
<!-- <div *ngIf="!stakeholder.topics[topicIndex].defaultId">-->
<!-- <div class="uk-margin-top uk-margin-bottom">-->
<!-- <div>Delete this {{type}} only.</div>-->
<!-- <div class="uk-text-center">-->
<!-- <a *ngIf="type == 'topic'" class="md-btn md-btn-primary waves-button waves-effect uk-width-1-2"-->
<!-- (click)="deleteElement(); closeDeleteModal()">Delete</a>-->
<!-- <a *ngIf="type == 'category'" class="md-btn md-btn-primary waves-button waves-effect uk-width-1-2"-->
<!-- (click)="deleteElement(); closeDeleteModal()">Delete</a>-->
<!-- <a *ngIf="type == 'subcategory'" class="md-btn md-btn-primary waves-button waves-effect uk-width-1-2"-->
<!-- (click)="deleteElement(); closeDeleteModal()">Delete</a>-->
<!-- </div>-->
<!-- </div>-->
<!-- <ng-container *ngIf="!stakeholder.defaultId">-->
<!-- <div class="uk-margin-top uk-margin-bottom">-->
<!-- <div>Delete this {{type}} and {{getPluralTypeName()}} of all profiles based on this default {{type}}.</div>-->
<!-- <div class="uk-text-center">-->
<!-- <a *ngIf="type == 'topic'" class="md-btn md-btn-primary waves-button waves-effect uk-width-1-2"-->
<!-- (click)="deleteElement('delete'); closeDeleteModal()">Delete all</a>-->
<!-- <a *ngIf="type == 'category'" class="md-btn md-btn-primary waves-button waves-effect uk-width-1-2"-->
<!-- (click)="deleteElement('delete'); closeDeleteModal()">Delete all</a>-->
<!-- <a *ngIf="type == 'subcategory'" class="md-btn md-btn-primary waves-button waves-effect uk-width-1-2"-->
<!-- (click)="deleteElement('delete'); closeDeleteModal()">Delete all</a>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="uk-margin-top uk-margin-bottom">-->
<!-- <div>Delete this {{type}} and {{getPluralTypeName()}} of all profiles based on this default {{type}}, will not be marked as copied from default anymore.</div>-->
<!-- <div class="uk-text-center">-->
<!-- <a *ngIf="type == 'topic'" class="md-btn md-btn-primary waves-button waves-effect uk-width-1-2"-->
<!-- (click)="deleteElement('disconnect'); closeDeleteModal()">Delete and disconnect</a>-->
<!-- <a *ngIf="type == 'category'" class="md-btn md-btn-primary waves-button waves-effect uk-width-1-2"-->
<!-- (click)="deleteElement('disconnect'); closeDeleteModal()">Delete and disconnect</a>-->
<!-- <a *ngIf="type == 'subcategory'" class="md-btn md-btn-primary waves-button waves-effect uk-width-1-2"-->
<!-- (click)="deleteElement('disconnect'); closeDeleteModal()">Delete and disconnect</a>-->
<!-- </div>-->
<!-- </div>-->
<!-- </ng-container>-->
<!-- </div>-->
<!--</modal-alert>-->
<modal-alert #editModal (alertOutput)="saveElement()">
<div *ngIf="form" class="uk-padding-small" [formGroup]="form">
<div dashboard-input class="uk-form-row" [formInput]="form.get('name')" label="Title"></div>
@ -369,13 +208,30 @@
label="Icon(SVG)" type="textarea">
</div>
<div class="uk-form-row uk-flex uk-flex-middle">
<div dashboard-input class="uk-width-small" [formInput]="form.get('isPublic')"
label="Accessibility" [options]="stakeholderUtils.isPublic" type="select">
</div>
<div dashboard-input class="uk-margin-small-left uk-width-small" [formInput]="form.get('isActive')"
label="Visibility" [options]="stakeholderUtils.isActive" type="select">
<div dashboard-input class="uk-width-small" [formInput]="form.get('visibility')"
label="Visibility" [options]="stakeholderUtils.visibility" type="select">
</div>
</div>
</div>
</modal-alert>
<ng-template #visibilityOptions let-type="type" let-i="i" let-visibility="visibility" >
<span class="uk-invisible-hover uk-padding-remove" (click)="$event.stopPropagation();$event.preventDefault()">
<i [attr.uk-icon]="stakeholderUtils.isPublicIcon.get(visibility)" class="clickable"></i>
<div #element uk-dropdown="mode: click; pos: bottom-left; delay-hide: 0; flip: false">
<ul class="uk-nav uk-dropdown-nav">
<li *ngFor="let v of stakeholderUtils.visibility" [class.selectedVisibility]="v.value == visibility">
<a
*ngIf="visibility != v.value"
(click)="$event.stopPropagation();toggleStatusByIndex(i, v.value, type);hide(element);$event.preventDefault()">
<i [attr.uk-icon]="stakeholderUtils.isPublicIcon.get( v.value)"></i> {{v.label}}</a>
<a *ngIf="visibility == v.value">
<i [attr.uk-icon]="stakeholderUtils.isPublicIcon.get( v.value)"></i> {{v.label}} <icon
customClass="uk-text-secondary uk-float-right" [ratio]="0.5"
name="bullet"></icon></a>
</li>
</ul>
</div>
</span>
</ng-template>

View File

@ -2,7 +2,14 @@ import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {DomSanitizer, Title} from '@angular/platform-browser';
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {Category, Section, Stakeholder, SubCategory, Topic} from "../openaireLibrary/monitor/entities/stakeholder";
import {
Category,
Section,
Stakeholder,
SubCategory,
Topic,
Visibility
} from "../openaireLibrary/monitor/entities/stakeholder";
import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service";
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
import {AlertModal} from "../openaireLibrary/utils/modal/alert";
@ -84,7 +91,7 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
this.subCategoryIndex = 0;
// console.debug(this. stakeholder.topics[this.topicIndex])
// console.debug(this. stakeholder.topics[this.topicIndex].categories)
console.debug( this. stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subCategoryIndex])
// console.debug( this. stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subCategoryIndex])
if (this.topicIndex === -1) {
this.navigateToError();
} else {
@ -150,8 +157,7 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
this.stakeholderUtils.aliasValidator(topics)
]
),
isActive: this.fb.control(topic.isActive),
isPublic: this.fb.control(topic.isPublic),
visibility: this.fb.control(topic.visibility),
defaultId: this.fb.control(topic.defaultId),
categories: this.fb.control(topic.categories),
icon: this.fb.control(topic.icon)
@ -171,7 +177,7 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
this.index = index;
this.type = 'topic';
if (index === -1) {
this.buildTopic(new Topic(null, null, null, true, true));
this.buildTopic(new Topic(null, null, null, "PUBLIC"));
} else {
this.buildTopic(this.stakeholder.topics[index]);
}
@ -189,24 +195,15 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
}
}
public toggleTopicStatus(index=this.topicIndex) {
public toggleTopicStatus(index=this.topicIndex, visibility:Visibility) {
this.type = 'topic';
let path = [
this.stakeholder._id,
this.stakeholder.topics[index]._id
];
this.toggleStatus(this.stakeholder.topics[index], path);
}
public toggleTopicAccess(index=this.topicIndex) {
this.index = index;
this.type = 'topic';
let path = [
this.stakeholder._id,
this.stakeholder.topics[index]._id
];
this.toggleAccess(this.stakeholder.topics[index], path);
this.toggleStatus(this.stakeholder.topics[index], path, visibility);
}
public deleteTopicOpen( index=this.topicIndex, childrenAction: string = null) {
this.type = 'topic';
@ -246,8 +243,7 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
this.stakeholderUtils.aliasValidator(categories)
]
),
isActive: this.fb.control(category.isActive),
isPublic: this.fb.control(category.isPublic),
visibility: this.fb.control(category.visibility),
defaultId: this.fb.control(category.defaultId),
subCategories: this.fb.control(category.subCategories)
});
@ -266,7 +262,7 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
this.index = index;
this.type = 'category';
if (index === -1) {
this.buildCategory(new Category(null, null, null, true, true));
this.buildCategory(new Category(null, null, null, "PUBLIC"));
} else {
this.buildCategory(this.stakeholder.topics[this.topicIndex].categories[index]);
}
@ -291,7 +287,7 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
}
}
public toggleCategoryStatus(index: number) {
public toggleCategoryStatus(index: number, visibility:Visibility) {
this.index = index;
this.type = 'category';
let path = [
@ -299,19 +295,9 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
this.stakeholder.topics[this.topicIndex]._id,
this.stakeholder.topics[this.topicIndex].categories[this.index]._id
];
this.toggleStatus(this.stakeholder.topics[this.topicIndex].categories[this.index], path);
}
public toggleCategoryAccess(index: number) {
this.index = index;
this.type = 'category';
let path = [
this.stakeholder._id,
this.stakeholder.topics[this.topicIndex]._id,
this.stakeholder.topics[this.topicIndex].categories[this.index]._id
];
this.toggleAccess(this.stakeholder.topics[this.topicIndex].categories[this.index], path);
this.toggleStatus(this.stakeholder.topics[this.topicIndex].categories[this.index], path, visibility);
}
public deleteCategoryOpen(index: number, childrenAction: string = null) {
this.type = 'category';
@ -343,8 +329,7 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
this.stakeholderUtils.aliasValidator(subCategories)
]
),
isActive: this.fb.control(subCategory.isActive),
isPublic: this.fb.control(subCategory.isPublic),
visibility: this.fb.control(subCategory.visibility),
defaultId: this.fb.control(subCategory.defaultId),
charts: this.fb.control(subCategory.charts),
numbers: this.fb.control(subCategory.numbers)
@ -364,7 +349,7 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
this.index = index;
this.type = 'subcategory';
if (index === -1) {
this.buildSubcategory(new SubCategory(null, null, null, true, true));
this.buildSubcategory(new SubCategory(null, null, null, "PUBLIC"));
} else {
this.buildSubcategory(this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories[index]);
}
@ -392,8 +377,8 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
}
}
}
public toggleSubcategoryStatus(index: number) {
public toggleSubcategoryStatus(index: number, visibility:Visibility) {
this.index = index;
this.type = 'subcategory';
let path = [
@ -402,20 +387,10 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex]._id,
this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories[this.index]._id
];
this.toggleStatus(this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories[this.index], path);
this.toggleStatus(this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories[this.index], path, visibility);
}
public toggleSubcategoryAccess(index: number) {
this.index = index;
this.type = 'subcategory';
let path = [
this.stakeholder._id,
this.stakeholder.topics[this.topicIndex]._id,
this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex]._id,
this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories[this.index]._id
];
this.toggleAccess(this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories[this.index], path);
}
public deleteSubcategoryOpen(index, childrenAction: string = null) {
this.type = 'subcategory';
@ -514,30 +489,22 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
});
});
}
private toggleStatus(element: Topic | Category | SubCategory, path: string[]) {
this.stakeholderService.toggleStatus(this.properties.monitorServiceAPIURL, path).subscribe(isActive => {
element.isActive = isActive;
this.stakeholderService.setStakeholder(this.stakeholder);
UIkit.notification(StringUtils.capitalize(this.type) + ' has been successfully changed to ' + (isActive ? 'active' : 'inactive'), {
status: 'success',
timeout: 3000,
pos: 'top-left'
});
}, error => {
UIkit.notification(error.error.message, {
status: 'danger',
timeout: 3000,
pos: 'top-left'
});
});
public toggleStatusByIndex(index: number, visibility:Visibility, type) {
if(type == "sub"){
this.toggleSubcategoryStatus(index,visibility);
}else if(type == "cat"){
this.toggleCategoryStatus(index,visibility);
}
else if(type == "topic") {
this.toggleTopicStatus(index,visibility);
}
}
private toggleAccess(element: Topic | Category | SubCategory, path: string[]) {
this.stakeholderService.toggleAccess(this.properties.monitorServiceAPIURL, path).subscribe(isPublic => {
element.isPublic = isPublic;
private toggleStatus(element: Topic | Category | SubCategory, path: string[], visibility:Visibility) {
this.stakeholderService.toggleVisibility(this.properties.monitorServiceAPIURL, path, visibility).subscribe(visibility => {
element.visibility = visibility;
this.stakeholderService.setStakeholder(this.stakeholder);
UIkit.notification(StringUtils.capitalize(this.type) + ' has been successfully changed to ' + (isPublic ? 'public' : 'private'), {
UIkit.notification(StringUtils.capitalize(this.type) + ' has been successfully changed to ' + visibility.toLowerCase, {
status: 'success',
timeout: 3000,
pos: 'top-left'

View File

@ -14,11 +14,14 @@ import {AlertModalModule} from "../openaireLibrary/utils/modal/alertModal.module
import {InputModule} from "../openaireLibrary/dashboard/sharedComponents/input/input.module";
import {ClickModule} from "../openaireLibrary/utils/click/click.module";
import {AdminDashboardGuard} from "../utils/adminDashboard.guard";
import {IconsService} from "../openaireLibrary/utils/icons/icons.service";
import {preview, bullet} from "../openaireLibrary/utils/icons/icons";
import {IconsModule} from "../openaireLibrary/utils/icons/icons.module";
@NgModule({
imports: [
CommonModule, TopicRoutingModule, ClickModule, RouterModule, FormsModule, AlertModalModule,
ReactiveFormsModule, InputModule
ReactiveFormsModule, InputModule, IconsModule
],
declarations: [
TopicComponent, IndicatorsComponent
@ -32,4 +35,7 @@ import {AdminDashboardGuard} from "../utils/adminDashboard.guard";
]
})
export class TopicModule {
constructor(private iconsService: IconsService) {
this.iconsService.registerIcons([preview, bullet]);
}
}

View File

@ -1,437 +0,0 @@
import {Stakeholder, Topic, Category, SubCategory, Indicator, IndicatorPath, ChartHelper, Section} from "../../openaireLibrary/monitor/entities/stakeholder";
import {IndicatorUtils} from "../indicator-utils";
export class StakeholderCreator {
static createFunderDefaultProfile(funder:Stakeholder):Stakeholder{
// let funder:Stakeholder = new Stakeholder(null,"funder","dfid","Default Funder Profile","dfsn","default_funder",true,true, null);
funder['defaultId'] = null;
funder.topics.push(StakeholderCreator.createResearchProductionTopic(funder));
funder.topics.push(StakeholderCreator.createOSTopic(funder));
let collaboration = new Topic("Collaboration","Indexes for collaboration","collaboration", true, true);
collaboration.categories.push(this.createEmptyCategory("International collaboration","Indicators for international collaborations based on the percentage of research results or patents with at least one co-author from abroad","international-collaboration"));
collaboration.categories.push(this.createEmptyCategory("EU collaboration","Indicators for EU Collaboration based on the percentage of research results or patents with at least one co-author from another EU organization","eu-collaboration"));
collaboration.categories.push(this.createEmptyCategory("Industrial collaboration","Indicators for Industrial collaboration based on the percentage of research results or patents with at least one co-author from the industry","industrial-collaboration"));
collaboration.categories.push(this.createEmptyCategory("Transdisciplinary / transectoral collaboration","Indicators for Transdisciplinary/transectoral collaboration based on the percentage of research results or patents with at least one co-author from another discipline or sector","transdisciplinary-collaboration"));
funder.topics.push(collaboration);
funder.topics.push(StakeholderCreator.createEmptyTopic("Diffusion","Indicators based on citations, classifications and usage data: How diverse are the research knowledge resources upon which an article is drawn? How diverse are the venues in which a body of research appears? How diverse are the fields that cite a research result?","diffusion"));
let impact = new Topic("Impact", "", "impact", true, true);
impact.categories.push(this.createEmptyCategory("Academic Impact","Indicators based on citations and collaboration, related to MAG classifications.","academic-impact"));
impact.categories.push(this.createEmptyCategory("Economic Impact","Indicators based on patents and collaboration between industry and academia","economic-impact"));
impact.categories.push(this.createEmptyCategory("Societal Impact","Indicators that correlate research results with SDGs","societal-impact"));
funder.topics.push(impact);
return funder;
}
static updateECProfile(funder:Stakeholder){
//Throughput / Output
funder.topics[0].categories[0].subCategories.push(StakeholderCreator.createResearchProductionPerType(funder,"Publications", "Publication","publication", "publications",1));
funder.topics[0].categories[0].subCategories.push(StakeholderCreator.createResearchProductionPerType(funder,"Publications", "Publication","publication", "publications",2));
funder.topics[0].categories[1].subCategories.push(StakeholderCreator.createResearchProductionPerType(funder,"Research data", "Research data","dataset", "datasets",1));
funder.topics[0].categories[1].subCategories.push(StakeholderCreator.createResearchProductionPerType(funder,"Research data", "Research data","dataset", "datasets",2));
funder.topics[0].categories[2].subCategories.push(StakeholderCreator.createResearchProductionPerType(funder,"Software", "Software","software", "software",1));
funder.topics[0].categories[2].subCategories.push(StakeholderCreator.createResearchProductionPerType(funder,"Software", "Software","software", "software",2));
funder.topics[0].categories[3].subCategories.push(StakeholderCreator.createResearchProductionPerType(funder,"Other research products", "Other research product","other", "other",1));
funder.topics[0].categories[3].subCategories.push(StakeholderCreator.createResearchProductionPerType(funder,"Other research products", "Other research product","other", "other",2));
funder.topics[1].categories[0].subCategories[0].charts.push(new Section("chart","FP7 Section" ));
funder.topics[1].categories[0].subCategories[0].charts[1].indicators = this.createOAPerType(funder,"Publications","Publication","publication","publications", 1 );
funder.topics[1].categories[0].subCategories[0].charts.push(new Section("chart","H2020" ));
funder.topics[1].categories[0].subCategories[0].charts[2].indicators = this.createOAPerType(funder,"Publications","Publication","publication","publications", 2 );
funder.topics[1].categories[0].subCategories[1].charts.push(new Section("chart","FP7 Section" ));
funder.topics[1].categories[0].subCategories[1].charts[1].indicators = this.createOAPerType(funder,"Research data", "Research data","dataset", "datasets", 1 );
funder.topics[1].categories[0].subCategories[1].charts.push(new Section("chart","H2020" ));
funder.topics[1].categories[0].subCategories[1].charts[2].indicators = this.createOAPerType(funder,"Research data", "Research data","dataset", "datasets", 2 );
funder.topics[1].categories[0].subCategories[2].charts.push(new Section("chart","FP7 Section" ));
funder.topics[1].categories[0].subCategories[2].charts[1].indicators = this.createOAPerType(funder,"Software", "Software","software", "software", 1 );
funder.topics[1].categories[0].subCategories[2].charts.push(new Section("chart","H2020" ));
funder.topics[1].categories[0].subCategories[2].charts[2].indicators = this.createOAPerType(funder,"Software", "Software","software", "software", 2 );
funder.topics[1].categories[0].subCategories[3].charts.push(new Section("chart","FP7 Section" ));
funder.topics[1].categories[0].subCategories[3].charts[1].indicators = this.createOAPerType(funder,"Other research products", "Other research product","other", "other", 1 );
funder.topics[1].categories[0].subCategories[3].charts.push(new Section("chart","H2020" ));
funder.topics[1].categories[0].subCategories[3].charts[2].indicators = this.createOAPerType(funder,"Other research products", "Other research product","other", "other", 2 );
return funder;
}
static createEmptyTopic(name: string, description: string, alias: string):Topic{
let topic = new Topic(name, description, alias, true, true);
topic.categories.push(this.createEmptyCategory("Overview","","overview"));
return topic;
}
static createEmptyCategory(name: string, description: string, alias: string):Category{
let cat:Category = new Category(name, description, alias,true,true);
cat.subCategories.push(new SubCategory("Overview","","overview",true,true));
return cat;
}
static createResearchProductionTopic(stakeholder:Stakeholder):Topic {
let topic = new Topic("Throughput / Output", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...", "research-production", true, true);
let pubCategory:Category = new Category("Publications","","publications",true,true);
topic.categories.push(pubCategory);
// let pubDefSub = StakeholderCreator.createResearchProductionPerType(stakeholder,"Publications", "Publication","publication", "publications");
pubCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Publications", "Publication","publication", "publications",0));
// pubCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Publications", "Publication","publication", "publications",1));
// pubCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Publications", "Publication","publication", "publications",2));
let dataCategory:Category = new Category("Research data","","data",true,true);
topic.categories.push(dataCategory);
dataCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Research data", "Research data","dataset", "datasets",0));
// dataCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Research data", "Research data","dataset", "datasets",1));
// dataCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Research data", "Research data","dataset", "datasets",2));
let softwareCategory:Category = new Category("Software","","software",true,true);
topic.categories.push(softwareCategory);
softwareCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Software", "Software","software", "software",0));
// softwareCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Software", "Software","software", "software",1));
// softwareCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Software", "Software","software", "software",2));
let otherCategory:Category = new Category("Other research products","","other",true,true);
topic.categories.push(otherCategory);
otherCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Other research products", "Other research product","other", "other",0));
// otherCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Other research products", "Other research product","other", "other",1));
// otherCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Other research products", "Other research product","other", "other",2));
return topic;
}
static createResearchProductionPerType(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural, index:number):SubCategory{
let fundingFilter = ['',',{"groupFilters":[{"field":"' + dbType + '.project.funding level 0","type":"=","values":["FP7"]}],"op":"AND"}',
',{"groupFilters":[{"field":"' + dbType + '.project.funding level 0","type":"=","values":["H2020"]}],"op":"AND"}'];
let categoryTitle=["Overview","FP7","H2020"];
let chartTitle=["","FP7 ","H2020 "];
let pubDefSub = new SubCategory(categoryTitle[index], null,categoryTitle[index].toLowerCase(),true, true);
if(index!=0){
pubDefSub.recommendedFor.push("ec__________::EC");
}
if(index==0) {
pubDefSub.numbers.push(new Section("number", null, null, stakeholder.alias));
let n_total = new Indicator("Total " + typePlural, null, "number", "small", true, true, [new IndicatorPath(null, "search",
"/" + dbTypePlural + "/count?fq=" + (encodeURIComponent("relfunderid exact index_id")) + "&format=json", null, ["total"])]);
n_total.indicatorPaths[0].filters["fundingL0"] = "&fq=relfundinglevel0_name exact " + ChartHelper.prefix + 'fundingL0' + ChartHelper.suffix;
pubDefSub.numbers[0].indicators.push(n_total);
}
if( dbType != "publication" && index == 0) {
let n_linkedPubs = this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Publications","publication");
// new Indicator("Linked with Publications", null, "number", "small", true, true, [new IndicatorPath(null, "search",
// "/resources?query="+encodeURIComponent(" ( (oaftype exact result) and (resulttypeid exact " + dbTypePlural + ") and (relresulttype=publication) )")+"&fq=" + (encodeURIComponent("relfunderid exact index_id")) + "&page=0&size=0&format=json", null, ["meta","total"])]);
pubDefSub.numbers[0].indicators.push(n_linkedPubs);
}
pubDefSub.charts.push(new Section("chart", null, null, stakeholder.alias));
let res_timeline = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("column", "stats-tool", "chart?json=", '{"library":"HighCharts","chartDescription":{"queries":[{"name":"'+typePlural+'","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","query":{"select":[{"field":"'+dbType+'","aggregate":"count"},{"field":"'+dbType+'.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"'+dbType+'.project.funder","type":"=","values":["'+ChartHelper.prefix+'index_name'+ChartHelper.suffix+'"]}],"op":"AND"},{"groupFilters":[{"field":"'+dbType+'.year","type":">=","values":["'+ChartHelper.prefix+'start_year'+ChartHelper.suffix+'"]},{"field":"'+dbType+'.year","type":"<=","values":["'+ChartHelper.prefix+'end_year'+ChartHelper.suffix+'"]}],"op":"AND"}'+fundingFilter[index]+'],"entity":"'+dbType+'","profile":"OpenAIRE All-inclusive","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+ChartHelper.prefix+'title'+ChartHelper.suffix+'"},"subtitle":{},"yAxis":{"title":{"text":"'+typePlural+'"}},"xAxis":{"title":{"text":"Year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
res_timeline.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,chartTitle[index] + typePlural+" timeline","column");
res_timeline.indicatorPaths[0].parameters["start_year"] = (index == 1?"2014":"2008");
res_timeline.indicatorPaths[0].parameters["end_year"] = "2020";
pubDefSub.charts[0].indicators.push(res_timeline);
if(dbType == "publication" || dbType == "dataset") {
let res_types = new Indicator("", null, "chart", "small", true, true,
[new IndicatorPath("column", "stats-tool", "chart?json=",
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"select":[{"field":"' + dbType + '","aggregate":"count"},{"field":"' + dbType + '.classification","aggregate":null}],"filters":[{"groupFilters":[{"field":"' + dbType + '.project.funder","type":"=","values":["' + ChartHelper.prefix + 'index_name' + ChartHelper.suffix + '"]}],"op":"AND"}'+fundingFilter[index]+'],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Type"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
res_types.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, chartTitle[index] + typeSingl + " types", "bar");
pubDefSub.charts[0].indicators.push(res_types);
}
let res_access_mode = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("pie", "stats-tool", "chart?json=",
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"'+typePlural+'","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","query":{"select":[{"field":"'+dbType+'","aggregate":"count"},{"field":"'+dbType+'.access mode","aggregate":null}],"filters":[{"groupFilters":[{"field":"'+dbType+'.project.funder","type":"=","values":["'+ChartHelper.prefix+'index_name'+ChartHelper.suffix+'"]}],"op":"AND"}'+fundingFilter[index]+'],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+ChartHelper.prefix+'title'+ChartHelper.suffix+'"},"subtitle":{},"yAxis":{"title":{"text":"'+typePlural+'"}},"xAxis":{"title":{"text":"Year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":true}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
res_access_mode.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,chartTitle[index] + typeSingl+" access mode","pie");
pubDefSub.charts[0].indicators.push(res_access_mode);
/* let res_sci_area = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"select":[{"field":"' + dbType + '","aggregate":"count"},{"field":"' + dbType + '.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"' + dbType + '.project.funder","type":"=","values":["' + ChartHelper.prefix + 'index_name' + ChartHelper.suffix + '"]}],"op":"AND"}'+fundingFilter[index]+'],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Scientific area"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
res_sci_area.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, chartTitle[index] + typeSingl + " scientific area", "bar");
res_sci_area.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType);
res_sci_area.recommendedFor = ["ec__________::EC"];
pubDefSub.charts[0].indicators.push(res_sci_area);
let res_programmes = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"select":[{"field":"' + dbType + '","aggregate":"count"},{"field":"' + dbType + '.project.funding level 2","aggregate":null}],"filters":[{"groupFilters":[{"field":"' + dbType + '.project.funder","type":"=","values":["' + ChartHelper.prefix + 'index_name' + ChartHelper.suffix + '"]}],"op":"AND"},{"groupFilters":[{"field":"' + dbType + '.project.funding level 2","type":"!=","values":[" "]}],"op":"AND"}'+fundingFilter[index]+'],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Programmes"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
res_programmes.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, chartTitle[index] + typeSingl + " programmes", "bar");
res_programmes.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType);
res_programmes.recommendedFor = ["ec__________::EC"];
pubDefSub.charts[0].indicators.push(res_programmes);*/
//{"library":"HighCharts","chartDescription":{"queries":[{"name":"Research Data","type":"bar","query":{"select":[{"field":"dataset","aggregate":"count"},{"field":"dataset.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"dataset.project.funder","type":"=","values":["European Commission"]}],"op":"AND"}],"entity":"dataset","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Scientific Area"},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}
let datasource = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("bar", "stats-tool", "chart?json=",
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"'+typePlural+'","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","query":{"name":"monitor.'+ChartHelper.prefix+'index_shortName'+ChartHelper.suffix+(index==2?".h2020":(index==1?".fp7":""))+'.'+dbTypePlural+'.datasources"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+ChartHelper.prefix+'title'+ChartHelper.suffix+'"},"subtitle":{},"yAxis":{"title":{"text":"'+typePlural+'"}},"xAxis":{"title":{"text":"Content provider"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
datasource.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,chartTitle[index] + typeSingl+" content provider","bar");
datasource.indicatorPaths[0].parameters["index_shortName"] = stakeholder.index_shortName.toLowerCase();
pubDefSub.charts[0].indicators.push(datasource);
if(dbType == "publication") {
let journal = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"name":"monitor.' + ChartHelper.prefix + 'index_shortName' + ChartHelper.suffix +(index==2?".h2020":(index==1?".fp7":""))+ '.' + dbTypePlural + '.journals"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Journal"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
journal.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, chartTitle[index] + typeSingl + " journal", "bar");
journal.indicatorPaths[0].parameters["index_shortName"] = stakeholder.index_shortName.toLowerCase();
pubDefSub.charts[0].indicators.push(journal);
let repo = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"name":"monitor.' + ChartHelper.prefix + 'index_shortName' + ChartHelper.suffix +(index==2?".h2020":(index==1?".fp7":""))+ '.' + dbTypePlural + '.repositories"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Repositories"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
repo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, chartTitle[index] + typeSingl + " repositories", "bar");
repo.indicatorPaths[0].parameters["index_shortName"] = stakeholder.index_shortName.toLowerCase();
pubDefSub.charts[0].indicators.push(repo);
}
if(dbType == "dataset") {
let repo = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"name":"monitor.' + ChartHelper.prefix + 'index_shortName' + ChartHelper.suffix + (index==2?".h2020":(index==1?".fp7":""))+'.' + dbTypePlural + '.drepositories"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Data Repositories"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
repo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, chartTitle[index] + typeSingl + " repositories", "bar");
repo.indicatorPaths[0].parameters["index_shortName"] = stakeholder.index_shortName.toLowerCase();
pubDefSub.charts[0].indicators.push(repo);
let irepo = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"name":"monitor.' + ChartHelper.prefix + 'index_shortName' + ChartHelper.suffix +(index==2?".h2020":(index==1?".fp7":""))+ '.' + dbTypePlural + '.irepositories"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Institutional repositories"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
irepo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, chartTitle[index] + typeSingl + " institutional repositories", "bar");
irepo.indicatorPaths[0].parameters["index_shortName"] = stakeholder.index_shortName.toLowerCase();
pubDefSub.charts[0].indicators.push(irepo);
}
if(index ==0) {
let pid = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("pie", "stats-tool", "chart?json=",
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"name":"monitor.' + ChartHelper.prefix + 'index_shortName' + ChartHelper.suffix + '.' + dbTypePlural + '.pidtypes"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":true}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]);
pid.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " PIDs", "pie");
pid.indicatorPaths[0].parameters["index_shortName"] = stakeholder.index_shortName.toLowerCase();
pubDefSub.charts[0].indicators.push(pid);
}
return pubDefSub;
}
/* static createOASub(){
let subCategories:SubCategory[] = [];
let overviewSub = new SubCategory("Overview", null,"overview",true, true);
subCategories.push(overviewSub);
let byScientificAreaSub = new SubCategory("By Scientific Area", null,"scientific-area",true, true);
subCategories.push(byScientificAreaSub);
let byProgramSub = new SubCategory("By Programme", null,"programme",true, true);
subCategories.push(byProgramSub);
return subCategories;
}*/
static createOpenAccessTopic(stakeholder:Stakeholder):Category {
let category = new Category("Open Access", "", "open-access", true, true);
category.subCategories.push(this.createOASub(stakeholder,"Publications","Publication","publication","publications"));
category.subCategories.push(this.createOASub(stakeholder,"Research data","Research data","dataset","datasets"));
category.subCategories.push(this.createOASub(stakeholder,"Software","Software","software","software"));
category.subCategories.push(this.createOASub(stakeholder,"Other research products","Other research product","other","other"));
return category;
}
static createOASub(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory {
let sub:SubCategory = new SubCategory(typePlural, null, dbTypePlural, true, true);
sub.charts.push(new Section("chart", null, null, stakeholder.alias));
sub.charts[0].indicators = sub.charts[0].indicators.concat( this.createOAPerType(stakeholder,typePlural, typeSingl, dbType, dbTypePlural, 0 ));
// sub.charts[0].indicators = sub.charts[0].indicators.concat( this.createOAPerType(stakeholder,typePlural, typeSingl, dbType, dbTypePlural, 1 ));
// sub.charts[0].indicators = sub.charts[0].indicators.concat( this.createOAPerType(stakeholder,typePlural, typeSingl, dbType, dbTypePlural, 2 ));
return sub;
}
static createOAPerType(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural, index:number):Indicator[] {
//default pallette: "colors":["#2f7ed8","#0d233a","#8bbc21","#910000","#1aadce","#492970","#f28f43","#77a1e5","#c42525","#a6c96a"]
let greenAndGoldPalette = ', "colors":["#239D60","#F8B500"]';
let fundingFilter = ['', '{"groupFilters":[{"field":"' + dbType + '.project.funding level 0","type":"=","values":["FP7"]}],"op":"AND"}',
'{"groupFilters":[{"field":"' + dbType + '.project.funding level 0","type":"=","values":["H2020"]}],"op":"AND"}'];
let fieldValue = ["", "FP7", "H2020"];
let chartTitle = ["", "FP7 ", "H2020 "];
let indicators:Indicator[]=[];
let utils = new IndicatorUtils();
let open_non_url = "http://88.197.53.71:8080/stats-api/chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Data","type":"pie","color":"#e62020ee","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix +(index==2?".h2020":(index==1?".fp7":""))+ '.' + dbTypePlural+'.oavsnonoa"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+chartTitle[index]+' Open Access vs Non Open Access"},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":true}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Data","type":"pie","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix +(index==2?".h2020":(index==1?".fp7":""))+ '.' + dbTypePlural+'.greenvsgold"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":true}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
let open_non_ind:Indicator = new Indicator("", "", "chart", "small", true, true, [utils.generateIndicatorByChartUrl("stats-tool", open_non_url, "pie",stakeholder)])
open_non_ind.indicatorPaths[0].parameters["index_id"] = stakeholder.index_shortName.toLowerCase();
if(index!=0){
open_non_ind.recommendedFor.push("ec__________::EC");
}
indicators.push(open_non_ind);
if(dbType == "publication") {
let gold_vs_green_url = "http://88.197.53.71:8080/stats-api/chart?json=" + encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Data","type":"column","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + (index == 2 ? ".h2020" : (index == 1 ? ".fp7" : "")) + '.' + dbTypePlural + '.greenvsgold"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + chartTitle[index] + ' Green vs Gold"},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
let gold_vs_green_ind: Indicator = (new Indicator("", "", "chart", "small", true, true, [utils.generateIndicatorByChartUrl("stats-tool", gold_vs_green_url, "pie",stakeholder)]));
gold_vs_green_ind.indicatorPaths[0].parameters["index_id"] = stakeholder.index_shortName.toLowerCase();
if (index != 0) {
gold_vs_green_ind.recommendedFor.push("ec__________::EC");
}
indicators.push(gold_vs_green_ind);
let gold_vs_green_time_url = "http://88.197.53.71:8080/stats-api/chart?json=" + encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Green OA","type":"column","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + (index == 2 ? ".h2020" : (index == 1 ? ".fp7" : "")) + '.' + dbTypePlural + '.green.year"}},{"name":"Gold OA","type":"column","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + (index == 2 ? ".h2020" : (index == 1 ? ".fp7" : "")) + '.' + dbTypePlural + '.gold.year"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + chartTitle[index] + ' Green vs Gold Open Access"},"subtitle":{"text":"by year"},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}'+greenAndGoldPalette+'}}');
let gold_vs_green_time_ind: Indicator = (new Indicator("", "", "chart", "small", true, true, [utils.generateIndicatorByChartUrl("stats-tool", gold_vs_green_time_url, "column",stakeholder)]));
gold_vs_green_time_ind.indicatorPaths[0].parameters["index_id"] = stakeholder.index_shortName.toLowerCase();
if (index != 0) {
gold_vs_green_time_ind.recommendedFor.push("ec__________::EC");
}
indicators.push(gold_vs_green_time_ind);
}
let top_project_url = "http://88.197.53.71:8080/stats-api/chart?json="+ encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Data","type":"bar","query":{"name":"monitor.'+ ChartHelper.prefix + 'id' + ChartHelper.suffix +(index==2?".h2020":(index==1?".fp7":""))+ '.' + dbTypePlural+'.top10projects"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + chartTitle[index] + 'Top 10 projects"},"subtitle":{"text":"by '+typePlural+'"},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
let top_project_ind:Indicator = (new Indicator("", "", "chart", "medium", true, true, [utils.generateIndicatorByChartUrl("stats-tool", top_project_url, "column",stakeholder)]));
top_project_ind.indicatorPaths[0].parameters["index_id"] = stakeholder.index_shortName.toLowerCase();
if(index!=0){
top_project_ind.recommendedFor.push("ec__________::EC");
}
indicators.push(top_project_ind);
if(index == 0) {
let top_datasources_url = "http://88.197.53.71:8080/stats-api/chart?json=" + encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Data","type":"bar","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + '.' + dbTypePlural + '.top10datasources"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + chartTitle[index] + 'Top 10 Datasources"},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
let top_datasources_ind: Indicator = (new Indicator("", "", "chart", "medium", true, true, [utils.generateIndicatorByChartUrl("stats-tool", top_datasources_url, "column",stakeholder)]));
top_datasources_ind.indicatorPaths[0].parameters["index_id"] = stakeholder.index_shortName.toLowerCase();
indicators.push(top_datasources_ind);
}
if(index != 0) {
let open_non_fl2 = "http://88.197.53.71:8080/stats-api/chart?json=" + encodeURIComponent(
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"Open Access","type":"bar","query":{"select":[{"field":"' + dbType + '","aggregate":"count"},{"field":"' + dbType + '.project.funding level 2","aggregate":null}],"filters":['+fundingFilter[index]+',{"groupFilters":[{"field":"' + dbType + '.access mode","type":"=","values":["Open Access"]}],"op":"AND"}],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"30"}},{"name":"Non Open Access","type":"bar","query":{"select":[{"field":"' + dbType + '","aggregate":"count"},{"field":"' + dbType + '.project.funding level 2","aggregate":null}],"filters":[{"groupFilters":[{"field":"' + dbType + '.access mode","type":"!=","values":["Open Access"]}],"op":"AND"}'+(fundingFilter[index].length >0?', ':'')+fundingFilter[index]+'],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + chartTitle[index] + 'Open Access vs Non Open Access"},"subtitle":{"text":"By Scientific area"},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
let open_non_fl2_ind: Indicator = (new Indicator("", "", "chart", "medium", true, true, [utils.generateIndicatorByChartUrl("stats-tool", open_non_fl2, "column",stakeholder)]));
indicators.push(open_non_fl2_ind);
if (index != 0) {
open_non_fl2_ind.recommendedFor.push("ec__________::EC");
}
if(dbType == "publication") {
let gold_green__fl2 = "http://88.197.53.71:8080/stats-api/chart?json=" + encodeURIComponent(
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"Green OA","type":"bar","query":{"select":[{"field":"' + dbType + '","aggregate":"count"},{"field":"' + dbType + '.project.funding level 2","aggregate":null}],"filters":[{"groupFilters":[{"field":"' + dbType + '.project.funding level 0","type":"=","values":["' + fieldValue[index] + '"]}],"op":"AND"},{"groupFilters":[{"field":"' + dbType + '.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"' + dbType + '.datasource.type","type":"contains","values":["repo"]}],"op":"AND"}],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"30"}},{"name":"Gold OA","type":"bar","query":{"select":[{"field":"' + dbType + '","aggregate":"count"},{"field":"' + dbType + '.project.funding level 2","aggregate":null}],"filters":[{"groupFilters":[{"field":"' + dbType + '.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"' + dbType + '.project.funding level 0","type":"=","values":["' + fieldValue[index] + '"]}],"op":"AND"},{"groupFilters":[{"field":"' + dbType + '.datasource.id","type":"starts_with","values":["doaj"]}],"op":"AND"}],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + chartTitle[index] + 'Green vs Gold Open Access"},"subtitle":{"text":"By Scientific area"},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}'+greenAndGoldPalette+'}}');
let gold_green_ind_fl2: Indicator = (new Indicator("", "", "chart", "medium", true, true, [utils.generateIndicatorByChartUrl("stats-tool", gold_green__fl2, "column",stakeholder)]));
indicators.push(gold_green_ind_fl2);
if (index != 0) {
gold_green_ind_fl2.recommendedFor.push("ec__________::EC");
}
}
let open_non_fl1 = "http://88.197.53.71:8080/stats-api/chart?json=" + encodeURIComponent(
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"Open Access","type":"bar","query":{"select":[{"field":"' + dbType + '","aggregate":"count"},{"field":"' + dbType + '.project.funding level 1","aggregate":null}],"filters":['+fundingFilter[index]+',{"groupFilters":[{"field":"' + dbType + '.access mode","type":"=","values":["Open Access"]}],"op":"AND"}],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"30"}},{"name":"Non Open Access","type":"bar","query":{"select":[{"field":"' + dbType + '","aggregate":"count"},{"field":"' + dbType + '.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"' + dbType + '.access mode","type":"!=","values":["Open Access"]}],"op":"AND"}'+(fundingFilter[index].length >0?', ':'')+fundingFilter[index]+'],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + chartTitle[index] + 'Open Access vs Non Open Access"},"subtitle":{"text":"By Programme"},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
let open_non_fl1_ind: Indicator = (new Indicator("", "", "chart", "medium", true, true, [utils.generateIndicatorByChartUrl("stats-tool", open_non_fl1, "column",stakeholder)]));
indicators.push(open_non_fl1_ind);
if (index != 0) {
open_non_fl1_ind.recommendedFor.push("ec__________::EC");
}
if(dbType == "publication") {
let gold_green__fl1 = "http://88.197.53.71:8080/stats-api/chart?json=" + encodeURIComponent(
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"Green OA","type":"bar","query":{"select":[{"field":"' + dbType + '","aggregate":"count"},{"field":"' + dbType + '.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"' + dbType + '.project.funding level 0","type":"=","values":["' + fieldValue[index] + '"]}],"op":"AND"},{"groupFilters":[{"field":"' + dbType + '.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"' + dbType + '.datasource.type","type":"contains","values":["repo"]}],"op":"AND"}],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"30"}},{"name":"Gold OA","type":"bar","query":{"select":[{"field":"' + dbType + '","aggregate":"count"},{"field":"' + dbType + '.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"' + dbType + '.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"' + dbType + '.project.funding level 0","type":"=","values":["' + fieldValue[index] + '"]}],"op":"AND"},{"groupFilters":[{"field":"' + dbType + '.datasource.id","type":"starts_with","values":["doaj"]}],"op":"AND"}],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + chartTitle[index] + 'Green vs Gold Open Access"},"subtitle":{"text":"By Programme"},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}'+greenAndGoldPalette+'}}');
let gold_green_ind_fl1: Indicator = (new Indicator("", "", "chart", "medium", true, true, [utils.generateIndicatorByChartUrl("stats-tool", gold_green__fl1, "column",stakeholder)]));
// open_non_fl2_ind.indicatorPaths[0].parameters["index_id"] = stakeholder.index_shortName.toLowerCase();
indicators.push(gold_green_ind_fl1);
if (index != 0) {
gold_green_ind_fl1.recommendedFor.push("ec__________::EC");
}
}
}
return indicators;
}
static createOSTopic(stakeholder:Stakeholder):Topic{
let topic = new Topic("Open Science","","open-science",true,true);
topic.categories.push(this.createOpenAccessTopic(stakeholder));
let linked:Category = new Category("Fair / Linked","Indicators based on FAIR data maturity model will soon be included","linked",true,true);
topic.categories.push(linked);
linked.subCategories.push(this.createOSOverviewPerType(stakeholder,"Publications","Publication","publication","publications"));
linked.subCategories.push(this.createOSOverviewPerType(stakeholder,"Research data","Research data","dataset","datasets"));
linked.subCategories.push(this.createOSOverviewPerType(stakeholder,"Software","Software","software","software"));
linked.subCategories.push(this.createOSOverviewPerType(stakeholder,"Other research products","Other research product","other","other"));
let openInfra:Category = new Category("Open Infrastructures","Indicators based on the use of services for generating, producing and publishing research","open-infrastructures",true,true);
openInfra.subCategories.push(new SubCategory("Overview","","overview",true,true));
topic.categories.push(openInfra);
return topic;
}
static createOSOverviewPerType(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory {
let pubDefSub = new SubCategory(typePlural, null, dbTypePlural, true, true);
pubDefSub.numbers.push(new Section("number", null, null, stakeholder.alias));
if( dbType != "publication") {
pubDefSub.numbers[0].indicators.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Publications","publication"));
}
if( dbType != "dataset") {
pubDefSub.numbers[0].indicators.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Research data","dataset"));
}
if( dbType != "software") {
pubDefSub.numbers[0].indicators.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Software","software"));
}
if( dbType != "other") {
pubDefSub.numbers[0].indicators.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Other Research products","other"));
}
return pubDefSub;
}
static createLinkToIndicator(stakeholder:Stakeholder,typePlural, typeSingl, dbType, linkedToName,linkedToType ):Indicator {
let n_linkedPubs = new Indicator(typePlural+" linked to "+linkedToName, null, "number", "small", true, true, [new IndicatorPath(null, "search",
"/resources?query=" + encodeURIComponent(" ( (oaftype exact result) and (resulttypeid exact " + dbType + ") and (relresulttype="+linkedToType+") )") + "&fq=" + (encodeURIComponent("relfunderid exact index_id")) + "&page=0&size=0&format=json", null, ["meta", "total"])]);
n_linkedPubs.indicatorPaths[0].filters["fundingL0"] = "&fq=relfundinglevel0_name exact "+ChartHelper.prefix+'fundingL0'+ChartHelper.suffix;
/*
filters.set("start_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":">=","values":["'+ChartHelper.prefix+'start_year'+ChartHelper.suffix+'"]}],"op":"AND"}');
filters.set("end_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":"<=","values":["'+ChartHelper.prefix+'end_year'+ChartHelper.suffix+'"]}],"op":"AND"}');
*/
return n_linkedPubs;
}
static createFundingImpactTopic():Topic{
let topic = new Topic("Impact/Correlation","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","impact",true,true);
let pubCategory:Category = new Category("Publications","","publications",true,true);
topic.categories.push(pubCategory);
let pubDefSub = new SubCategory(null, null,null,true, true);
pubCategory.subCategories.push(pubDefSub);
let dataCategory:Category = new Category("Research data","","data",true,true);
topic.categories.push(dataCategory);
let dataDefSub = new SubCategory(null, null,null,true, true);
dataCategory.subCategories.push(dataDefSub);
let softwareCategory:Category = new Category("Software","","software",true,true);
topic.categories.push(softwareCategory);
let softDefSub = new SubCategory(null, null,null,true, true);
softwareCategory.subCategories.push(softDefSub);
/* let otherCategory:Category = new Category("Other research products","","other",true,true);
topic.categories.push(otherCategory);
let otherDefSub = new SubCategory(null, null,null,true, true);
otherCategory.subCategories.push(otherDefSub);*/
return topic;
}
createCollaborationTopic():Topic{
let topic = new Topic("Demo Topic","This is a demo topic","demo-topic",true,true);
let category1:Category = new Category("Category 1","This is ","cat-1",true,true);
topic.categories.push(category1);
let subCat1 = new SubCategory("Sub-category 1","","sub-cat-1",true,true);
category1.subCategories.push(subCat1);
let subCat2 = new SubCategory("Sub-category 2","","sub-cat-2",true,true);
category1.subCategories.push(subCat2);
let category2:Category = new Category("Category 2 - no subcategories","","cat-2",true,true);
topic.categories.push(category2);
let defSub = new SubCategory(null, null,null,true, true);
//defSub.charts.push(new Section("chart", null, null, stakeholder.alias));
category2.subCategories.push(defSub);
let chart1 = new Indicator(
"Chart title goes here","Chart description goes here", "chart","medium",true, true,
[new IndicatorPath("other", "image","https://visme.co/blog/wp-content/uploads/2017/03/Dogs-vs-Cats-How-much-they-miss-you-relative-to-the-time-you-are-gone.png", null, null)]);
let chart2 = new Indicator("Chart title goes here","Chart description goes here", "chart","medium",true, true, [new IndicatorPath("other", "image","https://static.boredpanda.com/blog/wp-content/uuuploads/funny-graphs-2/funny-graphs-legs.jpg", null, null)]);
subCat1.charts[0].indicators.push(chart1);
subCat2.charts[0].indicators.push(chart2);
defSub.charts[0].indicators.push(chart1);
defSub.charts[0].indicators.push(chart2);
return topic;
}
}

View File

@ -5,7 +5,7 @@ import {
SourceType,
Stakeholder,
SubCategory,
Topic
Topic, Visibility
} from "../openaireLibrary/monitor/entities/stakeholder";
import {AbstractControl, ValidatorFn, Validators} from "@angular/forms";
import {Option} from "../openaireLibrary/dashboard/sharedComponents/input/input.component";
@ -24,9 +24,10 @@ export class StakeholderUtils {
{value: 'organization', label: 'Organization'}
];
isPublic: Option[] = [
{icon: 'public', value: true, label: 'Public'},
{icon: 'lock', value: false, label: 'Private'},
visibility: Option[] = [
{icon: 'world', value: "PUBLIC", label: 'Public'},
{icon: 'lock', value: "RESTRICTED", label: 'Restricted'},
{icon: 'users', value: "PRIVATE", label: 'Private'},
];
isActive: Option[] = [
@ -34,9 +35,10 @@ export class StakeholderUtils {
{icon: 'brightness_1', value: false, label: 'Inactive'},
];
isPublicIcon: Map<boolean, string> = new Map([
[true, 'public'],
[false, 'lock']
isPublicIcon: Map<Visibility, string> = new Map<Visibility, string> ([
["PUBLIC", 'world'],
["PRIVATE", 'lock'],
["RESTRICTED", 'users']
]);
isActiveIcon: string = 'brightness_1';
@ -505,7 +507,7 @@ export class IndicatorUtils {
}
generateIndicatorByForm(form: any, indicatorPaths: IndicatorPath[], type:IndicatorType, addParameters:boolean = true ): Indicator {
let indicator: Indicator = new Indicator(form.name, form.description, type,
form.width, form.isActive, form.isPublic, indicatorPaths, form.defaultId);
form.width, form.visibility, indicatorPaths, form.defaultId);
indicator._id = form._id;
form.indicatorPaths.forEach((indicatorPath, index) => {
indicator.indicatorPaths[index].type = indicatorPath.type;

View File

@ -18,8 +18,8 @@ export class StatisticsService {
this.numberSources.set('statistics', [properties.statisticsAPIURL]);
this.numberSources.set('search', [properties.searchAPIURLLAst]);
this.numberSources.set('metrics', [properties.metricsAPIURL]);
this.numberSources.set('stats-tool', [properties.statisticsFrameNewAPIURL, "http://marilyn.athenarc.gr:8080/stats-api/", "http://88.197.53.71:8080/stats-api/", "https://stats.madgik.di.uoa.gr/stats-api/"]);
this.chartSources.set('stats-tool', [properties.statisticsFrameNewAPIURL, "http://marilyn.athenarc.gr:8080/stats-api/", "http://88.197.53.71:8080/stats-api/", "https://stats.madgik.di.uoa.gr/stats-api/"]);
this.numberSources.set('stats-tool', [properties.statisticsFrameNewAPIURL, "http://marilyn.athenarc.gr:8080/stats-api/", "http://88.197.53.71:8080/stats-api/", "https://stats.madgik.di.uoa.gr/stats-api/","https://beta.services.openaire.eu/stats-tool/","https://services.openaire.eu/stats-tool/"]);
this.chartSources.set('stats-tool', [properties.statisticsFrameNewAPIURL, "http://marilyn.athenarc.gr:8080/stats-api/", "http://88.197.53.71:8080/stats-api/", "https://stats.madgik.di.uoa.gr/stats-api/","https://beta.services.openaire.eu/stats-tool/","https://services.openaire.eu/stats-tool/"]);
this.chartSources.set('old', [properties.statisticsFrameAPIURL]);
this.chartSources.set('metrics', [properties.metricsAPIURL]);
this.chartSources.set('image', [""]);

View File

@ -264,3 +264,26 @@
margin-top: 30px;
height: 250px;
}
li.selectedVisibility::before a, li.selectedVisibility a::before, li.selectedVisibility::after a, li.selectedVisibility a, .selectedVisibility{
background-color:var(--secondary-color);
background:blue;
opacity: 0.5;
}
li.selectedVisibility{
position: relative;
}
li.selectedVisibility::before {
content: "";
width: 100%;
height: 100%;
position: absolute;
left: 0;
background-color: var(--secondary-color);
opacity: 0.3;
}
.uk-modal .large-modal {
width: 800px;
}

View File

@ -4860,7 +4860,7 @@ address p + p {
transition: opacity 400ms;
z-index: -1;
}
#page_content_inner {
#page_content_inner, openaire-user #tm-main {
padding: 24px 24px 100px;
}
#page_overflow {

View File

@ -11,7 +11,7 @@ export let properties: EnvProperties = {
framesAPIURL: "https://beta.openaire.eu/stats3/",
statisticsAPIURL: "https://beta.services.openaire.eu/stats-api/",
statisticsFrameAPIURL: "https://beta.openaire.eu/stats/",
statisticsFrameNewAPIURL: "https://stats.madgik.di.uoa.gr/stats-api/",
statisticsFrameNewAPIURL: "https://beta.services.openaire.eu/stats-tool/",
useNewStatistisTool: true,
claimsAPIURL: "https://beta.services.openaire.eu/claims/rest/claimsService/",
searchAPIURLLAst: "https://beta.services.openaire.eu/search/v2/api/",

View File

@ -16,7 +16,7 @@ export let properties: EnvProperties = {
framesAPIURL: "https://beta.openaire.eu/stats3/",
statisticsAPIURL: "https://beta.services.openaire.eu/stats-api/",
statisticsFrameAPIURL: "https://beta.openaire.eu/stats/",
statisticsFrameNewAPIURL: "http://88.197.53.71:8080/stats-api/",
statisticsFrameNewAPIURL: "https://beta.services.openaire.eu/stats-tool/",
useNewStatistisTool: false,
claimsAPIURL: "http://scoobydoo.di.uoa.gr:8080/dnet-claims-service-2.0.0-SNAPSHOT/rest/claimsService/",
searchAPIURLLAst: "https://beta.services.openaire.eu/search/v2/api/",