feat: filter form for table

This commit is contained in:
jialin
2026-02-10 10:25:02 +08:00
parent 90e212a1b2
commit ba11689029
3 changed files with 68 additions and 11 deletions
+3 -2
View File
@@ -59,6 +59,7 @@ import {
ModelInstanceListItem,
SourceType
} from '../config/types';
import Filters from '../filters';
import useEditDeployment from '../hooks/use-edit-deployment';
import useFilterStatus from '../hooks/use-filter-status';
import useFormInitialValues from '../hooks/use-form-initial-values';
@@ -649,7 +650,7 @@ const Models: React.FC<ModelsProps> = ({
options={statusOptions}
onChange={handleStatusChange}
></BaseSelect>
{/* <Filters
<Filters
initialValues={{
cluster_id: undefined,
state: undefined,
@@ -657,7 +658,7 @@ const Models: React.FC<ModelsProps> = ({
}}
clusterList={clusterList}
onValuesChange={onFilterChange}
></Filters> */}
></Filters>
<Button
type="text"
style={{ color: 'var(--ant-color-text-tertiary)' }}
+1 -4
View File
@@ -2,7 +2,6 @@ import BaseSelect from '@/components/seal-form/base/select';
import FilterForm from '@/pages/_components/filter-form';
import { useIntl } from '@umijs/max';
import { Form } from 'antd';
import _ from 'lodash';
import styled from 'styled-components';
import { modelCategories } from '../config';
import useFilterStatus from '../hooks/use-filter-status';
@@ -25,12 +24,10 @@ const FilterFormContent: React.FC<FilterFormContentProps> = ({
onValuesChange
}) => {
const intl = useIntl();
const form = Form.useFormInstance();
const { labelRender, optionRender, statusOptions } = useFilterStatus();
const handleOnValuesChange = (changedValues: any, allValues: any) => {
const query = _.pickBy(allValues, (value: any) => !!value);
onValuesChange?.(query);
onValuesChange?.(allValues);
};
return (