diff --git a/react-ui/src/pages/DevelopmentEnvironment/List/index.tsx b/react-ui/src/pages/DevelopmentEnvironment/List/index.tsx
index 504a4d9d..2b8fdf4e 100644
--- a/react-ui/src/pages/DevelopmentEnvironment/List/index.tsx
+++ b/react-ui/src/pages/DevelopmentEnvironment/List/index.tsx
@@ -3,6 +3,7 @@
* @Date: 2024-04-16 13:58:08
* @Description: 开发环境列表
*/
+
import CommonTableCell from '@/components/CommonTableCell';
import DateTableCell from '@/components/DateTableCell';
import KFIcon from '@/components/KFIcon';
@@ -15,6 +16,7 @@ import {
stopEditorReq,
} from '@/services/developmentEnvironment';
import themes from '@/styles/theme.less';
+import { openAntdModal } from '@/utils/modal';
import { to } from '@/utils/promise';
import { editorUrlKey, setSessionStorageItem } from '@/utils/sessionStorage';
import { modalConfirm } from '@/utils/ui';
@@ -29,6 +31,7 @@ import {
} from 'antd';
import classNames from 'classnames';
import { useEffect, useState } from 'react';
+import CreateMirrorModal from '../components/CreateMirrorModal';
import EditorStatusCell from '../components/EditorStatusCell';
import styles from './index.less';
@@ -110,6 +113,16 @@ function EditorList() {
}
};
+ // 制作镜像
+ const createMirror = (id: number) => {
+ const { close } = openAntdModal(CreateMirrorModal, {
+ envId: id,
+ onOk: () => {
+ close();
+ },
+ });
+ };
+
// 处理删除
const handleEditorDelete = (record: EditorData) => {
modalConfirm({
@@ -218,6 +231,17 @@ function EditorList() {
启动
)}
+ {record.status === DevEditorStatus.Running ? (
+ }
+ onClick={() => createMirror(record.id)}
+ >
+ 制作镜像
+
+ ) : null}
{
+ envId: number; // 开发环境id
+ onOk: () => void;
+}
+
+function CreateMirrorModal({ envId, onOk, ...rest }: CreateMirrorModalProps) {
+ // 上传请求
+ const createDatasetVersion = async (params: any) => {
+ const [res] = await to(
+ createEditorMirrorReq({
+ ...params,
+ dev_environment_id: envId,
+ upload_type: 1,
+ version: params['tagName'],
+ }),
+ );
+ if (res) {
+ message.success('创建成功,请到 “AI资产” - “个人镜像” 中查看');
+ onOk?.();
+ }
+ };
+
+ // 提交
+ const onFinish = (formData: any) => {
+ createDatasetVersion(formData);
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+export default CreateMirrorModal;
diff --git a/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx b/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx
index becfc0a7..126e0557 100644
--- a/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx
+++ b/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx
@@ -51,7 +51,7 @@ export const getParamRules = (paramType: number, required: boolean = false): For
// 防止后台返回不是 number 类型
if (Number(paramType) === 2) {
rules.push({
- pattern: /^-?\d+(\.\d+)?$/,
+ pattern: /^-?((0(\.0*[1-9]\d*)?)|([1-9]\d*(\.\d+)?))$/,
message: '整型必须是数字',
});
}
diff --git a/react-ui/src/pages/Mirror/Create/index.tsx b/react-ui/src/pages/Mirror/Create/index.tsx
index 2f03a901..4c60cc77 100644
--- a/react-ui/src/pages/Mirror/Create/index.tsx
+++ b/react-ui/src/pages/Mirror/Create/index.tsx
@@ -153,6 +153,10 @@ function MirrorCreate() {
required: true,
message: '请输入镜像名称',
},
+ {
+ pattern: /^[a-zA-Z0-9_-]*$/,
+ message: '只支持字母、数字、下划线、中横线',
+ },
]}
>
diff --git a/react-ui/src/services/developmentEnvironment/index.ts b/react-ui/src/services/developmentEnvironment/index.ts
index 1d7b6f4d..31f81736 100644
--- a/react-ui/src/services/developmentEnvironment/index.ts
+++ b/react-ui/src/services/developmentEnvironment/index.ts
@@ -49,9 +49,18 @@ export function startEditorReq(id: number) {
method: 'POST',
});
}
+
// 停止编辑器
export function stopEditorReq(id: number) {
return request(`/api/mmp/jupyter/stop/${id}`, {
method: 'DELETE',
});
}
+
+// 制作镜像
+export function createEditorMirrorReq(data: any) {
+ return request(`/api/mmp/image/saveImage`, {
+ method: 'POST',
+ data,
+ });
+}