| @@ -119,6 +119,11 @@ export default [ | |||||
| path: 'create', | path: 'create', | ||||
| component: './DevelopmentEnvironment/Create', | component: './DevelopmentEnvironment/Create', | ||||
| }, | }, | ||||
| { | |||||
| name: '编辑器', | |||||
| path: 'editor', | |||||
| component: './DevelopmentEnvironment/Editor', | |||||
| }, | |||||
| ], | ], | ||||
| }, | }, | ||||
| { | { | ||||
| @@ -0,0 +1,25 @@ | |||||
| import { editorUrl, getSessionStorageItem, removeSessionStorageItem } from '@/utils/sessionStorage'; | |||||
| import { useEffect, useState } from 'react'; | |||||
| function DevEditor() { | |||||
| const [iframeUrl, setIframeUrl] = useState(''); | |||||
| useEffect(() => { | |||||
| const url = getSessionStorageItem(editorUrl) || ''; | |||||
| setIframeUrl(url); | |||||
| return () => { | |||||
| removeSessionStorageItem(editorUrl); | |||||
| }; | |||||
| }, []); | |||||
| // const requestJupyterUrl = async () => { | |||||
| // const [res, error] = await to(getJupyterUrl()); | |||||
| // if (res) { | |||||
| // setIframeUrl(res.data as string); | |||||
| // } else { | |||||
| // console.log(error); | |||||
| // } | |||||
| // }; | |||||
| return <iframe style={{ width: '100%', height: '100%', border: 0 }} src={iframeUrl}></iframe>; | |||||
| } | |||||
| export default DevEditor; | |||||
| @@ -16,6 +16,7 @@ import { | |||||
| } from '@/services/developmentEnvironment'; | } from '@/services/developmentEnvironment'; | ||||
| import themes from '@/styles/theme.less'; | import themes from '@/styles/theme.less'; | ||||
| import { to } from '@/utils/promise'; | import { to } from '@/utils/promise'; | ||||
| import { editorUrl, setSessionStorageItem } from '@/utils/sessionStorage'; | |||||
| import { modalConfirm } from '@/utils/ui'; | import { modalConfirm } from '@/utils/ui'; | ||||
| import { useNavigate } from '@umijs/max'; | import { useNavigate } from '@umijs/max'; | ||||
| import { | import { | ||||
| @@ -128,6 +129,16 @@ function EditorList() { | |||||
| }); | }); | ||||
| }; | }; | ||||
| // 跳转编辑器页面 | |||||
| const gotoEditorPage = (e: React.MouseEvent, record: EditorData) => { | |||||
| e.stopPropagation(); | |||||
| setSessionStorageItem(editorUrl, record.url); | |||||
| navigate(`/developmentEnvironment/editor`); | |||||
| setCacheState({ | |||||
| pagination, | |||||
| }); | |||||
| }; | |||||
| // 分页切换 | // 分页切换 | ||||
| const handleTableChange: TableProps['onChange'] = (pagination, filters, sorter, { action }) => { | const handleTableChange: TableProps['onChange'] = (pagination, filters, sorter, { action }) => { | ||||
| if (action === 'paginate') { | if (action === 'paginate') { | ||||
| @@ -143,9 +154,7 @@ function EditorList() { | |||||
| width: '30%', | width: '30%', | ||||
| render: (text, record) => | render: (text, record) => | ||||
| record.url ? ( | record.url ? ( | ||||
| <a href={record.url} target="_blank" rel="noreferrer"> | |||||
| {text} | |||||
| </a> | |||||
| <a onClick={(e) => gotoEditorPage(e, record)}>{text}</a> | |||||
| ) : ( | ) : ( | ||||
| <span>{text ?? '--'}</span> | <span>{text ?? '--'}</span> | ||||
| ), | ), | ||||
| @@ -1,22 +0,0 @@ | |||||
| import { getJupyterUrl } from '@/services/developmentEnvironment'; | |||||
| import { to } from '@/utils/promise'; | |||||
| import { useEffect, useState } from 'react'; | |||||
| const DevelopmentEnvironment = () => { | |||||
| const [iframeUrl, setIframeUrl] = useState(''); | |||||
| useEffect(() => { | |||||
| requestJupyterUrl(); | |||||
| }, []); | |||||
| const requestJupyterUrl = async () => { | |||||
| const [res, error] = await to(getJupyterUrl()); | |||||
| if (res) { | |||||
| setIframeUrl(res.data as string); | |||||
| } else { | |||||
| console.log(error); | |||||
| } | |||||
| }; | |||||
| return <iframe style={{ width: '100%', height: '100%', border: 0 }} src={iframeUrl}></iframe>; | |||||
| }; | |||||
| export default DevelopmentEnvironment; | |||||
| @@ -93,11 +93,11 @@ const EditPipeline = () => { | |||||
| return; | return; | ||||
| } | } | ||||
| // const [propsRes, propsError] = await to(propsRef.current.getFieldsValue()); | |||||
| // if (propsError) { | |||||
| // message.error('基本信息必填项需配置'); | |||||
| // return; | |||||
| // } | |||||
| const [propsRes, propsError] = await to(propsRef.current.getFieldsValue()); | |||||
| if (propsError) { | |||||
| message.error('节点必填项必须配置'); | |||||
| return; | |||||
| } | |||||
| propsRef.current.propClose(); | propsRef.current.propClose(); | ||||
| setTimeout(() => { | setTimeout(() => { | ||||
| const data = graph.save(); | const data = graph.save(); | ||||
| @@ -1,9 +1,8 @@ | |||||
| import { request } from '@umijs/max'; | import { request } from '@umijs/max'; | ||||
| // 查询开发环境url | // 查询开发环境url | ||||
| export function getJupyterUrl(params: any) { | |||||
| export function getJupyterUrl() { | |||||
| return request(`/api/mmp/jupyter/getURL`, { | return request(`/api/mmp/jupyter/getURL`, { | ||||
| method: 'GET', | method: 'GET', | ||||
| params, | |||||
| }); | }); | ||||
| } | } | ||||
| @@ -2,6 +2,8 @@ | |||||
| export const mirrorNameKey = 'mirror-name'; | export const mirrorNameKey = 'mirror-name'; | ||||
| // 模型部署 | // 模型部署 | ||||
| export const modelDeploymentInfoKey = 'model-deployment-info'; | export const modelDeploymentInfoKey = 'model-deployment-info'; | ||||
| // 编辑器 url | |||||
| export const editorUrl = 'editor-url'; | |||||
| export const getSessionStorageItem = (key: string, isObject: boolean = false) => { | export const getSessionStorageItem = (key: string, isObject: boolean = false) => { | ||||
| const jsonStr = sessionStorage.getItem(key); | const jsonStr = sessionStorage.getItem(key); | ||||
| @@ -20,6 +20,7 @@ | |||||
| "noUnusedParameters": true, // 报告未使用的参数错误 | "noUnusedParameters": true, // 报告未使用的参数错误 | ||||
| "incremental": true, // 通过读写磁盘上的文件来启用增量编译 | "incremental": true, // 通过读写磁盘上的文件来启用增量编译 | ||||
| "noFallthroughCasesInSwitch": true, // 报告switch语句中的fallthrough案例错误 | "noFallthroughCasesInSwitch": true, // 报告switch语句中的fallthrough案例错误 | ||||
| "strictNullChecks": true, // 启用严格的null检查 | |||||
| "baseUrl": "./", | "baseUrl": "./", | ||||
| "paths": { | "paths": { | ||||
| "@/*": ["src/*"], | "@/*": ["src/*"], | ||||