From 94e8638d28d1fce8cfac53b99bb30b7ec2d00e57 Mon Sep 17 00:00:00 2001 From: jialin Date: Fri, 14 Jun 2024 11:17:04 +0800 Subject: [PATCH] build: base url --- .eslintrc.js | 5 ++-- config/config.ts | 6 ++--- .../seal-table/components/table-row.tsx | 7 ++++-- src/components/status-tag/index.less | 21 +++++++++++++++++ src/components/status-tag/index.tsx | 17 ++++++++++++-- src/pages/api-keys/index.tsx | 8 +++---- src/pages/llmodels/index.tsx | 23 ++++++++----------- 7 files changed, 61 insertions(+), 26 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index a4280fa9..fdfe3d2b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,7 +1,8 @@ module.exports = { extends: require.resolve('@umijs/max/eslint'), - // react/no-unstable-nested-components config rules: { - 'react/no-unstable-nested-components': 'on' + 'react/no-unstable-nested-components': 1, + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': 'off' } }; diff --git a/config/config.ts b/config/config.ts index fa3f54bb..a86eaad2 100644 --- a/config/config.ts +++ b/config/config.ts @@ -1,14 +1,14 @@ import { defineConfig } from '@umijs/max'; + import proxy from './proxy'; import routes from './routes'; -const { REACT_APP_ENV = 'dev' } = process.env; - -console.log('env+++++++++++++++', process.env.NODE_ENV, REACT_APP_ENV); export default defineConfig({ proxy: { ...proxy() }, + base: process.env.npm_config_base || '/', + esbuildMinifyIIFE: true, clickToComponent: {}, antd: { style: 'less', diff --git a/src/components/seal-table/components/table-row.tsx b/src/components/seal-table/components/table-row.tsx index 5158e01a..3888b7ab 100644 --- a/src/components/seal-table/components/table-row.tsx +++ b/src/components/seal-table/components/table-row.tsx @@ -39,9 +39,12 @@ const TableRow: React.FC< }, [rowSelection]); const handleRowExpand = async () => { + setExpanded(!expanded); + onExpand?.(!expanded, record); + if (expanded) { + return; + } try { - setExpanded(!expanded); - onExpand?.(!expanded, record); setLoading(true); const data = await loadChildren?.(record); setChildrenData(data || []); diff --git a/src/components/status-tag/index.less b/src/components/status-tag/index.less index a01b364b..50ed288f 100644 --- a/src/components/status-tag/index.less +++ b/src/components/status-tag/index.less @@ -1,10 +1,31 @@ .status-tag { + position: relative; display: flex; justify-content: center; align-items: center; padding: 2px 10px; border-radius: 20px; width: fit-content; + min-width: 76px; height: 26px; font-size: var(--font-size-base); + overflow: hidden; + + .download { + display: flex; + justify-content: center; + align-items: center; + position: absolute; + left: 0; + top: 0; + bottom: 0; + height: 100%; + background-color: var(--ant-color-primary); + } + + .progress { + position: relative; + z-index: 10; + color: var(--color-white-1); + } } diff --git a/src/components/status-tag/index.tsx b/src/components/status-tag/index.tsx index c4e187fa..4b6861d2 100644 --- a/src/components/status-tag/index.tsx +++ b/src/components/status-tag/index.tsx @@ -33,9 +33,22 @@ const StatusTag: React.FC = ({ statusValue, download }) => { setStatusColor(StatusColorMap[status]); }, [status]); + const renderContent = () => { + const percent = download?.percent || 0; + + if (download && percent > 0 && percent < 100) { + return ( + <> + {download?.percent || 0}% + + + ); + } + return {text}; + }; return ( = ({ statusValue, download }) => { } } > - {text} + {renderContent()} ); }; diff --git a/src/pages/api-keys/index.tsx b/src/pages/api-keys/index.tsx index 41923481..f7689b97 100644 --- a/src/pages/api-keys/index.tsx +++ b/src/pages/api-keys/index.tsx @@ -51,7 +51,7 @@ const Models: React.FC = () => { const { sortOrder, setSortOrder } = useTableSort({ defaultSortOrder: 'descend' }); - const [total, setTotal] = useState(100); + const [total, setTotal] = useState(0); const [openAddModal, setOpenAddModal] = useState(false); const [loading, setLoading] = useState(false); const [action, setAction] = useState(PageAction.CREATE); @@ -91,7 +91,7 @@ const Models: React.FC = () => { const handleAddUser = () => { setOpenAddModal(true); setAction(PageAction.CREATE); - setTitle('Add User'); + setTitle('Add API Key'); }; const handleClickMenu = (e: any) => { @@ -160,7 +160,7 @@ const Models: React.FC = () => { type="primary" onClick={handleAddUser} > - Add API-key + Add API Key