Quick fix for import indicators

This commit is contained in:
Konstantinos Triantafyllou 2022-09-19 14:42:59 +03:00
parent 4ed0890bb9
commit 9b494fcf5a
1 changed files with 130 additions and 127 deletions

View File

@ -98,6 +98,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
@ViewChild('deleteNotify', {static: true}) deleteNotify: NotifyFormComponent; @ViewChild('deleteNotify', {static: true}) deleteNotify: NotifyFormComponent;
public isFullscreen: boolean = false; public isFullscreen: boolean = false;
@HostListener('fullscreenchange', ['$event']) @HostListener('fullscreenchange', ['$event'])
@HostListener('webkitfullscreenchange', ['$event']) @HostListener('webkitfullscreenchange', ['$event'])
@HostListener('mozfullscreenchange', ['$event']) @HostListener('mozfullscreenchange', ['$event'])
@ -105,6 +106,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
screenChange(event) { screenChange(event) {
this.isFullscreen = !this.isFullscreen; this.isFullscreen = !this.isFullscreen;
} }
/** /**
* Subscriptions * Subscriptions
**/ **/
@ -886,7 +888,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
NotificationHandler.rise('Indicators have been <b>imported</b> successfully!'); NotificationHandler.rise('Indicators have been <b>imported</b> successfully!');
}, error => { }, error => {
this.chartIndicatorFb = null; this.chartIndicatorFb = null;
NotificationHandler.rise(error.error.message, 'danger'); NotificationHandler.rise('An error has occurred. Please try again later', 'danger');
this.editing = false; this.editing = false;
this.importLoading = false; this.importLoading = false;
})); }));
@ -1218,7 +1220,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
let exists = false; let exists = false;
let indicatorPath; let indicatorPath;
// validate indicators' schema from file // validate indicators' schema from file
let invalid_file_message = ""; let invalid_file_message;
if (!chart.type) { if (!chart.type) {
invalid_file_message = "No indicator type is specified. Type should be chart or number."; invalid_file_message = "No indicator type is specified. Type should be chart or number.";
} else if (chart.type != "chart" && chart.type != "number") { } else if (chart.type != "chart" && chart.type != "number") {
@ -1295,6 +1297,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
this.editing = false; this.editing = false;
this.importLoading = false; this.importLoading = false;
} else if (sectionsToSave.length > 0 && countIndicators > 0) { } else if (sectionsToSave.length > 0 && countIndicators > 0) {
sectionsToSave = sectionsToSave.filter(section => !!section);
this.saveIndicators(sectionsToSave) this.saveIndicators(sectionsToSave)
} }
if (sectionsToSave.length == 0 || countIndicators == 0) { if (sectionsToSave.length == 0 || countIndicators == 0) {