Merge remote-tracking branch 'origin/new-theme' into privacy-settings

This commit is contained in:
Konstantinos Triantafyllou 2022-09-19 17:15:27 +03:00
commit 5ac6847e65
2 changed files with 146 additions and 128 deletions

@ -1 +1 @@
Subproject commit b8ac4121379c5294d1201932af1ed76be34bdb84
Subproject commit 9939c2707cffbb8f2f15cfa79e80992cd58d6bdf

View File

@ -98,6 +98,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
@ViewChild('deleteNotify', {static: true}) deleteNotify: NotifyFormComponent;
public isFullscreen: boolean = false;
@HostListener('fullscreenchange', ['$event'])
@HostListener('webkitfullscreenchange', ['$event'])
@HostListener('mozfullscreenchange', ['$event'])
@ -105,6 +106,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
screenChange(event) {
this.isFullscreen = !this.isFullscreen;
}
/**
* Subscriptions
**/
@ -886,7 +888,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
NotificationHandler.rise('Indicators have been <b>imported</b> successfully!');
}, error => {
this.chartIndicatorFb = null;
NotificationHandler.rise(error.error.message, 'danger');
NotificationHandler.rise('An error has occurred. Please try again later', 'danger');
this.editing = false;
this.importLoading = false;
}));
@ -1199,6 +1201,24 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
private checkForSchemaEnhancements(url: string) {
this.showCheckForSchemaEnhancements = this.isAdministrator && url && !this.properties.useOldStatisticsSchema && this.indicatorUtils.checkForSchemaEnhancements(url);
}
migrateFromOldImportJsonFile(charts){
// first section contains numbers
// second contains charts
let hasNumbers = false;
for (let chart of charts) {
if (chart['type'] == 'number') {
hasNumbers = true;
break;
}
}
let chartsSection = (hasNumbers?1:0); // no numbers: first sections contains charts
for (let chart of charts) {
if (chart['sectionIndex'] == null) {
chart['sectionIndex'] = chart['type'] == 'chart' ? chartsSection : 0;
}
}
return charts;
}
importIndicatorsAndSave(charts: any[]) {
let sectionsToSave: Section[] = [];
@ -1206,10 +1226,8 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
// name description additionalDescription, height, width, visibility
let noValidParams = 0;
let duplicates = 0;
charts = this.migrateFromOldImportJsonFile(charts);
for (let chart of charts) {
if(!chart['sectionIndex']){
chart['sectionIndex'] = chart['type'] == 'chart'?1:0;
}
if (!sectionsToSave[chart['sectionIndex']]) {
let sectionToSave = new Section(chart['sectionType'] ? chart['sectionType'] : chart['type'], chart['sectionTitle']);
sectionToSave.indicators = [];
@ -1218,7 +1236,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
let exists = false;
let indicatorPath;
// validate indicators' schema from file
let invalid_file_message = "";
let invalid_file_message;
if (!chart.type) {
invalid_file_message = "No indicator type is specified. Type should be chart or number.";
} else if (chart.type != "chart" && chart.type != "number") {