[Monitor Dashaboard | Fix some bugs with indicators saving]

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@58683 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Konstantinos Triantafyllou 2020-05-12 11:05:53 +00:00
parent d85a4370d8
commit 7ba7798abb
8 changed files with 48 additions and 38 deletions

View File

@ -66,8 +66,7 @@
[activeSubItem]="activeSubCategory?activeSubCategory.alias:null" [showHeader]=false [activeSubItem]="activeSubCategory?activeSubCategory.alias:null" [showHeader]=false
></dashboard-sidebar> ></dashboard-sidebar>
<div *ngIf="activeSubCategory" <div *ngIf="activeSubCategory"
id="page_content" click-outside-or-esc targetId="page_content" [escClose]="false" id="page_content">
(clickOutside)="toggleOpen($event)">
<div id="page_content_inner"> <div id="page_content_inner">
<!-- <div> <!-- <div>
Filters Filters

View File

@ -14,7 +14,6 @@ import {StakeholderService} from "../services/stakeholder.service";
import {Category, ChartHelper, IndicatorPath, Stakeholder, SubCategory, Topic} from "../utils/entities/stakeholder"; import {Category, ChartHelper, IndicatorPath, Stakeholder, SubCategory, Topic} from "../utils/entities/stakeholder";
import {StatisticsService} from "../utils/services/statistics.service"; import {StatisticsService} from "../utils/services/statistics.service";
import {IndicatorUtils, StakeholderUtils} from "../utils/indicator-utils"; import {IndicatorUtils, StakeholderUtils} from "../utils/indicator-utils";
import {StakeholderCreator} from "../utils/entities/stakeholderCreator";
import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service"; import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
import {FormBuilder, FormControl} from "@angular/forms"; import {FormBuilder, FormControl} from "@angular/forms";
import {IDeactivateComponent} from "../openaireLibrary/utils/can-exit.guard"; import {IDeactivateComponent} from "../openaireLibrary/utils/can-exit.guard";
@ -172,22 +171,14 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
return this.layoutService.open; return this.layoutService.open;
} }
public toggleOpen(event = null) {
if (!event) {
this.layoutService.setOpen(!this.open);
} else if (event && event['value'] === true) {
this.layoutService.setOpen(false);
}
}
private getPageContents() { private getPageContents() {
this.helper.getPageHelpContents(this._router.url, this.properties, 'monitor').subscribe(contents => { this.helper.getPageHelpContents(this.properties, 'monitor', this._router.url).subscribe(contents => {
this.pageContents = contents; this.pageContents = contents;
}) })
} }
private getDivContents() { private getDivContents() {
this.helper.getDivHelpContents(this._router.url, this.properties, 'monitor').subscribe(contents => { this.helper.getDivHelpContents(this.properties, 'monitor', this._router.url).subscribe(contents => {
this.divContents = contents; this.divContents = contents;
}) })
} }

View File

@ -62,7 +62,7 @@
</ul> </ul>
</div> </div>
</aside> </aside>
<div id="page_content" click-outside-or-esc targetId="page_content" [escClose]="false" (clickOutside)="toggleOpen($event)"> <div id="page_content">
<div id="page_content_inner"> <div id="page_content_inner">
<h4 class="uk-text-bold"> <h4 class="uk-text-bold">
Customise your Monitor Dashboard! Customise your Monitor Dashboard!

View File

