diff --git a/ui/src/app/form/component/fields/FilterTargetField.js b/ui/src/app/form/component/fields/FilterTargetField.js index bad90052e..2bfd8484d 100644 --- a/ui/src/app/form/component/fields/FilterTargetField.js +++ b/ui/src/app/form/component/fields/FilterTargetField.js @@ -74,7 +74,7 @@ const FilterTargetField = ({ /*eslint-disable react-hooks/exhaustive-deps*/ React.useEffect(() => { - if (term && term.length >= 4) { + if (term?.length >= 4) { searchIds(term); } }, [term]); diff --git a/ui/src/app/form/component/templates/FieldTemplate.js b/ui/src/app/form/component/templates/FieldTemplate.js index 1e2b8f7eb..1203d543a 100644 --- a/ui/src/app/form/component/templates/FieldTemplate.js +++ b/ui/src/app/form/component/templates/FieldTemplate.js @@ -24,8 +24,8 @@ export function FieldTemplate ({ {children}
- {rawHelp && rawErrors.length < 1 && ( - 0 ? "text-danger" : "text-muted"} id={id}> + {rawHelp && rawErrors?.length < 1 && ( + 0 ? "text-danger" : "text-muted"} id={id}> )} diff --git a/ui/src/app/form/component/widgets/OptionWidget.js b/ui/src/app/form/component/widgets/OptionWidget.js index 88648c0c5..142941dd3 100644 --- a/ui/src/app/form/component/widgets/OptionWidget.js +++ b/ui/src/app/form/component/widgets/OptionWidget.js @@ -90,7 +90,7 @@ const OptionWidget = ({ return ( - 0) ? "text-danger" : ""}`}> + 0) ? "text-danger" : ""}`}> {(label || schema.title) && required ? : null} @@ -104,7 +104,7 @@ const OptionWidget = ({ onChange={ _onChange } allowNew={true} multiple={false} - className={`toggle-typeahead ${rawErrors.length > 0 ? "is-invalid" : ""}`} + className={`toggle-typeahead ${rawErrors?.length > 0 ? "is-invalid" : ""}`} options={opts} placeholder={uiSchema['ui:placeholder'] ? translator(uiSchema['ui:placeholder'] ): ''} disabled={disabled || readonly} @@ -122,7 +122,7 @@ const OptionWidget = ({ toggleMenu()} disabled={disabled || readonly} /> )} - {rawErrors.length > 0 && touched && ( + {rawErrors?.length > 0 && touched && ( {rawErrors.map((error, i) => { return ( diff --git a/ui/src/app/form/component/widgets/SelectWidget.js b/ui/src/app/form/component/widgets/SelectWidget.js index 9a2cd421c..76dc99ec6 100644 --- a/ui/src/app/form/component/widgets/SelectWidget.js +++ b/ui/src/app/form/component/widgets/SelectWidget.js @@ -86,7 +86,7 @@ const SelectWidget = ({ return ( - 0 ? "text-danger" : ""}`}> + 0 ? "text-danger" : ""}`}> {(label || schema.title) && required ? : null} @@ -103,7 +103,7 @@ const SelectWidget = ({ disabled={disabled} readOnly={readonly} autoFocus={autofocus} - className={touched && rawErrors.length > 0 ? "is-invalid" : ""} + className={touched && rawErrors?.length > 0 ? "is-invalid" : ""} onBlur={ onBlur && ((event) => { @@ -132,7 +132,7 @@ const SelectWidget = ({ )} - {rawErrors.length > 0 && touched && ( + {rawErrors?.length > 0 && touched && ( {rawErrors.map((error, i) => { return ( diff --git a/ui/src/app/form/component/widgets/TextWidget.js b/ui/src/app/form/component/widgets/TextWidget.js index 08343905f..8554be911 100644 --- a/ui/src/app/form/component/widgets/TextWidget.js +++ b/ui/src/app/form/component/widgets/TextWidget.js @@ -38,10 +38,10 @@ const TextWidget = ({ _onBlur(evt); }; - // const classNames = [rawErrors.length > 0 ? "is-invalid" : "", type === 'file' ? 'custom-file-label': ""] + // const classNames = [rawErrors?.length > 0 ? "is-invalid" : "", type === 'file' ? 'custom-file-label': ""] return ( - 0 && touched ? "text-danger" : ""}`}> + 0 && touched ? "text-danger" : ""}`}> {(label || schema.title) && required ? @@ -56,7 +56,7 @@ const TextWidget = ({ required={required} disabled={disabled} readOnly={readonly} - className={rawErrors.length > 0 && touched ? "is-invalid" : ""} + className={rawErrors?.length > 0 && touched ? "is-invalid" : ""} list={schema.examples ? `examples_${id}` : undefined} type={inputType} value={value || value === 0 ? value : ""} @@ -73,7 +73,7 @@ const TextWidget = ({ })} ) : null} - {rawErrors.length > 0 && touched && ( + {rawErrors?.length > 0 && touched && ( {rawErrors.map((error, i) => { return ( diff --git a/ui/src/app/form/component/widgets/TextareaWidget.js b/ui/src/app/form/component/widgets/TextareaWidget.js index 9afdace93..4dad923ef 100644 --- a/ui/src/app/form/component/widgets/TextareaWidget.js +++ b/ui/src/app/form/component/widgets/TextareaWidget.js @@ -46,7 +46,7 @@ const TextareaWidget = ({ return ( <> - 0 ? "text-danger" : ""}`}> + 0 ? "text-danger" : ""}`}> {(label || schema.title) && required ? : null} @@ -69,7 +69,7 @@ const TextareaWidget = ({ onFocus={_onFocus} /> - {rawErrors.length > 0 && touched && ( + {rawErrors?.length > 0 && touched && ( {rawErrors.map((error, i) => { return ( diff --git a/ui/src/app/form/component/widgets/UpDownWidget.js b/ui/src/app/form/component/widgets/UpDownWidget.js index 4394a070f..9a6941852 100644 --- a/ui/src/app/form/component/widgets/UpDownWidget.js +++ b/ui/src/app/form/component/widgets/UpDownWidget.js @@ -66,7 +66,7 @@ const UpDownWidget = ({ onBlur={onCustomBlur} onFocus={_onFocus} /> - {rawErrors.length > 0 && touched && ( + {rawErrors?.length > 0 && touched && ( {rawErrors.map((error, i) => { return ( diff --git a/ui/src/app/metadata/domain/provider/index.js b/ui/src/app/metadata/domain/provider/index.js index 9665e84ad..05c0e057d 100644 --- a/ui/src/app/metadata/domain/provider/index.js +++ b/ui/src/app/metadata/domain/provider/index.js @@ -19,6 +19,5 @@ export const MetadataProviderEditorTypes = [ export const FilterableProviders = [ FileBackedHttpMetadataProviderEditor.type, - DynamicHttpMetadataProviderEditor.type, - LocalDynamicMetadataProviderEditor.type + DynamicHttpMetadataProviderEditor.type ]; diff --git a/ui/src/app/metadata/view/MetadataOptions.js b/ui/src/app/metadata/view/MetadataOptions.js index e592731e6..93011229a 100644 --- a/ui/src/app/metadata/view/MetadataOptions.js +++ b/ui/src/app/metadata/view/MetadataOptions.js @@ -19,6 +19,7 @@ import { MetadataFilters } from '../domain/filter/component/MetadataFilters'; import { MetadataFilterConfigurationList } from '../domain/filter/component/MetadataFilterConfigurationList'; import { MetadataFilterTypes } from '../domain/filter'; import { useMetadataSchema } from '../hooks/schema'; +import { FilterableProviders } from '../domain/provider'; export function MetadataOptions () { @@ -46,6 +47,8 @@ export function MetadataOptions () { history.push(`/metadata/${type}/${id}/edit/${section}`); } + const canFilter = FilterableProviders.indexOf(definition.type) > -1; + return ( {(onDeleteSource) => @@ -73,7 +76,7 @@ export function MetadataOptions () {   Version History - {type === 'provider' && + {type === 'provider' && canFilter &&
edit(section) } /> -
- {type === 'provider' && - <> -
-

- Filters -

-
- -   - Add Filter - -
+ {type === 'provider' && canFilter && +
+
+

+ Filters +

+
+ +   + Add Filter +
- - {(filters, onUpdate, onDelete, loading) => - } - - - } -
+
+ + {(filters, onUpdate, onDelete, loading) => + } + +
+ }