| @@ -1,11 +1,14 @@ | |||||
| import RightContent from '@/components/RightContent'; | import RightContent from '@/components/RightContent'; | ||||
| import themes from '@/styles/theme.less'; | import themes from '@/styles/theme.less'; | ||||
| import { type GlobalInitialState } from '@/types'; | |||||
| import { menuItemRender } from '@/utils/menuRender'; | |||||
| import type { Settings as LayoutSettings } from '@ant-design/pro-components'; | import type { Settings as LayoutSettings } from '@ant-design/pro-components'; | ||||
| import { RuntimeConfig, history } from '@umijs/max'; | import { RuntimeConfig, history } from '@umijs/max'; | ||||
| import { RuntimeAntdConfig } from 'umi'; | import { RuntimeAntdConfig } from 'umi'; | ||||
| import defaultSettings from '../config/defaultSettings'; | import defaultSettings from '../config/defaultSettings'; | ||||
| import '../public/fonts/font.css'; | import '../public/fonts/font.css'; | ||||
| import { getAccessToken } from './access'; | import { getAccessToken } from './access'; | ||||
| import ErrorBoundary from './components/ErrorBoundary'; | |||||
| import './dayjsConfig'; | import './dayjsConfig'; | ||||
| import { removeAllPageCacheState } from './hooks/pageCacheState'; | import { removeAllPageCacheState } from './hooks/pageCacheState'; | ||||
| import { | import { | ||||
| @@ -16,14 +19,9 @@ import { | |||||
| setRemoteMenu, | setRemoteMenu, | ||||
| } from './services/session'; | } from './services/session'; | ||||
| import './styles/menu.less'; | import './styles/menu.less'; | ||||
| export { requestConfig as request } from './requestConfig'; | |||||
| // const isDev = process.env.NODE_ENV === 'development'; | |||||
| import { type GlobalInitialState } from '@/types'; | |||||
| // import '@/utils/clipboard'; | |||||
| import { menuItemRender } from '@/utils/menuRender'; | |||||
| import ErrorBoundary from './components/ErrorBoundary'; | |||||
| import { needAuth } from './utils'; | import { needAuth } from './utils'; | ||||
| import { gotoLoginPage } from './utils/ui'; | import { gotoLoginPage } from './utils/ui'; | ||||
| export { requestConfig as request } from './requestConfig'; | |||||
| /** | /** | ||||
| * @see https://umijs.org/zh-CN/plugins/plugin-initial-state | * @see https://umijs.org/zh-CN/plugins/plugin-initial-state | ||||
| @@ -0,0 +1,26 @@ | |||||
| import KFIcon from '@/components/KFIcon'; | |||||
| import { Tooltip } from 'antd'; | |||||
| import styles from './index.less'; | |||||
| export type CopyingTextProps = { | |||||
| text: string; | |||||
| }; | |||||
| function CopyingText({ text }: CopyingTextProps) { | |||||
| return ( | |||||
| <div className={styles['copying-text']}> | |||||
| <span className={styles['copying-text__text']}>{text}</span> | |||||
| <Tooltip title="复制"> | |||||
| <KFIcon | |||||
| id="copying" | |||||
| data-clipboard-text={text} | |||||
| type="icon-fuzhi2" | |||||
| className={styles['copying-text__icon']} | |||||
| color="#606b7a" | |||||
| /> | |||||
| </Tooltip> | |||||
| </div> | |||||
| ); | |||||
| } | |||||
| export default CopyingText; | |||||
| @@ -1,26 +0,0 @@ | |||||
| import KFIcon from '@/components/KFIcon'; | |||||
| import { Typography } from 'antd'; | |||||
| import styles from './index.less'; | |||||
| export type CopyingTextProps = { | |||||
| text: string; | |||||
| }; | |||||
| function CopyingText({ text }: CopyingTextProps) { | |||||
| return ( | |||||
| <div className={styles['copying-text']}> | |||||
| <Typography.Text ellipsis={{ tooltip: text }} className={styles['copying-text__text']}> | |||||
| {text} | |||||
| </Typography.Text> | |||||
| <KFIcon | |||||
| id="copying" | |||||
| data-clipboard-text={text} | |||||
| type="icon-fuzhi2" | |||||
| className={styles['copying-text__icon']} | |||||
| color="#606b7a" | |||||
| /> | |||||
| </div> | |||||
| ); | |||||
| } | |||||
| export default CopyingText; | |||||
| @@ -93,17 +93,14 @@ function ExperimentList({ type }: ExperimentListProps) { | |||||
| const [res] = await to(request(record.id)); | const [res] = await to(request(record.id)); | ||||
| if (res) { | if (res) { | ||||
| message.success('删除成功'); | message.success('删除成功'); | ||||
| // 如果是一页的唯一数据,删除时,请求第一页的数据 | |||||
| // 如果是一页的唯一数据,删除后,请求第一页的数据 | |||||
| // 否则直接刷新这一页的数据 | // 否则直接刷新这一页的数据 | ||||
| // 避免回到第一页 | |||||
| if (tableData.length > 1) { | |||||
| setPagination((prev) => ({ | |||||
| setPagination((prev) => { | |||||
| return { | |||||
| ...prev, | ...prev, | ||||
| current: 1, | |||||
| })); | |||||
| } else { | |||||
| getAutoMLList(); | |||||
| } | |||||
| current: tableData.length === 1 ? Math.max(1, prev.current! - 1) : prev.current, | |||||
| }; | |||||
| }); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -75,8 +75,15 @@ function CodeConfigList() { | |||||
| const deleteRecord = async (id: number) => { | const deleteRecord = async (id: number) => { | ||||
| const [res] = await to(deleteCodeConfigReq(id)); | const [res] = await to(deleteCodeConfigReq(id)); | ||||
| if (res) { | if (res) { | ||||
| getDataList(); | |||||
| message.success('删除成功'); | message.success('删除成功'); | ||||
| // 如果是一页的唯一数据,删除后,请求第一页的数据 | |||||
| // 否则直接刷新这一页的数据 | |||||
| setPagination((prev) => { | |||||
| return { | |||||
| ...prev, | |||||
| current: dataList!.length === 1 ? Math.max(1, prev.current! - 1) : prev.current, | |||||
| }; | |||||
| }); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -107,8 +107,15 @@ function ResourceList( | |||||
| const request = config.deleteRecord; | const request = config.deleteRecord; | ||||
| const [res] = await to(request(params)); | const [res] = await to(request(params)); | ||||
| if (res) { | if (res) { | ||||
| getDataList(); | |||||
| message.success('删除成功'); | message.success('删除成功'); | ||||
| // 如果是一页的唯一数据,删除后,请求第一页的数据 | |||||
| // 否则直接刷新这一页的数据 | |||||
| setPagination((prev) => { | |||||
| return { | |||||
| ...prev, | |||||
| current: dataList!.length === 1 ? Math.max(1, prev.current! - 1) : prev.current, | |||||
| }; | |||||
| }); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -80,17 +80,14 @@ function EditorList() { | |||||
| const [res] = await to(deleteEditorReq(id)); | const [res] = await to(deleteEditorReq(id)); | ||||
| if (res) { | if (res) { | ||||
| message.success('删除成功'); | message.success('删除成功'); | ||||
| // 如果是一页的唯一数据,删除时,请求第一页的数据 | |||||
| // 如果是一页的唯一数据,删除后,请求第一页的数据 | |||||
| // 否则直接刷新这一页的数据 | // 否则直接刷新这一页的数据 | ||||
| // 避免回到第一页 | |||||
| if (tableData.length > 1) { | |||||
| setPagination((prev) => ({ | |||||
| setPagination((prev) => { | |||||
| return { | |||||
| ...prev, | ...prev, | ||||
| current: 1, | |||||
| })); | |||||
| } else { | |||||
| getEditorList(); | |||||
| } | |||||
| current: tableData.length === 1 ? Math.max(1, prev.current! - 1) : prev.current, | |||||
| }; | |||||
| }); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -378,6 +378,31 @@ function Experiment() { | |||||
| getQueryByExperiment(expandedRowKeys, page); | getQueryByExperiment(expandedRowKeys, page); | ||||
| }; | }; | ||||
| // 处理删除 | |||||
| const handleExperimentDelete = (record) => { | |||||
| modalConfirm({ | |||||
| title: '删除后,该实验将不可恢复', | |||||
| content: '是否确认删除?', | |||||
| onOk: () => { | |||||
| deleteExperimentById(record.id).then((ret) => { | |||||
| if (ret.code === 200) { | |||||
| message.success('删除成功'); | |||||
| // 如果是一页的唯一数据,删除后,请求第一页的数据 | |||||
| // 否则直接刷新这一页的数据 | |||||
| setPagination((prev) => { | |||||
| return { | |||||
| ...prev, | |||||
| current: experimentList.length === 1 ? Math.max(1, prev.current - 1) : prev.current, | |||||
| }; | |||||
| }); | |||||
| } else { | |||||
| message.error(ret.msg); | |||||
| } | |||||
| }); | |||||
| }, | |||||
| }); | |||||
| }; | |||||
| const columns = [ | const columns = [ | ||||
| { | { | ||||
| title: '实验名称', | title: '实验名称', | ||||
| @@ -476,22 +501,7 @@ function Experiment() { | |||||
| size="small" | size="small" | ||||
| key="batchRemove" | key="batchRemove" | ||||
| icon={<KFIcon type="icon-shanchu" />} | icon={<KFIcon type="icon-shanchu" />} | ||||
| onClick={() => { | |||||
| modalConfirm({ | |||||
| title: '删除后,该实验将不可恢复', | |||||
| content: '是否确认删除?', | |||||
| onOk: () => { | |||||
| deleteExperimentById(record.id).then((ret) => { | |||||
| if (ret.code === 200) { | |||||
| message.success('删除成功'); | |||||
| getExperimentList(); | |||||
| } else { | |||||
| message.error(ret.msg); | |||||
| } | |||||
| }); | |||||
| }, | |||||
| }); | |||||
| }} | |||||
| onClick={() => handleExperimentDelete(record)} | |||||
| > | > | ||||
| 删除 | 删除 | ||||
| </Button> | </Button> | ||||
| @@ -500,6 +510,7 @@ function Experiment() { | |||||
| ), | ), | ||||
| }, | }, | ||||
| ]; | ]; | ||||
| return ( | return ( | ||||
| <div className={styles['experiment-list']}> | <div className={styles['experiment-list']}> | ||||
| <PageTitle title="实验列表"></PageTitle> | <PageTitle title="实验列表"></PageTitle> | ||||
| @@ -117,17 +117,14 @@ function MirrorInfo() { | |||||
| const [res] = await to(deleteMirrorVersionReq(id)); | const [res] = await to(deleteMirrorVersionReq(id)); | ||||
| if (res) { | if (res) { | ||||
| message.success('删除成功'); | message.success('删除成功'); | ||||
| // 如果是一页的唯一数据,删除时,请求第一页的数据 | |||||
| // 如果是一页的唯一数据,删除后,请求第一页的数据 | |||||
| // 否则直接刷新这一页的数据 | // 否则直接刷新这一页的数据 | ||||
| // 避免回到第一页 | |||||
| if (tableData.length === 1) { | |||||
| setPagination((prev) => ({ | |||||
| setPagination((prev) => { | |||||
| return { | |||||
| ...prev, | ...prev, | ||||
| current: 1, | |||||
| })); | |||||
| } else { | |||||
| getMirrorVersionList(); | |||||
| } | |||||
| current: tableData.length === 1 ? Math.max(1, prev.current! - 1) : prev.current, | |||||
| }; | |||||
| }); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -103,17 +103,14 @@ function MirrorList() { | |||||
| const [res] = await to(deleteMirrorReq(id)); | const [res] = await to(deleteMirrorReq(id)); | ||||
| if (res) { | if (res) { | ||||
| message.success('删除成功'); | message.success('删除成功'); | ||||
| // 如果是一页的唯一数据,删除时,请求第一页的数据 | |||||
| // 如果是一页的唯一数据,删除后,请求第一页的数据 | |||||
| // 否则直接刷新这一页的数据 | // 否则直接刷新这一页的数据 | ||||
| // 避免回到第一页 | |||||
| if (tableData.length > 1) { | |||||
| setPagination((prev) => ({ | |||||
| setPagination((prev) => { | |||||
| return { | |||||
| ...prev, | ...prev, | ||||
| current: 1, | |||||
| })); | |||||
| } else { | |||||
| getMirrorList(); | |||||
| } | |||||
| current: tableData.length === 1 ? Math.max(1, prev.current! - 1) : prev.current, | |||||
| }; | |||||
| }); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -119,17 +119,14 @@ function ModelDeployment() { | |||||
| const [res] = await to(deleteServiceReq(record.id)); | const [res] = await to(deleteServiceReq(record.id)); | ||||
| if (res) { | if (res) { | ||||
| message.success('删除成功'); | message.success('删除成功'); | ||||
| // 如果是一页的唯一数据,删除时,请求第一页的数据 | |||||
| // 如果是一页的唯一数据,删除后,请求第一页的数据 | |||||
| // 否则直接刷新这一页的数据 | // 否则直接刷新这一页的数据 | ||||
| // 避免回到第一页 | |||||
| if (tableData.length > 1) { | |||||
| setPagination((prev) => ({ | |||||
| setPagination((prev) => { | |||||
| return { | |||||
| ...prev, | ...prev, | ||||
| current: 1, | |||||
| })); | |||||
| } else { | |||||
| getServiceList(); | |||||
| } | |||||
| current: tableData.length === 1 ? Math.max(1, prev.current! - 1) : prev.current, | |||||
| }; | |||||
| }); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -132,18 +132,14 @@ function ServiceInfo() { | |||||
| const [res] = await to(deleteServiceVersionReq(record.id)); | const [res] = await to(deleteServiceVersionReq(record.id)); | ||||
| if (res) { | if (res) { | ||||
| message.success('删除成功'); | message.success('删除成功'); | ||||
| // 如果是一页的唯一数据,删除时,请求第一页的数据 | |||||
| // 否则直接刷新这一页的数据,避免回到第一页 | |||||
| if (tableData.length === 1) { | |||||
| setPagination((prev) => ({ | |||||
| // 如果是一页的唯一数据,删除后,请求第一页的数据 | |||||
| // 否则直接刷新这一页的数据 | |||||
| setPagination((prev) => { | |||||
| return { | |||||
| ...prev, | ...prev, | ||||
| current: 1, | |||||
| })); | |||||
| } else { | |||||
| setPagination((prev) => ({ | |||||
| ...prev, | |||||
| })); | |||||
| } | |||||
| current: tableData.length === 1 ? Math.max(1, prev.current! - 1) : prev.current, | |||||
| }; | |||||
| }); | |||||
| getServiceInfo(); | getServiceInfo(); | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -127,6 +127,32 @@ const Pipeline = () => { | |||||
| } | } | ||||
| }; | }; | ||||
| // 处理删除 | |||||
| const handlePipelineDelete = (record) => { | |||||
| modalConfirm({ | |||||
| title: '删除后,该流水线将不可恢复', | |||||
| content: '是否确认删除?', | |||||
| onOk: () => { | |||||
| removeWorkflow(record.id).then((ret) => { | |||||
| if (ret.code === 200) { | |||||
| message.success('删除成功'); | |||||
| // 如果是一页的唯一数据,删除后,请求第一页的数据 | |||||
| // 否则直接刷新这一页的数据 | |||||
| setPagination((prev) => { | |||||
| return { | |||||
| ...prev, | |||||
| current: pipeList.length === 1 ? Math.max(1, prev.current - 1) : prev.current, | |||||
| }; | |||||
| }); | |||||
| getList(); | |||||
| } else { | |||||
| message.error(ret.msg); | |||||
| } | |||||
| }); | |||||
| }, | |||||
| }); | |||||
| }; | |||||
| // 当前页面切换 | // 当前页面切换 | ||||
| const paginationChange = async (current, pageSize) => { | const paginationChange = async (current, pageSize) => { | ||||
| setPagination({ | setPagination({ | ||||
| @@ -238,28 +264,7 @@ const Pipeline = () => { | |||||
| size="small" | size="small" | ||||
| key="batchRemove" | key="batchRemove" | ||||
| icon={<KFIcon type="icon-shanchu" />} | icon={<KFIcon type="icon-shanchu" />} | ||||
| onClick={() => { | |||||
| modalConfirm({ | |||||
| title: '删除后,该流水线将不可恢复', | |||||
| content: '是否确认删除?', | |||||
| onOk: () => { | |||||
| removeWorkflow(record.id).then((ret) => { | |||||
| if (ret.code === 200) { | |||||
| message.success('删除成功'); | |||||
| getList(); | |||||
| } else { | |||||
| message.error(ret.msg); | |||||
| } | |||||
| }); | |||||
| // if (success) { | |||||
| // if (actionRef.current) { | |||||
| // actionRef.current.reload(); | |||||
| // } | |||||
| // } | |||||
| }, | |||||
| }); | |||||
| }} | |||||
| onClick={() => handlePipelineDelete(record)} | |||||
| > | > | ||||
| 删除 | 删除 | ||||
| </Button> | </Button> | ||||
| @@ -7,7 +7,7 @@ | |||||
| // 媒体查询 | // 媒体查询 | ||||
| @media screen and (max-width: 1600px) { | @media screen and (max-width: 1600px) { | ||||
| flex: 1 1 content; | |||||
| flex: auto; | |||||
| } | } | ||||
| &__icon { | &__icon { | ||||
| @@ -24,8 +24,7 @@ | |||||
| &__count { | &__count { | ||||
| color: @text-color; | color: @text-color; | ||||
| font-weight: 700; | |||||
| font-size: 25px; | |||||
| font-size: 26px; | |||||
| font-family: DingTalk-JinBuTi; | font-family: DingTalk-JinBuTi; | ||||
| } | } | ||||
| } | } | ||||
| @@ -27,6 +27,7 @@ | |||||
| &__statistics { | &__statistics { | ||||
| flex: none; | flex: none; | ||||
| min-width: 431px; | |||||
| background: linear-gradient( | background: linear-gradient( | ||||
| 123.08deg, | 123.08deg, | ||||
| rgba(138, 138, 138, 0.06) 1.32%, | rgba(138, 138, 138, 0.06) 1.32%, | ||||
| @@ -36,7 +37,7 @@ | |||||
| // 媒体查询 | // 媒体查询 | ||||
| @media screen and (max-width: 1600px) { | @media screen and (max-width: 1600px) { | ||||
| flex: 1 1 content; | |||||
| flex: 1; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||