@ -90,14 +90,6 @@ export class StakeholderComponent implements OnInit, OnDestroy, IDeactivateCompo
return this.layoutService.open; return this.layoutService.open;
} }
public toggleOpen(event = null) {
if (!event) {
this.layoutService.setOpen(!this.open);
} else if (event && event['value'] === true) {
this.layoutService.setOpen(false);
}
}
private buildTopic(topic: Topic) { private buildTopic(topic: Topic) {
let topics = this.stakeholder.topics.filter(element => element._id !== topic._id); let topics = this.stakeholder.topics.filter(element => element._id !== topic._id);
this.form = this.fb.group({ this.form = this.fb.group({

View File

@ -1,5 +1,4 @@
<div id="page_content" click-outside-or-esc targetId="page_content" [escClose]="false" <div id="page_content">
(clickOutside)="toggleOpen($event)">
<div class="uk-padding-small md-bg-white" uk-grid> <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 *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>
@ -260,6 +259,12 @@
</i> </i>
<div>{{(indicator.isActive) ? 'Active' : 'Inactive'}}</div> <div>{{(indicator.isActive) ? 'Active' : 'Inactive'}}</div>
</div> </div>
<iframe *ngIf="indicator.indicatorPaths[i].source !== 'image'"
[src]="indicator.indicatorPaths[i].safeResourceUrl"
class="uk-width-1-1 uk-height-medium"></iframe>
<div *ngIf="indicator.indicatorPaths[i].source === 'image'">
<img class="uk-width-1-1 uk-height-medium" [src]="indicator.indicatorPaths[i].url">
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,4 +1,14 @@
import {AfterViewInit, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewChild} from "@angular/core"; import {
AfterViewInit,
ChangeDetectorRef,
Component,
Input,
OnChanges,
OnDestroy,
OnInit,
SimpleChanges,
ViewChild
} from "@angular/core";
import {Indicator, IndicatorPath, IndicatorType, Section, Stakeholder} from "../utils/entities/stakeholder"; import {Indicator, IndicatorPath, IndicatorType, Section, Stakeholder} from "../utils/entities/stakeholder";
import {IndicatorUtils} from "../utils/indicator-utils"; import {IndicatorUtils} from "../utils/indicator-utils";
import {FormArray, FormBuilder, FormControl, FormGroup, Validators} from "@angular/forms"; import {FormArray, FormBuilder, FormControl, FormGroup, Validators} from "@angular/forms";
@ -69,6 +79,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
private statisticsService: StatisticsService, private statisticsService: StatisticsService,
private fb: FormBuilder, private fb: FormBuilder,
private router: Router, private router: Router,
private cdr: ChangeDetectorRef,
private sanitizer: DomSanitizer) { private sanitizer: DomSanitizer) {
} }
@ -141,14 +152,6 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
UIkit.dropdown(element).hide(); UIkit.dropdown(element).hide();
} }
public toggleOpen(event = null) {
if (!event) {
this.layoutService.setOpen(!this.open);
} else if (event && event['value'] === true) {
this.layoutService.setOpen(false);
}
}
public changeGrid(value) { public changeGrid(value) {
this.grid = value; this.grid = value;
} }
@ -206,6 +209,13 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
this.filters.value.privacy), this.filters.value.privacy),
this.filters.value.chartType this.filters.value.chartType
); );
this.displayCharts.forEach(section => {
section.indicators.forEach(indicator => {
indicator.indicatorPaths.forEach(indicatorPath => {
indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath);
});
})
});
} }
filterNumbers() { filterNumbers() {
@ -391,7 +401,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
}); });
this.indicator.indicatorPaths.forEach(indicatorPath => { this.indicator.indicatorPaths.forEach(indicatorPath => {
this.addIndicatorPath(this.getUrlByStakeHolder(indicatorPath), this.getParametersAsFormArray(indicatorPath)); this.addIndicatorPath(this.getUrlByStakeHolder(indicatorPath), this.getParametersAsFormArray(indicatorPath));
indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath) indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath);
}); });
} else { } else {
this.indicator = new Indicator('', '', 'chart', 'small', false, false, []); this.indicator = new Indicator('', '', 'chart', 'small', false, false, []);
@ -422,6 +432,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
saveIndicator() { saveIndicator() {
if (this.indicator.type === 'chart') { if (this.indicator.type === 'chart') {
this.indicator = this.indicatorUtils.generateIndicatorByForm(this.indicatorFb.value, this.indicator.indicatorPaths); this.indicator = this.indicatorUtils.generateIndicatorByForm(this.indicatorFb.value, this.indicator.indicatorPaths);
this.section = this.charts.find(section => section._id === this.section._id);
} }
let path = [ let path = [
this.stakeholder._id, this.stakeholder._id,
@ -483,6 +494,11 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
deleteIndicatorOpen(section: Section, indicatorId: string, type: string = 'chart') { deleteIndicatorOpen(section: Section, indicatorId: string, type: string = 'chart') {
this.section = section; this.section = section;
if(type === 'chart') {
this.index = this.charts.find(value => value._id == section._id).indicators.findIndex(value => value._id == indicatorId);
} else {
this.index = this.numbers.find(value => value._id == section._id).indicators.findIndex(value => value._id == indicatorId);
}
this.indicator = section.indicators.find(value => value._id == indicatorId); this.indicator = section.indicators.find(value => value._id == indicatorId);
this.deleteModal.alertTitle = 'Delete indicator'; this.deleteModal.alertTitle = 'Delete indicator';
this.deleteModal.cancelButtonText = 'No'; this.deleteModal.cancelButtonText = 'No';
@ -502,8 +518,10 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path).subscribe(() => { this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path).subscribe(() => {
if (this.indicator.type === 'chart') { if (this.indicator.type === 'chart') {
this.charts.find(section => section._id === this.section._id).indicators.splice(this.index, 1); this.charts.find(section => section._id === this.section._id).indicators.splice(this.index, 1);
this.filterCharts();
} else { } else {
this.numbers.find(section => section._id === this.section._id).indicators.splice(this.index, 1); this.numbers.find(section => section._id === this.section._id).indicators.splice(this.index, 1);
this.filterNumbers();
} }
}); });
} }

View File

@ -77,7 +77,7 @@ export class SubscribeComponent {
this.subscribed = false; this.subscribed = false;
} else { } else {
if (this.communityId) { if (this.communityId) {
this._subscribeService.isSubscribedToCommunity(this.properties, this.communityId, email).subscribe( this._subscribeService.isSubscribedToCommunity(this.properties, this.communityId).subscribe(
res => { res => {
this.subscribed = res; this.subscribed = res;
if (this.subscribed) { if (this.subscribed) {
@ -133,7 +133,7 @@ export class SubscribeComponent {
} else { } else {
this.loading = true; this.loading = true;
this.showLoginAlert = false; this.showLoginAlert = false;
this._subscribeService.subscribeToCommunity(this.communityId, email, this.properties.adminToolsAPIURL).subscribe( this._subscribeService.subscribeToCommunity(this.properties, this.communityId).subscribe(
res => { res => {
this.loading = false; this.loading = false;
if (res.status && res.status != 200) { if (res.status && res.status != 200) {
@ -152,7 +152,8 @@ export class SubscribeComponent {
this.subscribeEvent.emit({ this.subscribeEvent.emit({
value: "ok" value: "ok"
}); });
this._emailService.sendEmail(this.properties.adminToolsAPIURL + "/notifyForNewSubscribers/" + this.communityId, Composer.composeEmailToInformManagers(this.community.title, this.communityId, this.community.managers, email)).subscribe( this._emailService.sendEmail(this.properties,
Composer.composeEmailToInformManagers(this.community.title, this.communityId, this.community.managers, email, this.properties.adminPortalURL)).subscribe(
res => { res => {
//console.log("The email has been sent successfully!") //console.log("The email has been sent successfully!")
}, },
@ -188,7 +189,7 @@ export class SubscribeComponent {
} else { } else {
this.loading = true; this.loading = true;
//this.properties.adminToolsAPIURL //this.properties.adminToolsAPIURL
this._subscribeService.unSubscribeToCommunity(this.communityId, email, this.properties.adminToolsAPIURL).subscribe( this._subscribeService.unSubscribeToCommunity(this.properties, this.communityId).subscribe(
res => { res => {
this.loading = false; this.loading = false;
if (res.status && res.status != 200) { if (res.status && res.status != 200) {

View File

@ -373,6 +373,10 @@ body.dashboard {
display: none; display: none;
} }
.dashboard .section:not(.list-view) {
border: white solid 1px;
}
.dashboard .section:not(.list-view):hover { .dashboard .section:not(.list-view):hover {
border: var(--secondary-color) solid 1px; border: var(--secondary-color) solid 1px;
} }