From 714e2d927a0123aa915db159dc2576cf49af9731 Mon Sep 17 00:00:00 2001 From: jialin Date: Thu, 18 Jul 2024 18:14:03 +0800 Subject: [PATCH] fix: api key table list sort --- src/components/delete-modal/index.tsx | 31 +++++++++ src/components/drop-down-buttons/index.tsx | 42 ++++++++++-- .../seal-table/components/seal-column.tsx | 1 + .../seal-table/components/table-row.tsx | 9 ++- src/hooks/use-delete-modal.ts | 26 +++++++ src/pages/api-keys/index.tsx | 22 +++--- .../llmodels/components/instance-item.tsx | 9 ++- src/pages/llmodels/components/table-list.tsx | 67 ++++++++++++------- src/pages/resources/components/workers.tsx | 16 ++--- src/pages/users/index.tsx | 26 +++---- 10 files changed, 177 insertions(+), 72 deletions(-) create mode 100644 src/components/delete-modal/index.tsx create mode 100644 src/hooks/use-delete-modal.ts diff --git a/src/components/delete-modal/index.tsx b/src/components/delete-modal/index.tsx new file mode 100644 index 00000000..d6f5fd08 --- /dev/null +++ b/src/components/delete-modal/index.tsx @@ -0,0 +1,31 @@ +import ModalFooter from '@/components/modal-footer'; +import { useIntl } from '@umijs/max'; +import { Modal, type ModalFuncProps } from 'antd'; +import { forwardRef } from 'react'; + +const DeleteModal: React.FC = forwardRef((props, ref) => { + const intl = useIntl(); + const { title, open, onOk, onCancel, content } = props; + + return ( + } + > + {content} + + ); +}); + +export default DeleteModal; diff --git a/src/components/drop-down-buttons/index.tsx b/src/components/drop-down-buttons/index.tsx index 775fe9d4..582686aa 100644 --- a/src/components/drop-down-buttons/index.tsx +++ b/src/components/drop-down-buttons/index.tsx @@ -1,4 +1,5 @@ import { MoreOutlined } from '@ant-design/icons'; +import { useIntl } from '@umijs/max'; import { Button, Dropdown, Tooltip, type MenuProps } from 'antd'; import _ from 'lodash'; import { memo, useCallback } from 'react'; @@ -14,6 +15,7 @@ const DropdownButtons: React.FC = ({ size = 'small', onSelect }) => { + const intl = useIntl(); const handleMenuClick = useCallback((item: any) => { console.log('menu click', item.key); const selectItem = _.find(items, { key: item.key }); @@ -32,22 +34,52 @@ const DropdownButtons: React.FC = ({ return ( <> {items?.length === 1 ? ( - + ) : ( { + return ( +
+ {_.map(_.tail(items), (item: any) => { + return ( + + ); + })} +
+ ); }} buttonsRender={([leftButton, rightButton]) => [ - +