From 873dca1125b1bea756b16c2d0091c5876db9e270 Mon Sep 17 00:00:00 2001 From: alicia pritchett Date: Mon, 18 Oct 2021 15:19:33 -0400 Subject: [PATCH] Fixes #497 - Fix workflow spec/category name validation --- .../workflow-spec-dialog.component.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/_dialogs/workflow-spec-dialog/workflow-spec-dialog.component.ts b/src/app/_dialogs/workflow-spec-dialog/workflow-spec-dialog.component.ts index 0efd46b..b4efe08 100644 --- a/src/app/_dialogs/workflow-spec-dialog/workflow-spec-dialog.component.ts +++ b/src/app/_dialogs/workflow-spec-dialog/workflow-spec-dialog.component.ts @@ -3,10 +3,8 @@ import {FormControl, FormGroup, ValidationErrors} from '@angular/forms'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; import {FormlyFieldConfig, FormlyFormOptions, FormlyTemplateOptions} from '@ngx-formly/core'; import {ApiService, toSnakeCase} from 'sartography-workflow-lib'; -import {v4 as uuidv4} from 'uuid'; import {WorkflowSpecDialogData} from '../../_interfaces/dialog-data'; import {of} from "rxjs"; -import {updateValidity} from "@ngx-formly/core/lib/extensions/field-form/utils"; @Component({ selector: 'app-workflow-spec-dialog', @@ -75,15 +73,18 @@ export class WorkflowSpecDialogComponent { expressionProperties: { 'model.id': (m, formState, field) => { if (!m.id && field.focus) { - // field.formControl.markAsDirty(); m.id = m.display_name.replace(/ /g,"_").toLowerCase(); - // field.formControl.setErrors(null); - // field.formControl.updateValueAndValidity(); + field.formControl.markAsDirty(); return m.id; } else { return m.id; } }, + 'templateOptions.change': (m, formState, field)=> { + if (field.focus) { + field.formControl.updateValueAndValidity(); + } + }, }, asyncValidators: { uniqueID: {