diff --git a/web/html/src/components/table/SelectSearchField.tsx b/web/html/src/components/table/SelectSearchField.tsx new file mode 100644 index 000000000000..0f7ee9f6c4f3 --- /dev/null +++ b/web/html/src/components/table/SelectSearchField.tsx @@ -0,0 +1,26 @@ +import { useState } from "react"; + +import { Select } from "components/input"; + +const ALL_OPTION = { value: "ALL", label: t("All") }; + +export const SelectSearchField = (props) => { + const [searchValue, setSearchValue] = useState(props.criteria || ""); + + const handleSearchValueChange = (value) => { + setSearchValue(value); + props.onSearch?.(value === ALL_OPTION.value ? "" : value); + }; + + const options = [ALL_OPTION].concat(props.options); + + return ( + props.onSearch?.(e.target.value)} + name={props.name} + /> + + ); +}; + export const SystemsListFilter = (props) => { - return ; + // Dummy model and onChange to reuse the Select component as it requires a Form + let model = {}; + const onChange = () => {}; + + const [filterValue, setFilterValue] = useState(props.field || ""); + const handleChangeSearchField = (value) => { + setFilterValue(value); + props.onSearchField?.(value); + }; + + return ( +
+
+