Merge branch 'main' of github.com:sartography/spiff-arena

This commit is contained in:
jasquat 2024-05-03 14:57:39 -04:00
commit e085c90114
No known key found for this signature in database
2 changed files with 22 additions and 7 deletions

View File

@ -20,10 +20,11 @@ FROM base AS deployment
# gunicorn3 for web server # gunicorn3 for web server
# default-mysql-client for convenience accessing mysql docker container # default-mysql-client for convenience accessing mysql docker container
# vim ftw # 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 \ RUN apt-get update \
&& apt-get clean -y \ && apt-get clean -y \
&& apt-get install -y -q git-core curl procps gunicorn3 default-mysql-client vim-tiny \ && apt-get install -y -q git-core curl procps gunicorn3 default-mysql-client vim-tiny jq \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# keep pip up to date # keep pip up to date
RUN pip install --upgrade pip RUN pip install --upgrade pip
@ -45,7 +46,7 @@ RUN useradd _gunicorn --no-create-home --user-group
# default-libmysqlclient-dev for mysqlclient lib # default-libmysqlclient-dev for mysqlclient lib
RUN apt-get update \ 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, # poetry install takes a long time and can be cached if dependencies don't change,
# so that's why we tolerate running it twice. # so that's why we tolerate running it twice.

View File

@ -59,6 +59,20 @@ export default function CustomForm({
'numeric-range': NumericRangeField, '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 = {}; const rjsfTemplates: any = {};
if (restrictedWidth) { if (restrictedWidth) {
rjsfTemplates.ObjectFieldTemplate = ObjectFieldRestrictedGridTemplate; rjsfTemplates.ObjectFieldTemplate = ObjectFieldRestrictedGridTemplate;
@ -475,16 +489,16 @@ export default function CustomForm({
templates: rjsfTemplates, templates: rjsfTemplates,
omitExtraData: true, omitExtraData: true,
}; };
if (reactJsonSchemaForm === 'carbon') { if (reactJsonSchemaFormTheme === 'carbon') {
// eslint-disable-next-line react/jsx-props-no-spreading // eslint-disable-next-line react/jsx-props-no-spreading
return <CarbonForm {...formProps}>{childrenToUse}</CarbonForm>; return <CarbonForm {...formProps}>{childrenToUse}</CarbonForm>;
} }
if (reactJsonSchemaForm === 'mui') { if (reactJsonSchemaFormTheme === 'mui') {
// eslint-disable-next-line react/jsx-props-no-spreading // eslint-disable-next-line react/jsx-props-no-spreading
return <MuiForm {...formProps}>{childrenToUse}</MuiForm>; return <MuiForm {...formProps}>{childrenToUse}</MuiForm>;
} }
console.error(`Unsupported form type: ${reactJsonSchemaForm}`); console.error(`Unsupported form type: ${reactJsonSchemaFormTheme}`);
return null; return null;
} }