diff --git a/src/app/diagram/diagram.component.ts b/src/app/diagram/diagram.component.ts index 0ad7050..7af3a44 100644 --- a/src/app/diagram/diagram.component.ts +++ b/src/app/diagram/diagram.component.ts @@ -1,6 +1,5 @@ import { formatDate } from '@angular/common'; import { HttpErrorResponse } from '@angular/common/http'; -import { stringify } from '@angular/compiler/src/util'; import { AfterViewInit, Component, ElementRef, EventEmitter, Input, NgZone, OnChanges, Output, SimpleChanges, ViewChild } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import BpmnModeler from 'bpmn-js/lib/Modeler'; @@ -67,7 +66,6 @@ export class DiagramComponent implements ControlValueAccessor, AfterViewInit, On } ngOnChanges(changes: SimpleChanges) { - // ? I feel like there's better ways to handle the changes to a single attribute but I didn't want to mess around with getters and setters since this class already had some if (changes.validation_data) { this.validation_data = changes.validation_data.currentValue; if (this.modeler) { @@ -219,13 +217,13 @@ export class DiagramComponent implements ControlValueAccessor, AfterViewInit, On }); } }); - var eventBus = this.modeler.get('eventBus'); + const eventBus = this.modeler.get('eventBus'); eventBus.on('editor.scripts.request', () => { this.api.listScripts().subscribe((data) => { - data.forEach(element => {element.name = CameltoSnakeCase(element.name);}); + data.forEach(element => {element.name = CameltoSnakeCase(element.name); }); this.modeler.get('eventBus').fire('editor.scripts.response', { scripts: data }); - }) + }); }); eventBus.on('editor.validate.request', (request) => { diff --git a/src/app/modeler/modeler.component.ts b/src/app/modeler/modeler.component.ts index efe6247..8ac5214 100644 --- a/src/app/modeler/modeler.component.ts +++ b/src/app/modeler/modeler.component.ts @@ -201,17 +201,17 @@ export class ModelerComponent implements AfterViewInit { this.saveChanges(); this.api.validateWorkflowSpecification(this.diagramFileMeta.workflow_spec_id, until_task).subscribe(apiErrors => { this.validationState = true; - this.validationData = { "required_only": undefined, "all_fields": undefined } - if (apiErrors && apiErrors.length == 2) { - if (apiErrors[0].code == "validation_break") { - this.validationData["all_fields"] = apiErrors[0].task_data; + this.validationData = { 'required_only': undefined, 'all_fields': undefined }; + if (apiErrors && apiErrors.length === 2) { + if (apiErrors[0].code === 'validation_break') { + this.validationData['all_fields'] = apiErrors[0].task_data; } else { this.validationState = false; } - if (apiErrors[1].code == "validation_break") { - this.validationData["required_only"] = apiErrors[1].task_data; + if (apiErrors[1].code === 'validation_break') { + this.validationData['required_only'] = apiErrors[1].task_data; } else { this.validationState = false; } } else { this.validationState = false; } - if (this.validationState == false) { + if (this.validationState === false) { this.bottomSheet.open(ApiErrorsComponent, { data: { apiErrors: apiErrors } }); } });