Feat: Allows users to search for models in the model selection drop-down box #3221 (#6708)

### What problem does this PR solve?

Feat: Allows users to search for models in the model selection drop-down
box #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-04-01 11:53:48 +08:00
committed by GitHub
parent fc21dd0a4a
commit d0dca16fee
4 changed files with 40 additions and 11 deletions

View File

@ -13,6 +13,7 @@ interface IProps {
items?: MenuProps['items'];
height?: number;
needsDeletionValidation?: boolean;
showDeleteItems?: boolean;
}
const OperateDropdown = ({
@ -23,6 +24,7 @@ const OperateDropdown = ({
items: otherItems = [],
height = 24,
needsDeletionValidation = true,
showDeleteItems = true,
}: React.PropsWithChildren<IProps>) => {
const { t } = useTranslation();
const showDeleteConfirm = useShowDeleteConfirm();
@ -44,8 +46,10 @@ const OperateDropdown = ({
};
const items: MenuProps['items'] = useMemo(() => {
return [
{
const items = [];
if (showDeleteItems) {
items.push({
key: '1',
label: (
<Space>
@ -53,10 +57,11 @@ const OperateDropdown = ({
<DeleteOutlined />
</Space>
),
},
...otherItems,
];
}, [t, otherItems]);
});
}
return [...items, ...otherItems];
}, [showDeleteItems, otherItems, t]);
return (
<Dropdown