From 49950b163967f776ec065cf1bbb4215afab10b49 Mon Sep 17 00:00:00 2001 From: jasquat <2487833+jasquat@users.noreply.github.com> Date: Wed, 7 Jun 2023 12:55:32 -0400 Subject: [PATCH] support validationErrorMessage in rjsf enum w/ burnettk (#311) Co-authored-by: jasquat --- .../services/process_instance_processor.py | 2 ++ .../src/rjsf/carbon_theme/SelectWidget/SelectWidget.tsx | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py index 00a1e46a..d5b7de21 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py @@ -1,6 +1,7 @@ # TODO: clean up this service for a clear distinction between it and the process_instance_service # where this points to the pi service import decimal +import uuid import json import logging import os @@ -277,6 +278,7 @@ class CustomBpmnScriptEngine(PythonScriptEngine): # type: ignore "sum": sum, "time": time, "timedelta": timedelta, + "uuid": uuid, } use_restricted_script_engine = True diff --git a/spiffworkflow-frontend/src/rjsf/carbon_theme/SelectWidget/SelectWidget.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/SelectWidget/SelectWidget.tsx index 436b301e..f61d509c 100644 --- a/spiffworkflow-frontend/src/rjsf/carbon_theme/SelectWidget/SelectWidget.tsx +++ b/spiffworkflow-frontend/src/rjsf/carbon_theme/SelectWidget/SelectWidget.tsx @@ -53,8 +53,11 @@ function SelectWidget({ let errorMessageForField = null; if (rawErrors && rawErrors.length > 0) { invalid = true; - // errorMessageForField = `${labelToUse.replace(/\*$/, '')} ${rawErrors[0]}`; - errorMessageForField = rawErrors[0]; + if ('validationErrorMessage' in schema) { + errorMessageForField = (schema as any).validationErrorMessage; + } else { + errorMessageForField = rawErrors[0]; + } } // ok. so in safari, the select widget showed the first option, whereas in chrome it forced you to select an option.