diff --git a/src/pages/_components/filter-form.tsx b/src/pages/_components/filter-form.tsx
index 9c2c233b..63a64388 100644
--- a/src/pages/_components/filter-form.tsx
+++ b/src/pages/_components/filter-form.tsx
@@ -1,7 +1,7 @@
import OverlayScroller from '@/components/overlay-scroller';
-import { FilterOutlined } from '@ant-design/icons';
+import { CloseCircleFilled, FilterOutlined } from '@ant-design/icons';
import { useIntl } from '@umijs/max';
-import { Button, Form, Popover } from 'antd';
+import { Badge, Button, Form, Popover } from 'antd';
import React, { useState } from 'react';
import styled from 'styled-components';
@@ -26,6 +26,36 @@ const Container = styled.div`
}
`;
+const ButtonWrapper = styled.div`
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ position: relative;
+ .badge {
+ position: absolute;
+ top: 4px;
+ right: 4px;
+ }
+ .close-btn {
+ position: absolute;
+ display: none;
+ top: -4px;
+ right: -4px;
+ font-size: 12px;
+ border-radius: 50%;
+ color: var(--ant-color-text-quaternary);
+ background-color: var(--ant-color-bg-container);
+ &:hover {
+ color: var(--ant-color-text-tertiary);
+ }
+ }
+ &:hover {
+ .close-btn {
+ display: block;
+ }
+ }
+`;
+
const FilterForm: React.FC<
React.PropsWithChildren & {
width?: number;
@@ -40,12 +70,12 @@ const FilterForm: React.FC<
width = 300,
contentHeight = 400,
initialValues = {},
- hasFilters = false,
onClose,
onValuesChange
}) => {
const intl = useIntl();
const [open, setOpen] = useState(false);
+ const [hasFilters, setHasFilters] = useState(false);
const [form] = Form.useForm();
const handleToggle = () => {
@@ -60,6 +90,7 @@ const FilterForm: React.FC<
form.resetFields(Object.keys(initialValues));
onValuesChange?.({}, initialValues);
setOpen(false);
+ setHasFilters(false);
};
const handleOnClose = () => {
@@ -67,6 +98,14 @@ const FilterForm: React.FC<
onClose?.();
};
+ const handleOnValuesChange = (changedValues: any, allValues: any) => {
+ onValuesChange?.(changedValues, allValues);
+ const hasActiveFilters = Object.values(allValues).some(
+ (value) => value !== undefined && value !== null && value !== ''
+ );
+ setHasFilters(hasActiveFilters);
+ };
+
return (
);
};
diff --git a/src/pages/llmodels/components/table-list.tsx b/src/pages/llmodels/components/table-list.tsx
index 68b17032..87230a50 100644
--- a/src/pages/llmodels/components/table-list.tsx
+++ b/src/pages/llmodels/components/table-list.tsx
@@ -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 = ({
options={statusOptions}
onChange={handleStatusChange}
>
- {/* = ({
}}
clusterList={clusterList}
onValuesChange={onFilterChange}
- > */}
+ >