From d8da94c233d072cca260ff29a01af55ce1996922 Mon Sep 17 00:00:00 2001 From: Kevin Burnett <18027+burnettk@users.noreply.github.com> Date: Fri, 3 May 2024 17:32:57 +0000 Subject: [PATCH 1/2] allowing switch form to MUI using ui:theme mui in the ui schema (#1482) Co-authored-by: burnettk --- .../src/components/CustomForm.tsx | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/spiffworkflow-frontend/src/components/CustomForm.tsx b/spiffworkflow-frontend/src/components/CustomForm.tsx index ea115e6ad..db04738dc 100644 --- a/spiffworkflow-frontend/src/components/CustomForm.tsx +++ b/spiffworkflow-frontend/src/components/CustomForm.tsx @@ -59,6 +59,20 @@ export default function CustomForm({ 'numeric-range': NumericRangeField, }; + let reactJsonSchemaFormTheme = reactJsonSchemaForm; + if ('ui:theme' in uiSchema) { + if (uiSchema['ui:theme'] === 'carbon') { + reactJsonSchemaFormTheme = 'carbon'; + } else if (uiSchema['ui:theme'] === 'mui') { + reactJsonSchemaFormTheme = 'mui'; + } else { + console.error( + `Unsupported theme: ${uiSchema['ui:theme']}. Defaulting to mui` + ); + reactJsonSchemaFormTheme = 'mui'; + } + } + const rjsfTemplates: any = {}; if (restrictedWidth) { rjsfTemplates.ObjectFieldTemplate = ObjectFieldRestrictedGridTemplate; @@ -475,16 +489,16 @@ export default function CustomForm({ templates: rjsfTemplates, omitExtraData: true, }; - if (reactJsonSchemaForm === 'carbon') { + if (reactJsonSchemaFormTheme === 'carbon') { // eslint-disable-next-line react/jsx-props-no-spreading return {childrenToUse}; } - if (reactJsonSchemaForm === 'mui') { + if (reactJsonSchemaFormTheme === 'mui') { // eslint-disable-next-line react/jsx-props-no-spreading return {childrenToUse}; } - console.error(`Unsupported form type: ${reactJsonSchemaForm}`); + console.error(`Unsupported form type: ${reactJsonSchemaFormTheme}`); return null; } From d7f002643321e1cb06d4bfe95910e854370ba44d Mon Sep 17 00:00:00 2001 From: burnettk Date: Fri, 3 May 2024 13:50:42 -0400 Subject: [PATCH 2/2] add jq to backend deployment image --- spiffworkflow-backend/Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spiffworkflow-backend/Dockerfile b/spiffworkflow-backend/Dockerfile index fec358033..99cba25d2 100644 --- a/spiffworkflow-backend/Dockerfile +++ b/spiffworkflow-backend/Dockerfile @@ -20,10 +20,11 @@ FROM base AS deployment # gunicorn3 for web server # default-mysql-client for convenience accessing mysql docker container # vim ftw +# jq because it is really useful, even for scenarios where people might have environment variables with json values they might need to use for configs. about 1MB. RUN apt-get update \ - && apt-get clean -y \ - && apt-get install -y -q git-core curl procps gunicorn3 default-mysql-client vim-tiny \ - && rm -rf /var/lib/apt/lists/* + && apt-get clean -y \ + && apt-get install -y -q git-core curl procps gunicorn3 default-mysql-client vim-tiny jq \ + && rm -rf /var/lib/apt/lists/* # keep pip up to date RUN pip install --upgrade pip @@ -45,7 +46,7 @@ RUN useradd _gunicorn --no-create-home --user-group # default-libmysqlclient-dev for mysqlclient lib RUN apt-get update \ - && apt-get install -y -q gcc libssl-dev libpq-dev default-libmysqlclient-dev pkg-config libffi-dev + && apt-get install -y -q gcc libssl-dev libpq-dev default-libmysqlclient-dev pkg-config libffi-dev # poetry install takes a long time and can be cached if dependencies don't change, # so that's why we tolerate running it twice.