diff --git a/src/components/delete-modal/index.less b/src/components/delete-modal/index.less deleted file mode 100644 index c6969d0b..00000000 --- a/src/components/delete-modal/index.less +++ /dev/null @@ -1,22 +0,0 @@ -:local(.delete-modal-content) { - display: flex; - font-size: var(--font-size-middle); - - :global { - .anticon { - font-size: 20px; - margin-right: 10px; - color: var(--ant-color-warning); - } - - .title { - display: flex; - align-items: center; - } - } -} - -:local(.content) { - padding-top: 15px; - padding-left: 30px; -} diff --git a/src/components/delete-modal/index.tsx b/src/components/delete-modal/index.tsx index 8fd42ece..754675c4 100644 --- a/src/components/delete-modal/index.tsx +++ b/src/components/delete-modal/index.tsx @@ -9,9 +9,35 @@ import { message, type ModalFuncProps } from 'antd'; -import { FC, forwardRef, useImperativeHandle, useState } from 'react'; +import { createStyles } from 'antd-style'; +import { useState } from 'react'; import styled from 'styled-components'; -import Styles from './index.less'; + +const useStyles = createStyles(({ css }) => ({ + 'delete-modal-content': css` + display: flex; + font-size: var(--font-size-middle); + .anticon { + font-size: 20px; + margin-right: 10px; + color: var(--ant-color-warning); + } + .title { + display: flex; + align-items: center; + font-weight: var(--font-weight-500); + } + `, + content: css` + padding-top: 15px; + padding-left: 30px; + color: var(--ant-color-text-secondary); + white-space: pre-line; + span { + color: var(--ant-color-text); + } + ` +})); const CheckboxWrapper = styled.div` margin-top: 20px; @@ -25,12 +51,8 @@ const CheckboxWrapper = styled.div` } `; -interface DeleteModalProps { - ref: any; -} - interface DataOptions { - content: string; + content?: string; selection?: boolean; name?: string; okText?: string; @@ -43,28 +65,33 @@ interface DataOptions { }; } -const DeleteModal: FC = forwardRef((props, ref) => { +interface Configuration { + checked: boolean; +} + +export default function useDeleteModel() { const intl = useIntl(); + const { styles } = useStyles(); const { saveScrollHeight, restoreScrollHeight } = useBodyScroll(); const [visible, setVisible] = useState(false); - const [checked, setChecked] = useState(false); + const [configuration, setConfiguration] = useState({ + checked: false + }); const [config, setConfig] = useState({} as any); - useImperativeHandle(ref, () => ({ - show: (data: ModalFuncProps & DataOptions) => { - saveScrollHeight(); - setConfig(data); - setChecked(data.checkConfig?.defautlChecked || false); - setVisible(true); - }, - hide: () => { - setVisible(false); - restoreScrollHeight(); - }, - configuration: { - checked: checked - } - })); + const show = (data: ModalFuncProps & DataOptions) => { + saveScrollHeight(); + setConfig(data); + setConfiguration({ + checked: data.checkConfig?.defautlChecked || false + }); + setVisible(true); + }; + + const hide = () => { + setVisible(false); + restoreScrollHeight(); + }; const handleCancel = () => { setVisible(false); @@ -94,75 +121,89 @@ const DeleteModal: FC = forwardRef((props, ref) => { } }; - return ( - - - - - } - > -
- - - - {config.title - ? intl.formatMessage({ id: config.title }) - : intl.formatMessage({ id: 'common.title.delete.confirm' })} - - -
-
{ + return ( +
- {config.checkConfig && ( - - setChecked(e.target.checked)} - > - - {intl.formatMessage({ id: config.checkConfig?.checkText })} + footer={ + + + + + } + > +
+ + + + {config.title + ? intl.formatMessage({ id: config.title }) + : intl.formatMessage({ id: 'common.title.delete.confirm' })} - - - )} - - ); -}); - -export default DeleteModal; + +
+
+ {config.checkConfig && ( + + + setConfiguration({ + checked: e.target.checked + }) + } + > + + {intl.formatMessage({ id: config.checkConfig?.checkText })} + + + + )} +
+ ); + }; + return { + DeleteModal, + show, + hide, + configuration + }; +} diff --git a/src/components/icon-font/iconfont/iconfont.css b/src/components/icon-font/iconfont/iconfont.css index d2564f6b..82073202 100644 --- a/src/components/icon-font/iconfont/iconfont.css +++ b/src/components/icon-font/iconfont/iconfont.css @@ -1,8 +1,8 @@ @font-face { font-family: iconfont; /* Project id 4613488 */ - src: url('iconfont.woff2?t=1747231573342') format('woff2'), - url('iconfont.woff?t=1747231573342') format('woff'), - url('iconfont.ttf?t=1747231573342') format('truetype'); + src: url('iconfont.woff2?t=1750854031026') format('woff2'), + url('iconfont.woff?t=1750854031026') format('woff'), + url('iconfont.ttf?t=1750854031026') format('truetype'); } .iconfont { @@ -13,6 +13,130 @@ -moz-osx-font-smoothing: grayscale; } +.icon-language::before { + content: "\e679"; +} + +.icon-help::before { + content: "\e67a"; +} + +.icon-key-filled::before { + content: "\e67b"; +} + +.icon-key::before { + content: "\e67d"; +} + +.icon-resources::before { + content: "\e67e"; +} + +.icon-users::before { + content: "\e67f"; +} + +.icon-resources-filled::before { + content: "\e680"; +} + +.icon-users-filled::before { + content: "\e681"; +} + +.icon-model::before { + content: "\e676"; +} + +.icon-model-filled::before { + content: "\e678"; +} + +.icon-layers-filled::before { + content: "\e671"; +} + +.icon-layers::before { + content: "\e673"; +} + +.icon-experiment::before { + content: "\e674"; +} + +.icon-experiment-filled::before { + content: "\e675"; +} + +.icon-dashboard::before { + content: "\e66d"; +} + +.icon-dashboard-filled::before { + content: "\e66e"; +} + +.icon-expand-left::before { + content: "\ea48"; +} + +.icon-expand-right::before { + content: "\ea49"; +} + +.icon-users-fill::before { + content: "\e677"; +} + +.icon-layers-fill::before { + content: "\e89d"; +} + +.icon-key-fill::before { + content: "\e80e"; +} + +.icon-server-fill::before { + content: "\e7a3"; +} + +.icon-model-fill::before { + content: "\e7b7"; +} + +.icon-left_panel_close::before { + content: "\e668"; +} + +.icon-left_panel_open::before { + content: "\e669"; +} + +.icon-playcircle-fill::before { + content: "\e665"; +} + +.icon-stopcircle-fill::before { + content: "\e666"; +} + +.icon-play-speed::before { + content: "\e856"; +} + +.icon-more::before { + content: "\e62e"; +} + +.icon-play::before { + content: "\e9f9"; +} + +.icon-pause::before { + content: "\e713"; +} + .icon-dark_theme::before { content: "\e646"; } @@ -237,14 +361,6 @@ content: "\e62c"; } -.icon-stopcircle-fill::before { - content: "\e7cc"; -} - -.icon-playcircle-fill::before { - content: "\e7cd"; -} - .icon-SpeakerSlash::before { content: "\e661"; } diff --git a/src/components/icon-font/iconfont/iconfont.js b/src/components/icon-font/iconfont/iconfont.js index 7e7fe97f..8facbd68 100644 --- a/src/components/icon-font/iconfont/iconfont.js +++ b/src/components/icon-font/iconfont/iconfont.js @@ -1 +1 @@ -window._iconfont_svg_string_4613488='',(h=>{var l=(a=(a=document.getElementsByTagName("script"))[a.length-1]).getAttribute("data-injectcss"),a=a.getAttribute("data-disable-injectsvg");if(!a){var c,z,v,t,o,i=function(l,a){a.parentNode.insertBefore(l,a)};if(l&&!h.__iconfont__svg__cssinject__){h.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(l){console&&console.log(l)}}c=function(){var l,a=document.createElement("div");a.innerHTML=h._iconfont_svg_string_4613488,(a=a.getElementsByTagName("svg")[0])&&(a.setAttribute("aria-hidden","true"),a.style.position="absolute",a.style.width=0,a.style.height=0,a.style.overflow="hidden",a=a,(l=document.body).firstChild?i(a,l.firstChild):l.appendChild(a))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(c,0):(z=function(){document.removeEventListener("DOMContentLoaded",z,!1),c()},document.addEventListener("DOMContentLoaded",z,!1)):document.attachEvent&&(v=c,t=h.document,o=!1,p(),t.onreadystatechange=function(){"complete"==t.readyState&&(t.onreadystatechange=null,m())})}function m(){o||(o=!0,v())}function p(){try{t.documentElement.doScroll("left")}catch(l){return void setTimeout(p,50)}m()}})(window); \ No newline at end of file +window._iconfont_svg_string_4613488='',(h=>{var l=(a=(a=document.getElementsByTagName("script"))[a.length-1]).getAttribute("data-injectcss"),a=a.getAttribute("data-disable-injectsvg");if(!a){var c,v,z,t,o,m=function(l,a){a.parentNode.insertBefore(l,a)};if(l&&!h.__iconfont__svg__cssinject__){h.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(l){console&&console.log(l)}}c=function(){var l,a=document.createElement("div");a.innerHTML=h._iconfont_svg_string_4613488,(a=a.getElementsByTagName("svg")[0])&&(a.setAttribute("aria-hidden","true"),a.style.position="absolute",a.style.width=0,a.style.height=0,a.style.overflow="hidden",a=a,(l=document.body).firstChild?m(a,l.firstChild):l.appendChild(a))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(c,0):(v=function(){document.removeEventListener("DOMContentLoaded",v,!1),c()},document.addEventListener("DOMContentLoaded",v,!1)):document.attachEvent&&(z=c,t=h.document,o=!1,p(),t.onreadystatechange=function(){"complete"==t.readyState&&(t.onreadystatechange=null,i())})}function i(){o||(o=!0,z())}function p(){try{t.documentElement.doScroll("left")}catch(l){return void setTimeout(p,50)}i()}})(window); \ No newline at end of file diff --git a/src/components/icon-font/iconfont/iconfont.json b/src/components/icon-font/iconfont/iconfont.json index 36da5f3f..f4c15008 100644 --- a/src/components/icon-font/iconfont/iconfont.json +++ b/src/components/icon-font/iconfont/iconfont.json @@ -5,6 +5,223 @@ "css_prefix_text": "icon-", "description": "", "glyphs": [ + { + "icon_id": "44685190", + "name": "language", + "font_class": "language", + "unicode": "e679", + "unicode_decimal": 59001 + }, + { + "icon_id": "44685189", + "name": "help", + "font_class": "help", + "unicode": "e67a", + "unicode_decimal": 59002 + }, + { + "icon_id": "44684306", + "name": "key-filled", + "font_class": "key-filled", + "unicode": "e67b", + "unicode_decimal": 59003 + }, + { + "icon_id": "44684302", + "name": "key", + "font_class": "key", + "unicode": "e67d", + "unicode_decimal": 59005 + }, + { + "icon_id": "44684304", + "name": "resources", + "font_class": "resources", + "unicode": "e67e", + "unicode_decimal": 59006 + }, + { + "icon_id": "44684305", + "name": "users", + "font_class": "users", + "unicode": "e67f", + "unicode_decimal": 59007 + }, + { + "icon_id": "44684303", + "name": "resources-filled", + "font_class": "resources-filled", + "unicode": "e680", + "unicode_decimal": 59008 + }, + { + "icon_id": "44684301", + "name": "users-filled", + "font_class": "users-filled", + "unicode": "e681", + "unicode_decimal": 59009 + }, + { + "icon_id": "44684150", + "name": "model", + "font_class": "model", + "unicode": "e676", + "unicode_decimal": 58998 + }, + { + "icon_id": "44684149", + "name": "model-filled", + "font_class": "model-filled", + "unicode": "e678", + "unicode_decimal": 59000 + }, + { + "icon_id": "44684090", + "name": "layers-filled", + "font_class": "layers-filled", + "unicode": "e671", + "unicode_decimal": 58993 + }, + { + "icon_id": "44684091", + "name": "layers", + "font_class": "layers", + "unicode": "e673", + "unicode_decimal": 58995 + }, + { + "icon_id": "44684086", + "name": "experiment", + "font_class": "experiment", + "unicode": "e674", + "unicode_decimal": 58996 + }, + { + "icon_id": "44684085", + "name": "experiment", + "font_class": "experiment-filled", + "unicode": "e675", + "unicode_decimal": 58997 + }, + { + "icon_id": "44684021", + "name": "dashboard", + "font_class": "dashboard", + "unicode": "e66d", + "unicode_decimal": 58989 + }, + { + "icon_id": "44684020", + "name": "dashboard-filled", + "font_class": "dashboard-filled", + "unicode": "e66e", + "unicode_decimal": 58990 + }, + { + "icon_id": "40068272", + "name": "expand-left", + "font_class": "expand-left", + "unicode": "ea48", + "unicode_decimal": 59976 + }, + { + "icon_id": "40068278", + "name": "expand-right", + "font_class": "expand-right", + "unicode": "ea49", + "unicode_decimal": 59977 + }, + { + "icon_id": "1350497", + "name": "sq-users", + "font_class": "users-fill", + "unicode": "e677", + "unicode_decimal": 58999 + }, + { + "icon_id": "13691715", + "name": "layers", + "font_class": "layers-fill", + "unicode": "e89d", + "unicode_decimal": 59549 + }, + { + "icon_id": "14267903", + "name": "key-skeleton-alt", + "font_class": "key-fill", + "unicode": "e80e", + "unicode_decimal": 59406 + }, + { + "icon_id": "14341823", + "name": "cloud-server-solid", + "font_class": "server-fill", + "unicode": "e7a3", + "unicode_decimal": 59299 + }, + { + "icon_id": "40764011", + "name": "icon-model-selected", + "font_class": "model-fill", + "unicode": "e7b7", + "unicode_decimal": 59319 + }, + { + "icon_id": "44668359", + "name": "left_panel_close_36dp_1F1F1F_FILL0_wght400_GRAD0_o", + "font_class": "left_panel_close", + "unicode": "e668", + "unicode_decimal": 58984 + }, + { + "icon_id": "44668360", + "name": "left_panel_open_36dp_1F1F1F_FILL0_wght400_GRAD0_op", + "font_class": "left_panel_open", + "unicode": "e669", + "unicode_decimal": 58985 + }, + { + "icon_id": "44650419", + "name": "play circle-fill", + "font_class": "playcircle-fill", + "unicode": "e665", + "unicode_decimal": 58981 + }, + { + "icon_id": "44650418", + "name": "stop circle-fill", + "font_class": "stopcircle-fill", + "unicode": "e666", + "unicode_decimal": 58982 + }, + { + "icon_id": "8592899", + "name": "play-speed", + "font_class": "play-speed", + "unicode": "e856", + "unicode_decimal": 59478 + }, + { + "icon_id": "10941162", + "name": "more", + "font_class": "more", + "unicode": "e62e", + "unicode_decimal": 58926 + }, + { + "icon_id": "703373", + "name": "play", + "font_class": "play", + "unicode": "e9f9", + "unicode_decimal": 59897 + }, + { + "icon_id": "736882", + "name": "pause", + "font_class": "pause", + "unicode": "e713", + "unicode_decimal": 59155 + }, { "icon_id": "44028047", "name": "dark_theme", @@ -397,20 +614,6 @@ "unicode": "e62c", "unicode_decimal": 58924 }, - { - "icon_id": "6151140", - "name": "stop circle-fill", - "font_class": "stopcircle-fill", - "unicode": "e7cc", - "unicode_decimal": 59340 - }, - { - "icon_id": "6151141", - "name": "play circle-fill", - "font_class": "playcircle-fill", - "unicode": "e7cd", - "unicode_decimal": 59341 - }, { "icon_id": "23563264", "name": "SpeakerSlash", diff --git a/src/components/icon-font/iconfont/iconfont.ttf b/src/components/icon-font/iconfont/iconfont.ttf index 78702852..c99bf1fc 100644 Binary files a/src/components/icon-font/iconfont/iconfont.ttf and b/src/components/icon-font/iconfont/iconfont.ttf differ diff --git a/src/components/icon-font/iconfont/iconfont.woff b/src/components/icon-font/iconfont/iconfont.woff index 033b56e4..8cac44d7 100644 Binary files a/src/components/icon-font/iconfont/iconfont.woff and b/src/components/icon-font/iconfont/iconfont.woff differ diff --git a/src/components/icon-font/iconfont/iconfont.woff2 b/src/components/icon-font/iconfont/iconfont.woff2 index 783dcf7f..46b81692 100644 Binary files a/src/components/icon-font/iconfont/iconfont.woff2 and b/src/components/icon-font/iconfont/iconfont.woff2 differ diff --git a/src/components/icon-font/index.tsx b/src/components/icon-font/index.tsx index 7d1a1df8..2c4fbc7b 100644 --- a/src/components/icon-font/index.tsx +++ b/src/components/icon-font/index.tsx @@ -1,8 +1,8 @@ import { createFromIconfontCN } from '@ant-design/icons'; -// import './iconfont/iconfont.js'; +import './iconfont/iconfont.js'; const IconFont = createFromIconfontCN({ - scriptUrl: '//at.alicdn.com/t/c/font_4613488_w50kuuord8o.js' + scriptUrl: '' }); export default IconFont; diff --git a/src/hooks/use-delete-modal.ts b/src/hooks/use-delete-modal.ts deleted file mode 100644 index 758533a3..00000000 --- a/src/hooks/use-delete-modal.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { useIntl } from '@umijs/max'; -import { Modal, message, type ModalFuncProps } from 'antd'; -import { useRef } from 'react'; - -export default function useDeleteModal() { - const intl = useIntl(); - const modalRef = useRef(); - const showDeleteModal = (config: ModalFuncProps = {}) => { - modalRef.current = Modal.confirm({ - ...config, - okText: intl.formatMessage({ - id: 'common.button.delete' - }), - onCancel: () => { - config.onCancel?.(); - modalRef.current.destroy?.(); - }, - onOk: async () => { - await config.onOk?.(); - message.success(intl.formatMessage({ id: 'common.message.success' })); - } - }); - }; - - return { showDeleteModal }; -} diff --git a/src/hooks/use-table-fetch.ts b/src/hooks/use-table-fetch.ts index e8aa9c8a..03095f1b 100644 --- a/src/hooks/use-table-fetch.ts +++ b/src/hooks/use-table-fetch.ts @@ -1,3 +1,4 @@ +import useDeleteModel from '@/components/delete-modal'; import useSetChunkRequest from '@/hooks/use-chunk-request'; import useTableRowSelection from '@/hooks/use-table-row-selection'; import useTableSort from '@/hooks/use-table-sort'; @@ -55,7 +56,7 @@ export default function useTableFetch( perPage: 10, search: '' }); - + const { DeleteModal, show, hide, configuration } = useDeleteModel(); const { setChunkRequest } = useSetChunkRequest(); const { updateChunkedList, cacheDataListRef } = useUpdateChunkedList({ events: ['UPDATE', 'DELETE', 'INSERT'], @@ -203,7 +204,7 @@ export default function useTableFetch( row: ListItem & { name: string; id: number }, options?: any ) => { - modalRef.current.show({ + show({ content: contentForDelete, operation: 'common.delete.single.confirm', name: row.name, @@ -211,7 +212,7 @@ export default function useTableFetch( async onOk() { console.log('OK'); await deleteAPI?.(row.id, { - ...modalRef.current?.configuration + ...configuration }); fetchData(); } @@ -219,7 +220,7 @@ export default function useTableFetch( }; const handleDeleteBatch = (options = {}) => { - modalRef.current.show({ + show({ content: contentForDelete, operation: 'common.delete.confirm', selection: true, @@ -231,7 +232,7 @@ export default function useTableFetch( rowSelection.selectedRowKeys, async (id: any) => { await deleteAPI(id, { - ...modalRef.current?.configuration + configuration }); successIds.push(id); } @@ -274,6 +275,7 @@ export default function useTableFetch( sortOrder, queryParams, modalRef, + DeleteModal, setQueryParams, handleDelete, handleDeleteBatch, diff --git a/src/locales/en-US/common.ts b/src/locales/en-US/common.ts index 97bb247f..48ba137e 100644 --- a/src/locales/en-US/common.ts +++ b/src/locales/en-US/common.ts @@ -194,13 +194,13 @@ export default { 'common.delete.confirm': 'Are you sure you want to delete the selected {type}?', 'common.delete.single.confirm': - 'Are you sure you want to delete {name}?', + 'Are you sure you want to delete? \n {name}', 'common.stop.confirm': 'Are you sure you want to stop the selected {type}?', 'common.stop.single.confirm': - 'Are you sure you want to stop {name}?', + 'Are you sure you want to stop? \n {name}', 'common.start.confirm': 'Are you sure you want to start the selected {type}?', 'common.start.single.confirm': - 'Are you sure you want to start {name}?', + 'Are you sure you want to start? \n {name}', 'common.filter.name': 'Filter by name', 'common.form.password': 'Password', 'common.form.username': 'Username', diff --git a/src/locales/en-US/resources.ts b/src/locales/en-US/resources.ts index 608d20aa..1059ce07 100644 --- a/src/locales/en-US/resources.ts +++ b/src/locales/en-US/resources.ts @@ -70,7 +70,7 @@ export default { 'Waiting for the download to complete...', 'resources.filter.worker': 'Filter by worker', 'resources.filter.source': 'Filter by Source', - 'resources.modelfiles.delete.tips': 'Also delete the file from disk!', + 'resources.modelfiles.delete.tips': 'Also delete the file from disk', 'resources.modelfiles.copy.tips': 'Copy Full Path', 'resources.filter.path': 'Filter by path' }; diff --git a/src/locales/ja-JP/resources.ts b/src/locales/ja-JP/resources.ts index 0fe54044..215e663a 100644 --- a/src/locales/ja-JP/resources.ts +++ b/src/locales/ja-JP/resources.ts @@ -71,7 +71,7 @@ export default { 'ダウンロード完了を待っています...', 'resources.filter.worker': 'ワーカーでフィルタ', 'resources.filter.source': 'ソースでフィルタ', - 'resources.modelfiles.delete.tips': 'ディスクからファイルも削除します!', + 'resources.modelfiles.delete.tips': 'ディスクからファイルも削除します', 'resources.modelfiles.copy.tips': 'フルパスをコピー', 'resources.filter.path': 'パスでフィルタ' }; diff --git a/src/locales/ru-RU/resources.ts b/src/locales/ru-RU/resources.ts index 1afa8065..28d30b9e 100644 --- a/src/locales/ru-RU/resources.ts +++ b/src/locales/ru-RU/resources.ts @@ -69,7 +69,7 @@ export default { 'resources.modelfiles.storagePath.holder': 'Ожидание завершения загрузки...', 'resources.filter.worker': 'Фильтровать по узлу', 'resources.filter.source': 'Фильтровать по источнику', - 'resources.modelfiles.delete.tips': 'Также удалить файл с диска!', + 'resources.modelfiles.delete.tips': 'Также удалить файл с диска', 'resources.modelfiles.copy.tips': 'Скопировать полный путь', 'resources.filter.path': 'Фильтрация по пути' }; diff --git a/src/locales/zh-CN/common.ts b/src/locales/zh-CN/common.ts index d35660fb..9b1be793 100644 --- a/src/locales/zh-CN/common.ts +++ b/src/locales/zh-CN/common.ts @@ -185,15 +185,15 @@ export default { 'common.table.user': '用户', 'common.settings.instructions': '操作指引', 'common.settings.language': '语言', - 'common.delete.confirm': '删除选中的{type},确定吗?', + 'common.delete.confirm': '确定删除选中的{type}吗?', 'common.delete.single.confirm': - '删除 {name},确定吗?', - 'common.stop.confirm': '停止选中的{type},确定吗?', + '确定删除以下内容?\n {name}', + 'common.stop.confirm': '确定停止选中的{type}吗?', 'common.stop.single.confirm': - '停止 {name},确定吗?', - 'common.start.confirm': '启动选中的{type},确定吗?', + '确定停止 {name}?', + 'common.start.confirm': '确定启动选中的{type}吗?', 'common.start.single.confirm': - '启动 {name},确定吗?', + '确定启动 {name}?', 'common.filter.name': '名称查询', 'common.form.password': '密码', 'common.form.username': '用户名', diff --git a/src/locales/zh-CN/resources.ts b/src/locales/zh-CN/resources.ts index f2a93128..ef2d69f0 100644 --- a/src/locales/zh-CN/resources.ts +++ b/src/locales/zh-CN/resources.ts @@ -68,7 +68,7 @@ export default { 'resources.modelfiles.storagePath.holder': '等待下载完成...', 'resources.filter.worker': '按 Worker 筛选', 'resources.filter.source': '按来源筛选', - 'resources.modelfiles.delete.tips': '同时从磁盘删除文件!', + 'resources.modelfiles.delete.tips': '同时从磁盘删除文件', 'resources.modelfiles.copy.tips': '复制完整路径', 'resources.filter.path': '路径查询' }; diff --git a/src/pages/api-keys/index.tsx b/src/pages/api-keys/index.tsx index d251a5d0..72b64842 100644 --- a/src/pages/api-keys/index.tsx +++ b/src/pages/api-keys/index.tsx @@ -1,5 +1,4 @@ import AutoTooltip from '@/components/auto-tooltip'; -import DeleteModal from '@/components/delete-modal'; import PageTools from '@/components/page-tools'; import { PageAction } from '@/config'; import HotKeys from '@/config/hotkeys'; @@ -32,7 +31,7 @@ const APIKeys: React.FC = () => { rowSelection, queryParams, sortOrder, - modalRef, + DeleteModal, handleDelete, handleDeleteBatch, fetchData, @@ -261,7 +260,7 @@ const APIKeys: React.FC = () => { onCancel={handleModalCancel} onOk={handleModalOk} > - + ); }; diff --git a/src/pages/llmodels/components/instance-item.tsx b/src/pages/llmodels/components/instance-item.tsx index 3cc45d4e..522f33e2 100644 --- a/src/pages/llmodels/components/instance-item.tsx +++ b/src/pages/llmodels/components/instance-item.tsx @@ -471,10 +471,24 @@ const InstanceItem: React.FC = ({ ); }; - const renderDistributionInfo = (severList: any[]) => { + const renderDistributionInfo = (distributed_servers: Record) => { + const { rpc_servers, ray_actors, subordinate_workers } = + distributed_servers; + + let severList: any[] = []; + + if (rpc_servers?.length > 0) { + severList = rpc_servers; + } else if (ray_actors?.length > 0) { + severList = ray_actors; + } else if (subordinate_workers?.length > 0) { + severList = subordinate_workers; + } + if (!severList.length) { return null; } + return ( = ({ className="flex align-center" > {renderOffloadInfo} - {renderDistributionInfo( - instanceData.distributed_servers?.rpc_servers || - instanceData.distributed_servers?.ray_actors || - instanceData.distributed_servers?.subordinate_workers || - [] - )} + {renderDistributionInfo(instanceData.distributed_servers || {})} diff --git a/src/pages/llmodels/components/table-list.tsx b/src/pages/llmodels/components/table-list.tsx index 2952c035..1d978219 100644 --- a/src/pages/llmodels/components/table-list.tsx +++ b/src/pages/llmodels/components/table-list.tsx @@ -1,6 +1,6 @@ import { modelsExpandKeysAtom } from '@/atoms/models'; import AutoTooltip from '@/components/auto-tooltip'; -import DeleteModal from '@/components/delete-modal'; +import useDeleteModel from '@/components/delete-modal'; import DropDownActions from '@/components/drop-down-actions'; import DropdownButtons from '@/components/drop-down-buttons'; import { PageSize } from '@/components/logs-viewer/config'; @@ -146,6 +146,7 @@ const Models: React.FC = ({ loadend, total }) => { + const { DeleteModal, show } = useDeleteModel(); const { getGPUList, generateFormValues, gpuDeviceList } = useGenerateFormEditInitialValues(); const { saveScrollHeight, restoreScrollHeight } = useBodyScroll(); @@ -327,7 +328,7 @@ const Models: React.FC = ({ }, [onCancelViewLogs]); const handleDelete = async (row: any) => { - modalRef.current.show({ + show({ content: 'models.table.models', operation: 'common.delete.single.confirm', name: row.name, @@ -342,7 +343,7 @@ const Models: React.FC = ({ }; const handleDeleteBatch = () => { - modalRef.current.show({ + show({ content: 'models.table.models', operation: 'common.delete.confirm', selection: true, @@ -406,7 +407,7 @@ const Models: React.FC = ({ ); const handleDeleteInstace = useCallback( (row: any) => { - modalRef.current.show({ + show({ content: 'models.instances', okText: 'common.button.delrecreate', operation: 'common.delete.single.confirm', @@ -487,7 +488,7 @@ const Models: React.FC = ({ } if (val === 'stop') { - modalRef.current.show({ + show({ content: 'models.instances', title: 'common.title.stop.confirm', okText: 'common.button.stop', @@ -562,7 +563,7 @@ const Models: React.FC = ({ }; const handleStartBatch = async () => { - modalRef.current.show({ + show({ content: 'models.table.models', title: 'common.title.start.confirm', okText: 'common.button.start', @@ -575,7 +576,7 @@ const Models: React.FC = ({ }; const handleStopBatch = async () => { - modalRef.current.show({ + show({ content: 'models.table.models', title: 'common.title.stop.confirm', okText: 'common.button.stop', @@ -884,7 +885,7 @@ const Models: React.FC = ({ open={openLogModal} onCancel={handleLogModalCancel} > - + { dataSource, rowSelection, queryParams, - modalRef, + DeleteModal, fetchData, handleDelete, handleDeleteBatch, @@ -683,7 +682,7 @@ const ModelFiles = () => { }} > - + { dataSource, rowSelection, queryParams, - modalRef, + DeleteModal, handleDelete, handleDeleteBatch, fetchData, @@ -447,7 +446,7 @@ const Workers: React.FC = () => { /> - + setOpen(false)}> { rowSelection, queryParams, sortOrder, - modalRef, + DeleteModal, handleDelete, handleDeleteBatch, fetchData, @@ -321,7 +320,7 @@ const Users: React.FC = () => { onCancel={handleModalCancel} onOk={handleModalOk} > - + ); };