Browse Source

Merge pull request '合并dev-zw' (#190) from dev-zw into dev

dev-active_learn
cp3hnu 10 months ago
parent
commit
1f4a5a0250
17 changed files with 141 additions and 132 deletions
  1. +4
    -6
      react-ui/src/app.tsx
  2. +0
    -0
      react-ui/src/components/CopyingText/clipboard.js
  3. +0
    -0
      react-ui/src/components/CopyingText/index.less
  4. +26
    -0
      react-ui/src/components/CopyingText/index.tsx
  5. +0
    -26
      react-ui/src/pages/AutoML/components/CopyingText/index.tsx
  6. +6
    -9
      react-ui/src/pages/AutoML/components/ExperimentList/index.tsx
  7. +8
    -1
      react-ui/src/pages/CodeConfig/List/index.tsx
  8. +8
    -1
      react-ui/src/pages/Dataset/components/ResourceList/index.tsx
  9. +6
    -9
      react-ui/src/pages/DevelopmentEnvironment/List/index.tsx
  10. +27
    -16
      react-ui/src/pages/Experiment/index.jsx
  11. +6
    -9
      react-ui/src/pages/Mirror/Info/index.tsx
  12. +6
    -9
      react-ui/src/pages/Mirror/List/index.tsx
  13. +6
    -9
      react-ui/src/pages/ModelDeployment/List/index.tsx
  14. +7
    -11
      react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx
  15. +27
    -22
      react-ui/src/pages/Pipeline/index.jsx
  16. +2
    -3
      react-ui/src/pages/Workspace/components/TotalStatistics/index.less
  17. +2
    -1
      react-ui/src/pages/Workspace/index.less

+ 4
- 6
react-ui/src/app.tsx View File

@@ -1,11 +1,14 @@
import RightContent from '@/components/RightContent';
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 { RuntimeConfig, history } from '@umijs/max';
import { RuntimeAntdConfig } from 'umi';
import defaultSettings from '../config/defaultSettings';
import '../public/fonts/font.css';
import { getAccessToken } from './access';
import ErrorBoundary from './components/ErrorBoundary';
import './dayjsConfig';
import { removeAllPageCacheState } from './hooks/pageCacheState';
import {
@@ -16,14 +19,9 @@ import {
setRemoteMenu,
} from './services/session';
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 { gotoLoginPage } from './utils/ui';
export { requestConfig as request } from './requestConfig';

/**
* @see https://umijs.org/zh-CN/plugins/plugin-initial-state


react-ui/src/utils/clipboard.js → react-ui/src/components/CopyingText/clipboard.js View File


react-ui/src/pages/AutoML/components/CopyingText/index.less → react-ui/src/components/CopyingText/index.less View File


+ 26
- 0
react-ui/src/components/CopyingText/index.tsx View File

@@ -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;

+ 0
- 26
react-ui/src/pages/AutoML/components/CopyingText/index.tsx View File

@@ -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;

+ 6
- 9
react-ui/src/pages/AutoML/components/ExperimentList/index.tsx View File

@@ -93,17 +93,14 @@ function ExperimentList({ type }: ExperimentListProps) {
const [res] = await to(request(record.id));
if (res) {
message.success('删除成功');
// 如果是一页的唯一数据,删除,请求第一页的数据
// 如果是一页的唯一数据,删除,请求第一页的数据
// 否则直接刷新这一页的数据
// 避免回到第一页
if (tableData.length > 1) {
setPagination((prev) => ({
setPagination((prev) => {
return {
...prev,
current: 1,
}));
} else {
getAutoMLList();
}
current: tableData.length === 1 ? Math.max(1, prev.current! - 1) : prev.current,
};
});
}
};



+ 8
- 1
react-ui/src/pages/CodeConfig/List/index.tsx View File

@@ -75,8 +75,15 @@ function CodeConfigList() {
const deleteRecord = async (id: number) => {
const [res] = await to(deleteCodeConfigReq(id));
if (res) {
getDataList();
message.success('删除成功');
// 如果是一页的唯一数据,删除后,请求第一页的数据
// 否则直接刷新这一页的数据
setPagination((prev) => {
return {
...prev,
current: dataList!.length === 1 ? Math.max(1, prev.current! - 1) : prev.current,
};
});
}
};



+ 8
- 1
react-ui/src/pages/Dataset/components/ResourceList/index.tsx View File

@@ -107,8 +107,15 @@ function ResourceList(
const request = config.deleteRecord;
const [res] = await to(request(params));
if (res) {
getDataList();
message.success('删除成功');
// 如果是一页的唯一数据,删除后,请求第一页的数据
// 否则直接刷新这一页的数据
setPagination((prev) => {
return {
...prev,
current: dataList!.length === 1 ? Math.max(1, prev.current! - 1) : prev.current,
};
});
}
};



+ 6
- 9
react-ui/src/pages/DevelopmentEnvironment/List/index.tsx View File

@@ -80,17 +80,14 @@ function EditorList() {
const [res] = await to(deleteEditorReq(id));
if (res) {
message.success('删除成功');
// 如果是一页的唯一数据,删除,请求第一页的数据
// 如果是一页的唯一数据,删除,请求第一页的数据
// 否则直接刷新这一页的数据
// 避免回到第一页
if (tableData.length > 1) {
setPagination((prev) => ({
setPagination((prev) => {
return {
...prev,
current: 1,
}));
} else {
getEditorList();
}
current: tableData.length === 1 ? Math.max(1, prev.current! - 1) : prev.current,
};
});
}
};



+ 27
- 16
react-ui/src/pages/Experiment/index.jsx View File

@@ -378,6 +378,31 @@ function Experiment() {
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 = [
{
title: '实验名称',
@@ -476,22 +501,7 @@ function Experiment() {
size="small"
key="batchRemove"
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>
@@ -500,6 +510,7 @@ function Experiment() {
),
},
];

return (
<div className={styles['experiment-list']}>
<PageTitle title="实验列表"></PageTitle>


+ 6
- 9
react-ui/src/pages/Mirror/Info/index.tsx View File

@@ -117,17 +117,14 @@ function MirrorInfo() {
const [res] = await to(deleteMirrorVersionReq(id));
if (res) {
message.success('删除成功');
// 如果是一页的唯一数据,删除,请求第一页的数据
// 如果是一页的唯一数据,删除,请求第一页的数据
// 否则直接刷新这一页的数据
// 避免回到第一页
if (tableData.length === 1) {
setPagination((prev) => ({
setPagination((prev) => {
return {
...prev,
current: 1,
}));
} else {
getMirrorVersionList();
}
current: tableData.length === 1 ? Math.max(1, prev.current! - 1) : prev.current,
};
});
}
};



+ 6
- 9
react-ui/src/pages/Mirror/List/index.tsx View File

@@ -103,17 +103,14 @@ function MirrorList() {
const [res] = await to(deleteMirrorReq(id));
if (res) {
message.success('删除成功');
// 如果是一页的唯一数据,删除,请求第一页的数据
// 如果是一页的唯一数据,删除,请求第一页的数据
// 否则直接刷新这一页的数据
// 避免回到第一页
if (tableData.length > 1) {
setPagination((prev) => ({
setPagination((prev) => {
return {
...prev,
current: 1,
}));
} else {
getMirrorList();
}
current: tableData.length === 1 ? Math.max(1, prev.current! - 1) : prev.current,
};
});
}
};



+ 6
- 9
react-ui/src/pages/ModelDeployment/List/index.tsx View File

@@ -119,17 +119,14 @@ function ModelDeployment() {
const [res] = await to(deleteServiceReq(record.id));
if (res) {
message.success('删除成功');
// 如果是一页的唯一数据,删除,请求第一页的数据
// 如果是一页的唯一数据,删除,请求第一页的数据
// 否则直接刷新这一页的数据
// 避免回到第一页
if (tableData.length > 1) {
setPagination((prev) => ({
setPagination((prev) => {
return {
...prev,
current: 1,
}));
} else {
getServiceList();
}
current: tableData.length === 1 ? Math.max(1, prev.current! - 1) : prev.current,
};
});
}
};



+ 7
- 11
react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx View File

@@ -132,18 +132,14 @@ function ServiceInfo() {
const [res] = await to(deleteServiceVersionReq(record.id));
if (res) {
message.success('删除成功');
// 如果是一页的唯一数据,删除,请求第一页的数据
// 否则直接刷新这一页的数据,避免回到第一页
if (tableData.length === 1) {
setPagination((prev) => ({
// 如果是一页的唯一数据,删除,请求第一页的数据
// 否则直接刷新这一页的数据
setPagination((prev) => {
return {
...prev,
current: 1,
}));
} else {
setPagination((prev) => ({
...prev,
}));
}
current: tableData.length === 1 ? Math.max(1, prev.current! - 1) : prev.current,
};
});
getServiceInfo();
}
};


+ 27
- 22
react-ui/src/pages/Pipeline/index.jsx View File

@@ -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) => {
setPagination({
@@ -238,28 +264,7 @@ const Pipeline = () => {
size="small"
key="batchRemove"
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>


+ 2
- 3
react-ui/src/pages/Workspace/components/TotalStatistics/index.less View File

@@ -7,7 +7,7 @@

// 媒体查询
@media screen and (max-width: 1600px) {
flex: 1 1 content;
flex: auto;
}

&__icon {
@@ -24,8 +24,7 @@

&__count {
color: @text-color;
font-weight: 700;
font-size: 25px;
font-size: 26px;
font-family: DingTalk-JinBuTi;
}
}

+ 2
- 1
react-ui/src/pages/Workspace/index.less View File

@@ -27,6 +27,7 @@

&__statistics {
flex: none;
min-width: 431px;
background: linear-gradient(
123.08deg,
rgba(138, 138, 138, 0.06) 1.32%,
@@ -36,7 +37,7 @@

// 媒体查询
@media screen and (max-width: 1600px) {
flex: 1 1 content;
flex: 1;
}
}
}


Loading…
Cancel
Save