[Monitor Dashboard]: Add Topic page
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57514 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
c7ed05cf99
commit
a1b3a40426
|
@ -46,6 +46,7 @@
|
|||
|
||||
"cacheUrl" :"https://demo.openaire.eu/cache/get?url=",
|
||||
|
||||
"monitorServiceAPIURL" :"http://duffy.di.uoa.gr:8080/uoa-monitor-service",
|
||||
|
||||
"adminToolsAPIURL" :"https://beta.services.openaire.eu/uoa-admin-tools",
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
|
||||
"datasourcesAPI": "https://services.openaire.eu/openaire/ds/search/",
|
||||
|
||||
"monitorServiceAPIURL" :"http://duffy.di.uoa.gr:8080/uoa-monitor-service",
|
||||
|
||||
"adminToolsAPIURL" :"https://services.openaire.eu/uoa-admin-tools/",
|
||||
|
||||
"adminToolsCommunity" :"connect",
|
||||
|
|
|
@ -28,29 +28,29 @@ export class AppComponent {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd) {
|
||||
let r = this.route;
|
||||
while (r.firstChild) {
|
||||
r = r.firstChild;
|
||||
}
|
||||
r.params.subscribe(params => {
|
||||
if(params['stakeholder']) {
|
||||
if(!this.stakeholderService.stakeholder ||
|
||||
this.stakeholderService.stakeholder.alias !== params['stakeholder']) {
|
||||
this.stakeholderService.getStakeholder(params['stakeholder']).subscribe(stakeholder => {
|
||||
this.stakeholderService.setStakeholder(stakeholder);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.stakeholderService.setStakeholder(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
this.propertiesService.loadEnvironment()
|
||||
.then(properties => {
|
||||
this.properties = properties;
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd) {
|
||||
let r = this.route;
|
||||
while (r.firstChild) {
|
||||
r = r.firstChild;
|
||||
}
|
||||
r.params.subscribe(params => {
|
||||
if(params['stakeholder']) {
|
||||
if(!this.stakeholderService.stakeholder ||
|
||||
this.stakeholderService.stakeholder.alias !== params['stakeholder']) {
|
||||
this.stakeholderService.getStakeholder(this.properties.monitorServiceAPIURL, params['stakeholder']).subscribe(stakeholder => {
|
||||
this.stakeholderService.setStakeholder(stakeholder);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.stakeholderService.setStakeholder(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
this.userManagementService.getUserInfo(this.properties.userInfoUrl).subscribe(user => {
|
||||
this.user = user;
|
||||
this.loginCheck = true;
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
import { Component, Input } from '@angular/core';
|
||||
import { Location } from '@angular/common';
|
||||
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {SideBarService} from "../library/sharedComponents/sidebar/sideBar.service";
|
||||
|
||||
@Component({
|
||||
selector: 'openaire-error',
|
||||
template: `
|
||||
<error></error>
|
||||
`
|
||||
})
|
||||
export class OpenaireErrorPageComponent implements OnInit{
|
||||
|
||||
export class OpenaireErrorPageComponent {
|
||||
constructor(private sidebarService: SideBarService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.sidebarService.setHasSidebar(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<aside *ngIf="stakeholder" id="sidebar_main">
|
||||
<div class="sidebar_main_header">
|
||||
<aside id="sidebar_main">
|
||||
<div *ngIf="stakeholder" class="sidebar_main_header">
|
||||
<div class="uk-padding-small">
|
||||
<img class="uk-margin-bottom" *ngIf="stakeholder.logoUrl" [src]="stakeholder.logoUrl">
|
||||
<div class="uk-text-bold">{{stakeholder.index_name}}</div>
|
||||
<div>Admin Dashboard</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="menu_section">
|
||||
<div *ngIf="stakeholder" class="menu_section">
|
||||
<ul>
|
||||
<li [class.current_section]="analysisOpen"
|
||||
[class.act_section]="analysisOpen"
|
||||
|
@ -17,7 +17,7 @@
|
|||
<span class="menu_title">Analysis Indicators</span>
|
||||
</a>
|
||||
<ul [style.display]="(analysisOpen?'block':'none')">
|
||||
<ng-template ngFor [ngForOf]="stakeholder.topics" let-topic let-j="index">
|
||||
<ng-template ngFor [ngForOf]="stakeholder.topics" let-topic let-i="index">
|
||||
<li>
|
||||
<a [routerLink]="topic.alias">
|
||||
<span *ngIf="topic.icon" class="menu_icon uk-margin-small-right"><i
|
||||
|
@ -88,7 +88,7 @@
|
|||
Start your navigation through the <span class="md-color-blue-700">left side menu!</span>
|
||||
</div>
|
||||
<div class="uk-margin-small-top uk-margin-small-bottom uk-margin-large-left">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="27" height="88" viewBox="0 0 27 88">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="30" height="88" viewBox="0 0 30 88">
|
||||
<g id="Group_749" data-name="Group 749" transform="translate(-872.168 -490.5)">
|
||||
<text class="fill_text" id="OR" transform="translate(872.168 540.271)" font-size="18"
|
||||
font-family="OpenSans-Bold, Open Sans" font-weight="900" opacity="0.8">
|
||||
|
@ -105,7 +105,7 @@
|
|||
Select one of the <span class="md-color-blue-700">topics below</span>!
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-child-width-1-3@m uk-child-width-1-1@s uk-grid-medium" uk-grid uk-height-match="target: .target">
|
||||
<div *ngIf="stakeholder" class="uk-child-width-1-3@m uk-child-width-1-1@s uk-grid-medium" uk-grid uk-height-match="target: .target">
|
||||
<ng-template ngFor [ngForOf]="stakeholder.topics" let-topic>
|
||||
<div>
|
||||
<a [routerLink]="topic.alias">
|
||||
|
|
|
@ -8,6 +8,7 @@ import {ErrorMessagesComponent} from '../openaireLibrary/utils/errorMessages.com
|
|||
import {Stakeholder, Topic} from "../utils/entities/stakeholder";
|
||||
import {SideBarService} from "../library/sharedComponents/sidebar/sideBar.service";
|
||||
import {StakeholderService} from "../services/stakeholder.service";
|
||||
import {Tools} from "../utils/Tools";
|
||||
|
||||
declare var UIkit;
|
||||
|
||||
|
@ -44,7 +45,7 @@ export class HomeComponent implements OnInit, OnDestroy {
|
|||
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.sideBarService.setHasSidebar(true);
|
||||
this.stakeholder = stakeholder;
|
||||
this.stakeholder = Tools.copy(stakeholder);
|
||||
this.topic = null;
|
||||
this.title.setTitle(stakeholder.index_name);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {Injectable} from "@angular/core";
|
||||
import {BehaviorSubject, Observable} from "rxjs";
|
||||
import {Header, Item} from "../../../utils/entities/sidebar";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -10,8 +9,7 @@ export class SideBarService {
|
|||
private openSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true);
|
||||
private hasSidebarSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
|
||||
constructor() {
|
||||
}
|
||||
constructor() {}
|
||||
|
||||
get open(): boolean {
|
||||
return this.openSubject.getValue();
|
||||
|
|
|
@ -38,7 +38,7 @@ import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
|
|||
|
||||
</div>
|
||||
</div>
|
||||
<subscribe [communityId]="communityId" [showTemplate]= false class="" (subscribeEvent)="afterSubscibeEvent($event)"></subscribe>
|
||||
<!--<subscribe [communityId]="communityId" [showTemplate]= false class="" (subscribeEvent)="afterSubscibeEvent($event)">--></subscribe>
|
||||
`
|
||||
})
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div id="header_main">
|
||||
<nav class="uk-light">
|
||||
<div class="main_logo_top">
|
||||
<div *ngIf="stakeholder.index_name" class="">
|
||||
<div *ngIf="stakeholder && stakeholder.index_name" class="">
|
||||
<div class="uk-text-bold">{{stakeholder.index_name}}</div>
|
||||
<!-- <div>Monitor Dashboard</div>-->
|
||||
</div>
|
||||
|
@ -23,7 +23,7 @@
|
|||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<dashboard-sidebar *ngIf="sideBar" [items]="sideBar.items" [name]="stakeholder.index_name"></dashboard-sidebar>
|
||||
<dashboard-sidebar *ngIf="sideBar && stakeholder" [items]="sideBar.items" [name]="stakeholder.index_name"></dashboard-sidebar>
|
||||
<div *ngIf="activeSubCategory"
|
||||
id="page_content" click-outside-or-esc targetId="page_content" (clickOutside)="toggleOpen($event)">
|
||||
<div id="page_content_inner">
|
||||
|
|
|
@ -65,7 +65,7 @@ export class MonitorComponent implements OnInit, OnDestroy {
|
|||
this.status = this.errorCodes.LOADING;
|
||||
this.numberResults = new Map<number, number>();
|
||||
this.chartsActiveType = new Map<number, IndicatorPath>();
|
||||
this.stakeholderService.getStakeholder(params['stakeholder']).subscribe(stakeholder => {
|
||||
this.stakeholderService.getStakeholder(this.properties.monitorServiceAPIURL, params['stakeholder']).subscribe(stakeholder => {
|
||||
this.stakeholder = stakeholder;
|
||||
this.seoService.createLinkForCanonicalURL(url, false);
|
||||
this._meta.updateTag({content: url}, "property='og:url'");
|
||||
|
@ -125,7 +125,11 @@ export class MonitorComponent implements OnInit, OnDestroy {
|
|||
(category.alias === params['category']) && category.isPublic && category.isActive)[0];
|
||||
} else {
|
||||
let category: Category = this.activeTopic.categories[0];
|
||||
this.navigateTo(this.stakeholder.alias, this.activeTopic.alias, category.alias);
|
||||
if(category) {
|
||||
this.navigateTo(this.stakeholder.alias, this.activeTopic.alias, category.alias);
|
||||
} else {
|
||||
this.navigateToError();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.activeCategory) {
|
||||
|
@ -152,7 +156,11 @@ export class MonitorComponent implements OnInit, OnDestroy {
|
|||
} else {
|
||||
let topic: Topic = this.stakeholder.topics[0];
|
||||
let category: Category = topic.categories.filter(category => category.isPublic && category.isActive)[0];
|
||||
this.navigateTo(this.stakeholder.alias, topic.alias, category.alias);
|
||||
if(topic && category) {
|
||||
this.navigateTo(this.stakeholder.alias, topic.alias, category.alias);
|
||||
} else {
|
||||
this.navigateToError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ export class StakeholderService {
|
|||
this.stakeholderSubject = new BehaviorSubject<Stakeholder>(null);
|
||||
}
|
||||
|
||||
getStakeholder(alias: string): Observable<Stakeholder> {
|
||||
return new BehaviorSubject<Stakeholder>(Stakeholder.createECStakeholder()).asObservable();
|
||||
getStakeholder(url: string, alias:string): Observable<Stakeholder> {
|
||||
return this.http.get<Stakeholder>(url + '/stakeholder/' + alias);
|
||||
}
|
||||
|
||||
getStakeholderAsObservable(): Observable<Stakeholder> {
|
||||
|
|
|
@ -1,125 +1,335 @@
|
|||
<aside *ngIf="stakeholder" id="sidebar_main">
|
||||
<div class="sidebar_main_header">
|
||||
<aside id="sidebar_main">
|
||||
<div *ngIf="stakeholder" class="sidebar_main_header uk-margin-remove-bottom">
|
||||
<div class="uk-padding-small">
|
||||
<img class="uk-margin-bottom" *ngIf="stakeholder.logoUrl" [src]="stakeholder.logoUrl">
|
||||
<div class="uk-text-bold">{{stakeholder.index_name}}</div>
|
||||
<div>Admin Dashboard</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="menu_section">
|
||||
<div *ngIf="stakeholder" class="menu_section">
|
||||
<ul>
|
||||
<li [class.current_section]="analysisOpen"
|
||||
[class.act_section]="analysisOpen"
|
||||
title="Analysis Indicators"
|
||||
class="submenu_trigger">
|
||||
<a [routerLink]="" (click)="analysisOpen = !analysisOpen">
|
||||
<span class="menu_icon"><i class="material-icons">donut_large</i></span>
|
||||
<span class="menu_title">Analysis Indicators</span>
|
||||
<li class="uk-margin-bottom md-bg-blue-700 uk-padding-small">
|
||||
<a class="md-color-white" (click)="back()">
|
||||
<span class="menu_icon"><i class="material-icons md-color-white">arrow_back</i></span>
|
||||
<div class="menu_title uk-inline">
|
||||
{{stakeholder.topics[topicIndex].name.toUpperCase()}}
|
||||
<button class="uk-position-center-right-out uk-margin-right uk-button uk-button-link"
|
||||
(click)="$event.stopPropagation();editTopicOpen(editTopic)">
|
||||
<i class="material-icons md-color-white">more_horiz</i>
|
||||
</button>
|
||||
</div>
|
||||
</a>
|
||||
<ul [style.display]="(analysisOpen?'block':'none')">
|
||||
<ng-template ngFor [ngForOf]="stakeholder.topics" let-topic let-j="index">
|
||||
<li>
|
||||
<a [routerLink]="topic.alias">
|
||||
<span *ngIf="topic.icon" class="menu_icon uk-margin-small-right"><i
|
||||
class="material-icons">{{topic.icon}}</i></span>
|
||||
<span class="menu_title">{{topic.name}}</span>
|
||||
</a>
|
||||
</li>
|
||||
</ng-template>
|
||||
<li>
|
||||
<a [routerLink]="" (click)="newTopicOpen()">
|
||||
<span class="menu_icon"><i class="material-icons">add</i></span>
|
||||
<span class="menu_title">Create new Topic</span>
|
||||
</a>
|
||||
<div uk-drop="mode: click; offset: -2; delay-hide: 0" #newTopic
|
||||
class="uk-padding-large uk-padding-remove-vertical uk-padding-remove-right uk-drop">
|
||||
<div *ngIf="topic">
|
||||
<div class="md-card">
|
||||
<div class="md-card-content uk-position-relative">
|
||||
<a [routerLink]="" class="uk-position-top-right">
|
||||
<i (click)="close(newTopic)" class="material-icons">close</i>
|
||||
</a>
|
||||
<div class="uk-grid-small" uk-grid>
|
||||
<div class="uk-width-1-1">
|
||||
<label class="uk-text-bold">New Topic</label>
|
||||
<input class="uk-input uk-form-small" [(ngModel)]="topic.name"
|
||||
[class.uk-form-danger]="!valid" type="text">
|
||||
</div>
|
||||
<div class="uk-width-1-2">
|
||||
<select class="uk-select uk-form-small" [(ngModel)]="topic.isPublic">
|
||||
<option [value]="true">Public</option>
|
||||
<option [value]="false">Private</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="uk-width-1-2">
|
||||
<select class="uk-select uk-form-small" [(ngModel)]="topic.isActive">
|
||||
<option [value]="true">Active</option>
|
||||
<option [value]="false">Inactive</option>
|
||||
</select>
|
||||
</div>
|
||||
<div uk-drop="mode: none; offset: -2; delay-hide: 0;" #editTopic
|
||||
class="uk-padding-large uk-padding-remove-vertical uk-padding-remove-right uk-drop">
|
||||
<div *ngIf="topic">
|
||||
<div class="md-card">
|
||||
<div class="md-card-content uk-position-relative">
|
||||
<a [routerLink]="" class="uk-position-top-right">
|
||||
<i (click)="hide(editTopic)" class="material-icons">close</i>
|
||||
</a>
|
||||
<div class="uk-grid-small" uk-grid>
|
||||
<div class="uk-width-1-1">
|
||||
<label class="uk-text-bold">Topic Settings</label>
|
||||
<input class="uk-input uk-form-small" [(ngModel)]="topic.name"
|
||||
[class.uk-form-danger]="!valid" type="text">
|
||||
</div>
|
||||
<div class="uk-width-1-2">
|
||||
<select class="uk-select uk-form-small" [(ngModel)]="topic.isPublic">
|
||||
<option [value]="true">Public</option>
|
||||
<option [value]="false">Private</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="uk-width-1-2">
|
||||
<select class="uk-select uk-form-small" [(ngModel)]="topic.isActive">
|
||||
<option [value]="true">Active</option>
|
||||
<option [value]="false">Inactive</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
|
||||
<div>
|
||||
<button class="md-btn md-btn-small" (click)="deleteTopic(editTopic)">Delete</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="md-btn md-btn-small md-btn-primary uk-float-right"
|
||||
(click)="saveTopic(editTopic)">Save
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<ng-template ngFor [ngForOf]="stakeholder.topics[topicIndex].categories" let-category let-i="index">
|
||||
<li [class.current_section]="categoryIndex === i"
|
||||
[class.act_section]="categoryIndex === i && toggle"
|
||||
[title]="category.name"
|
||||
class="submenu_trigger">
|
||||
<a (click)="toggleCategory(i);hide(editCategory)">
|
||||
<span *ngIf="category.icon" class="menu_icon"><i
|
||||
class="material-icons">{{category.icon}}</i></span>
|
||||
<div class="menu_title uk-inline">
|
||||
{{category.name}}
|
||||
<button class="uk-position-center-right-out uk-margin-right uk-button uk-button-link"
|
||||
(click)="$event.stopPropagation();editCategoryOpen(i, editCategory)">
|
||||
<i class="material-icons">more_horiz</i>
|
||||
</button>
|
||||
</div>
|
||||
</a>
|
||||
<div uk-drop="mode: none; offset: -2; delay-hide: 0;" #editCategory
|
||||
class="uk-padding-large uk-padding-remove-vertical uk-padding-remove-right uk-drop">
|
||||
<div *ngIf="copyCategory">
|
||||
<div class="md-card">
|
||||
<div class="md-card-content uk-position-relative">
|
||||
<a [routerLink]="" class="uk-position-top-right">
|
||||
<i (click)="hide(editCategory)" class="material-icons">close</i>
|
||||
</a>
|
||||
<div class="uk-grid-small" uk-grid>
|
||||
<div class="uk-width-1-1">
|
||||
<label class="uk-text-bold">Category Settings</label>
|
||||
<input class="uk-input uk-form-small" [(ngModel)]="copyCategory.name"
|
||||
[class.uk-form-danger]="!valid" type="text">
|
||||
</div>
|
||||
<hr>
|
||||
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
|
||||
<div>
|
||||
<button class="md-btn md-btn-small" (click)="close(newTopic)">Cancel</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="md-btn md-btn-small md-btn-primary uk-float-right" (click)="createTopic(newTopic)">Create</button>
|
||||
</div>
|
||||
<div class="uk-width-1-2">
|
||||
<select class="uk-select uk-form-small" [(ngModel)]="copyCategory.isPublic">
|
||||
<option [value]="true">Public</option>
|
||||
<option [value]="false">Private</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="uk-width-1-2">
|
||||
<select class="uk-select uk-form-small" [(ngModel)]="copyCategory.isActive">
|
||||
<option [value]="true">Active</option>
|
||||
<option [value]="false">Inactive</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
|
||||
<div>
|
||||
<button class="md-btn md-btn-small" (click)="delete(editCategory)">Delete</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="md-btn md-btn-small md-btn-primary uk-float-right"
|
||||
(click)="saveCategory(editCategory, i)">Save
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</aside>
|
||||
<div id="page_content" click-outside-or-esc targetId="page_content" (clickOutside)="toggleOpen($event)">
|
||||
<div id="page_content_inner">
|
||||
<h4 class="uk-text-bold">
|
||||
Customise your Monitor Dashboard!
|
||||
</h4>
|
||||
<div class="uk-text-large uk-margin-bottom">
|
||||
<div>
|
||||
Modify or add new topics, categories and content.<br><br>
|
||||
Start your navigation through the <span class="md-color-blue-700">left side menu!</span>
|
||||
</div>
|
||||
<div class="uk-margin-small-top uk-margin-small-bottom uk-margin-large-left">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="27" height="88" viewBox="0 0 27 88">
|
||||
<g id="Group_749" data-name="Group 749" transform="translate(-872.168 -490.5)">
|
||||
<text class="fill_text" id="OR" transform="translate(872.168 540.271)" font-size="18"
|
||||
font-family="OpenSans-Bold, Open Sans" font-weight="900" opacity="0.8">
|
||||
<tspan x="0" y="0">OR</tspan>
|
||||
</text>
|
||||
<line class="stroke_line" id="Line_225" data-name="Line 225" y2="30" transform="translate(885.5 490.5)"
|
||||
fill="none" stroke="#000" stroke-width="1" opacity="0.2"/>
|
||||
<line class="stroke_line" id="Line_226" data-name="Line 226" y2="30" transform="translate(885.5 548.5)"
|
||||
fill="none" stroke="#000" stroke-width="1" opacity="0.2"/>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="uk-width-1-1">
|
||||
Select one of the <span class="md-color-blue-700">topics below</span>!
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-child-width-1-3@m uk-child-width-1-1@s uk-grid-medium" uk-grid uk-height-match="target: .target">
|
||||
<ng-template ngFor [ngForOf]="stakeholder.topics" let-topic>
|
||||
<div>
|
||||
<a [routerLink]="topic.alias">
|
||||
<div class="md-card target">
|
||||
<div class="md-card-content">
|
||||
<h6 class="uk-text-bold">{{topic.name}}</h6>
|
||||
<div class="uk-text-secondary">
|
||||
{{topic.description}}
|
||||
</div>
|
||||
<ul [style.display]="((categoryIndex === i && toggle)?'block':'none')">
|
||||
<ng-template ngFor [ngForOf]="stakeholder.topics[topicIndex].categories[i].subCategories"
|
||||
let-subcategory let-j="index">
|
||||
<li>
|
||||
<a (click)="editSubCategoryOpen(j, editSubCategory)">
|
||||
<span *ngIf="subcategory.icon" class="menu_icon uk-margin-small-right"><i
|
||||
class="material-icons">{{subcategory.icon}}</i></span>
|
||||
<div class="menu_title uk-inline">
|
||||
{{subcategory.name}}
|
||||
<button class="uk-position-center-right-out uk-margin-right uk-button uk-button-link"
|
||||
(click)="$event.stopPropagation();editSubCategoryOpen(j, editSubCategory)">
|
||||
<i class="material-icons">more_horiz</i>
|
||||
</button>
|
||||
</div>
|
||||
</a>
|
||||
<div uk-drop="mode: click; offset: -2; delay-hide: 0" #editSubCategory
|
||||
class="uk-padding-large uk-padding-remove-vertical uk-padding-remove-right uk-drop">
|
||||
<div *ngIf="copySubCategory">
|
||||
<div class="md-card">
|
||||
<div class="md-card-content uk-position-relative">
|
||||
<a [routerLink]="" class="uk-position-top-right">
|
||||
<i (click)="hide(editSubCategory)" class="material-icons">close</i>
|
||||
</a>
|
||||
<div class="uk-grid-small" uk-grid>
|
||||
<div class="uk-width-1-1">
|
||||
<label class="uk-text-bold">Subcategory Settings</label>
|
||||
<input class="uk-input uk-form-small" [(ngModel)]="copySubCategory.name"
|
||||
[class.uk-form-danger]="!valid" type="text">
|
||||
</div>
|
||||
<div class="uk-width-1-2">
|
||||
<select class="uk-select uk-form-small" [(ngModel)]="copySubCategory.isPublic">
|
||||
<option [value]="true">Public</option>
|
||||
<option [value]="false">Private</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="uk-width-1-2">
|
||||
<select class="uk-select uk-form-small" [(ngModel)]="copySubCategory.isActive">
|
||||
<option [value]="true">Active</option>
|
||||
<option [value]="false">Inactive</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
|
||||
<div>
|
||||
<button class="md-btn md-btn-small" (click)="delete(editSubCategory)">Delete</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="md-btn md-btn-small md-btn-primary uk-float-right"
|
||||
(click)="saveSubCategory(editSubCategory, j)">Save
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ng-template>
|
||||
<li>
|
||||
<a [routerLink]="" (click)="editSubCategoryOpen()">
|
||||
<span class="menu_icon"><i class="material-icons">add</i></span>
|
||||
<span class="menu_title">Create new Subcategory</span>
|
||||
</a>
|
||||
<div uk-drop="mode: click; offset: -2; delay-hide: 0" #newSubCategory
|
||||
class="uk-padding-large uk-padding-remove-vertical uk-padding-remove-right uk-drop">
|
||||
<div *ngIf="copySubCategory">
|
||||
<div class="md-card">
|
||||
<div class="md-card-content uk-position-relative">
|
||||
<a [routerLink]="" class="uk-position-top-right">
|
||||
<i (click)="hide(newSubCategory)" class="material-icons">close</i>
|
||||
</a>
|
||||
<div class="uk-grid-small" uk-grid>
|
||||
<div class="uk-width-1-1">
|
||||
<label class="uk-text-bold">New Subcategory</label>
|
||||
<input class="uk-input uk-form-small" [(ngModel)]="copySubCategory.name"
|
||||
[class.uk-form-danger]="!valid" type="text">
|
||||
</div>
|
||||
<div class="uk-width-1-2">
|
||||
<select class="uk-select uk-form-small" [(ngModel)]="copySubCategory.isPublic">
|
||||
<option [value]="true">Public</option>
|
||||
<option [value]="false">Private</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="uk-width-1-2">
|
||||
<select class="uk-select uk-form-small" [(ngModel)]="copySubCategory.isActive">
|
||||
<option [value]="true">Active</option>
|
||||
<option [value]="false">Inactive</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
|
||||
<div>
|
||||
<button class="md-btn md-btn-small" (click)="hide(newSubCategory)">Cancel</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="md-btn md-btn-small md-btn-primary uk-float-right"
|
||||
(click)="saveSubCategory(newSubCategory)">Create
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ng-template>
|
||||
<li>
|
||||
<a [routerLink]="" (click)="editCategoryOpen()">
|
||||
<span class="menu_icon"><i class="material-icons">add</i></span>
|
||||
<span class="menu_title">Create new Category</span>
|
||||
</a>
|
||||
<div uk-drop="mode: click; offset: -2; delay-hide: 0" #newCategory
|
||||
class="uk-padding-large uk-padding-remove-vertical uk-padding-remove-right uk-drop">
|
||||
<div *ngIf="copyCategory">
|
||||
<div class="md-card">
|
||||
<div class="md-card-content uk-position-relative">
|
||||
<a [routerLink]="" class="uk-position-top-right">
|
||||
<i (click)="hide(newCategory)" class="material-icons">close</i>
|
||||
</a>
|
||||
<div class="uk-grid-small" uk-grid>
|
||||
<div class="uk-width-1-1">
|
||||
<label class="uk-text-bold">New Category</label>
|
||||
<input class="uk-input uk-form-small" [(ngModel)]="copyCategory.name"
|
||||
[class.uk-form-danger]="!valid" type="text">
|
||||
</div>
|
||||
<div class="uk-width-1-2">
|
||||
<select class="uk-select uk-form-small" [(ngModel)]="copyCategory.isPublic">
|
||||
<option [value]="true">Public</option>
|
||||
<option [value]="false">Private</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="uk-width-1-2">
|
||||
<select class="uk-select uk-form-small" [(ngModel)]="copyCategory.isActive">
|
||||
<option [value]="true">Active</option>
|
||||
<option [value]="false">Inactive</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
|
||||
<div>
|
||||
<button class="md-btn md-btn-small" (click)="hide(newCategory)">Cancel</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="md-btn md-btn-small md-btn-primary uk-float-right"
|
||||
(click)="saveCategory(newCategory)">Create
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<hr class="uk-hr">
|
||||
<div class="uk-padding-small uk-padding-remove-vertical">
|
||||
<button [class.md-btn-primary]="unsaved" [class.disabled]="!unsaved"
|
||||
class="md-btn md-btn-small uk-float-right">Save</button>
|
||||
</div>
|
||||
</aside>
|
||||
<div id="page_content" click-outside-or-esc targetId="page_content" (clickOutside)="toggleOpen($event)">
|
||||
<div class="uk-padding-small md-bg-white" uk-grid>
|
||||
<div class="uk-width-2-3@m uk-width-1-1 uk-child-width-1-3@m uk-child-width-1-1" uk-grid>
|
||||
<div class="uk-flex uk-flex-middle">
|
||||
<label>Chart Type:</label>
|
||||
<select class="uk-select uk-form-small uk-margin-small-left" [(ngModel)]="chartType">
|
||||
<option [value]="null">all</option>
|
||||
<option [value]="'pie'">Pie</option>
|
||||
<option [value]="'table'">Table</option>
|
||||
<option [value]="'line'">Line</option>
|
||||
<option [value]="'column'">Column</option>
|
||||
<option [value]="'bar'">Bar</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="uk-flex uk-flex-middle">
|
||||
<label>Privacy:</label>
|
||||
<select class="uk-select uk-form-small uk-margin-small-left" [(ngModel)]="isPublic">
|
||||
<option [value]="null">all</option>
|
||||
<option [value]="true">Public</option>
|
||||
<option [value]="false">Private</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="uk-flex uk-flex-middle">
|
||||
<label>Status:</label>
|
||||
<select class="uk-select uk-form-small uk-margin-small-left" [(ngModel)]="isActive">
|
||||
<option [value]="null">all</option>
|
||||
<option [value]="true">Active</option>
|
||||
<option [value]="false">Inactive</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-width-expand uk-flex uk-flex-middle uk-flex-right">
|
||||
<div class="uk-inline">
|
||||
<span class="uk-form-icon uk-form-icon-flip"><i class="material-icons">search</i></span>
|
||||
<input class="uk-input uk-form-small" placeholder="Locate indicator..">
|
||||
</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 id="page_content_inner">
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -5,9 +5,10 @@ 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 "../utils/entities/stakeholder";
|
||||
import {Category, Stakeholder, SubCategory, Topic} from "../utils/entities/stakeholder";
|
||||
import {SideBarService} from "../library/sharedComponents/sidebar/sideBar.service";
|
||||
import {StakeholderService} from "../services/stakeholder.service";
|
||||
import {Tools} from "../utils/Tools";
|
||||
|
||||
declare var UIkit;
|
||||
|
||||
|
@ -20,11 +21,22 @@ export class TopicComponent implements OnInit, OnDestroy {
|
|||
public loading: boolean = true;
|
||||
public errorCodes: ErrorCodes;
|
||||
public stakeholder: Stakeholder;
|
||||
public analysisOpen: boolean = true;
|
||||
private errorMessages: ErrorMessagesComponent;
|
||||
public topic: Topic;
|
||||
public topicIndex: number = -1;
|
||||
public topic: Topic = null;
|
||||
public categoryIndex: number = -1;
|
||||
public copyCategory: Category = null;
|
||||
public subCategoryIndex: number = -1;
|
||||
public copySubCategory: SubCategory = null;
|
||||
public valid = true;
|
||||
public edit: boolean = false;
|
||||
public toggle: boolean = false;
|
||||
public unsaved: boolean = false;
|
||||
public properties: EnvProperties;
|
||||
public chartType: string = null;
|
||||
public isPublic: boolean = null;
|
||||
public isActive: boolean = null;
|
||||
grid: boolean = true;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
|
@ -45,11 +57,12 @@ export class TopicComponent implements OnInit, OnDestroy {
|
|||
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.sideBarService.setHasSidebar(true);
|
||||
this.stakeholder = stakeholder;
|
||||
this.topic = this.stakeholder.topics.filter(topic => topic.alias === params['topic'])[0];
|
||||
this.title.setTitle(stakeholder.index_name);
|
||||
if(!this.topic) {
|
||||
this.stakeholder = Tools.copy(stakeholder);
|
||||
this.topicIndex = this.stakeholder.topics.findIndex(topic => topic.alias === params['topic']);
|
||||
if(this.topicIndex === -1) {
|
||||
this.navigateToError();
|
||||
} else {
|
||||
this.title.setTitle(stakeholder.index_name);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -60,13 +73,14 @@ export class TopicComponent implements OnInit, OnDestroy {
|
|||
public ngOnDestroy() {
|
||||
}
|
||||
|
||||
public newTopicOpen() {
|
||||
this.topic = new Topic(null, null, null,true, true);
|
||||
this.valid = true;
|
||||
public hide(element) {
|
||||
this.edit = false;
|
||||
UIkit.drop(element).hide();
|
||||
}
|
||||
|
||||
public close(element) {
|
||||
UIkit.drop(element).hide();
|
||||
public show(element) {
|
||||
this.edit = true;
|
||||
UIkit.drop(element).show();
|
||||
}
|
||||
|
||||
get open(): boolean {
|
||||
|
@ -81,17 +95,114 @@ export class TopicComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
public createTopic(element) {
|
||||
if(this.topic.name && this.topic.name !== '') {
|
||||
this.topic.alias = this.topic.name.toLowerCase();
|
||||
this.stakeholder.topics.push(this.topic);
|
||||
this.close(element);
|
||||
public toggleCategory(index: number) {
|
||||
if(this.categoryIndex !== index) {
|
||||
this.categoryIndex = index;
|
||||
this.toggle = true;
|
||||
} else {
|
||||
this.toggle = !this.toggle;
|
||||
}
|
||||
}
|
||||
|
||||
public editCategoryOpen(index:number = -1, element = null) {
|
||||
if(index === -1) {
|
||||
this.copyCategory = new Category(null, null, null, true, true);
|
||||
} else {
|
||||
if(element.className.indexOf('uk-open') !== -1) {
|
||||
this.hide(element);
|
||||
} else {
|
||||
this.copyCategory = Tools.copy(this.stakeholder.topics[this.topicIndex].categories[index]);
|
||||
this.show(element);
|
||||
this.valid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public saveCategory(element, index = -1) {
|
||||
if(this.copyCategory.name && this.copyCategory.name !== '') {
|
||||
this.copyCategory.alias = this.copyCategory.name.toLowerCase();
|
||||
if(index === -1) {
|
||||
this.stakeholder.topics[this.topicIndex].categories.push(this.copyCategory);
|
||||
} else {
|
||||
this.stakeholder.topics[this.topicIndex].categories[index] = Tools.copy(this.copyCategory);
|
||||
}
|
||||
this.hide(element);
|
||||
this.unsaved = true;
|
||||
} else {
|
||||
this.valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
public editTopicOpen(element) {
|
||||
if(element.className.indexOf('uk-open') !== -1) {
|
||||
this.hide(element);
|
||||
} else {
|
||||
this.topic = Tools.copy(this.stakeholder.topics[this.topicIndex]);
|
||||
this.valid = true;
|
||||
this.show(element);
|
||||
}
|
||||
}
|
||||
|
||||
public editSubCategoryOpen(index:number = -1, element = null) {
|
||||
if(index === -1) {
|
||||
this.copySubCategory = new SubCategory(null, null, null, true, true);
|
||||
} else {
|
||||
if(element.className.indexOf('uk-open') !== -1) {
|
||||
this.hide(element);
|
||||
} else {
|
||||
this.copySubCategory = Tools.copy(this.stakeholder.topics[this.topicIndex].
|
||||
categories[this.categoryIndex].subCategories[index]);
|
||||
this.show(element);
|
||||
this.valid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public saveSubCategory(element, index = -1) {
|
||||
if(this.copySubCategory.name && this.copySubCategory.name !== '') {
|
||||
this.copySubCategory.alias = this.copySubCategory.name.toLowerCase();
|
||||
if(index === -1) {
|
||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].
|
||||
subCategories.push(this.copySubCategory);
|
||||
} else {
|
||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].
|
||||
subCategories[index] = Tools.copy(this.copySubCategory);
|
||||
}
|
||||
this.hide(element);
|
||||
this.unsaved = true;
|
||||
} else {
|
||||
this.valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
public saveTopic(element) {
|
||||
if(this.topic.name && this.topic.name !== '') {
|
||||
this.topic.alias = this.topic.name.toLowerCase();
|
||||
this.stakeholder.topics[this.topicIndex] = Tools.copy(this.topic);
|
||||
this.hide(element);
|
||||
this.unsaved = true;
|
||||
} else {
|
||||
this.valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
public deleteTopic(element) {
|
||||
/*this.stakeholder.topics.splice(this.topicIndex, 1);
|
||||
this.hide(element);
|
||||
this.back();*/
|
||||
}
|
||||
|
||||
public changeGrid(value) {
|
||||
this.grid = value;
|
||||
}
|
||||
|
||||
private navigateToError() {
|
||||
this.router.navigate(['/error'], {queryParams: {'page': this.router.url}});
|
||||
}
|
||||
|
||||
back() {
|
||||
this.router.navigate(['../'], {
|
||||
relativeTo: this.route
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
export class Tools {
|
||||
|
||||
public static copy(element: any): any {
|
||||
return JSON.parse(JSON.stringify(element));
|
||||
}
|
||||
}
|
|
@ -49,6 +49,8 @@
|
|||
|
||||
"cacheUrl" :"http://scoobydoo.di.uoa.gr:3000/get?url=",
|
||||
|
||||
"monitorServiceAPIURL" :"http://duffy.di.uoa.gr:8080/uoa-monitor-service",
|
||||
|
||||
"adminToolsAPIURL" :"http://mpagasas.di.uoa.gr:8080/uoa-admin-tools",
|
||||
|
||||
"adminToolsCommunity" :"connect",
|
||||
|
|
|
@ -21,3 +21,11 @@
|
|||
html {
|
||||
color: black !important;
|
||||
}
|
||||
|
||||
li>a .uk-button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
li>a:hover .uk-button {
|
||||
display: block;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue