diff --git a/src/components/editor/Bindings/Filters/index.tsx b/src/components/editor/Bindings/Filters/index.tsx index 8f035126d..c0070d4a3 100644 --- a/src/components/editor/Bindings/Filters/index.tsx +++ b/src/components/editor/Bindings/Filters/index.tsx @@ -8,6 +8,7 @@ import defaultRenderers from 'services/jsonforms/defaultRenderers'; import { defaultOptions, showValidation } from 'services/jsonforms/shared'; import { useResourceConfig_fullSourceOfCollectionProperty, + useResourceConfig_updateFullSourceErrors, useResourceConfig_updateFullSourceProperty, } from 'stores/ResourceConfig/hooks'; @@ -23,6 +24,7 @@ function Filters({ collectionName }: Props) { const updateFullSourceProperty = useResourceConfig_updateFullSourceProperty(); + const updateFullSourceErrors = useResourceConfig_updateFullSourceErrors(); const notBefore = useResourceConfig_fullSourceOfCollectionProperty( collectionName, @@ -112,6 +114,10 @@ function Filters({ collectionName }: Props) { 'notAfter', state.data.notAfter ); + updateFullSourceErrors( + collectionName, + state.errors + ); }} /> diff --git a/src/lang/en-US.ts b/src/lang/en-US.ts index 1a2dd3b03..ae96623de 100644 --- a/src/lang/en-US.ts +++ b/src/lang/en-US.ts @@ -662,6 +662,7 @@ const EntityCreate: ResolvedIntlConfig['messages'] = { 'entityCreate.endpointConfig.endpointConfigMissing': `${endpointConfigHeader} empty`, 'entityCreate.endpointConfig.collectionsMissing': `${CommonMessages['terms.collections']} missing`, 'entityCreate.endpointConfig.resourceConfigInvalid': `Resource Config invalid`, + 'entityCreate.endpointConfig.timeTravelInvalid': `Time Travel invalid`, 'entityCreate.endpointConfig.configCanBeBlank.message': `This {entityType} requires no configuration.`, diff --git a/src/stores/ResourceConfig/Store.ts b/src/stores/ResourceConfig/Store.ts index 2a19b7c58..e98dc3617 100644 --- a/src/stores/ResourceConfig/Store.ts +++ b/src/stores/ResourceConfig/Store.ts @@ -78,12 +78,17 @@ const populateResourceConfigErrors = ( if (hasConfigs) { map(resourceConfig, (config) => { - const { errors } = config; + const { errors, fullSourceErrors } = config; // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if (errors && errors.length > 0) { resourceConfigErrors = resourceConfigErrors.concat(errors); } + + if (fullSourceErrors && fullSourceErrors.length > 0) { + resourceConfigErrors = + resourceConfigErrors.concat(fullSourceErrors); + } }); } else { // TODO (errors) Need to populate this object with something? @@ -442,6 +447,20 @@ const getInitialState = ( ); }, + updateFullSourceErrors: (collectionName, errors) => { + set( + produce((state: ResourceConfigState) => { + const configToUpdate = state.resourceConfig[collectionName]; + + configToUpdate.fullSourceErrors = errors; + + populateResourceConfigErrors(state.resourceConfig, state); + }), + false, + 'Updating Full Source Error' + ); + }, + setResourceConfig: (key, value, disableCheckingErrors, disableOmit) => { set( produce((state: ResourceConfigState) => { diff --git a/src/stores/ResourceConfig/hooks.ts b/src/stores/ResourceConfig/hooks.ts index 33767262c..92cf672f6 100644 --- a/src/stores/ResourceConfig/hooks.ts +++ b/src/stores/ResourceConfig/hooks.ts @@ -190,6 +190,16 @@ export const useResourceConfig_updateFullSourceProperty = () => { ); }; +export const useResourceConfig_updateFullSourceErrors = () => { + return useZustandStore< + ResourceConfigState, + ResourceConfigState['updateFullSourceErrors'] + >( + ResourceConfigStoreNames.GENERAL, + (state) => state.updateFullSourceErrors + ); +}; + export const useResourceConfig_resetResourceConfigAndCollections = () => { return useZustandStore< ResourceConfigState, diff --git a/src/stores/ResourceConfig/types.ts b/src/stores/ResourceConfig/types.ts index 4122308e8..7a01441ec 100644 --- a/src/stores/ResourceConfig/types.ts +++ b/src/stores/ResourceConfig/types.ts @@ -16,6 +16,7 @@ export interface ResourceConfig extends JsonFormsData { errors: any[]; disable?: boolean; fullSource?: FullSource; + fullSourceErrors?: any[]; } export interface ResourceConfigDictionary { @@ -74,6 +75,7 @@ export interface ResourceConfigState { key: string, value: FilterProperties | null ) => void; + updateFullSourceErrors: (collection: string, errors?: any[]) => void; // Resource Schema resourceSchema: Schema;