| @@ -58,6 +58,8 @@ type IframePageProps = { | |||||
| url?: string; | url?: string; | ||||
| /** 是否可以在页签上打开 */ | /** 是否可以在页签上打开 */ | ||||
| openInTab?: boolean; | openInTab?: boolean; | ||||
| /** 是否显示加载 */ | |||||
| showLoading?: boolean; | |||||
| /** 自定义样式类名 */ | /** 自定义样式类名 */ | ||||
| className?: string; | className?: string; | ||||
| /** 自定义样式 */ | /** 自定义样式 */ | ||||
| @@ -65,40 +67,54 @@ type IframePageProps = { | |||||
| }; | }; | ||||
| /** 系统内嵌 iframe,目前系统有数据标注、应用开发、开发环境、GitLink 四个子系统,使用时可以添加其他子系统 */ | /** 系统内嵌 iframe,目前系统有数据标注、应用开发、开发环境、GitLink 四个子系统,使用时可以添加其他子系统 */ | ||||
| function IframePage({ type, url, openInTab = false, className, style }: IframePageProps) { | |||||
| function IframePage({ | |||||
| type, | |||||
| url, | |||||
| showLoading = true, | |||||
| openInTab = false, | |||||
| className, | |||||
| style, | |||||
| }: IframePageProps) { | |||||
| const [iframeUrl, setIframeUrl] = useState(''); | const [iframeUrl, setIframeUrl] = useState(''); | ||||
| // const [loading, setLoading] = useState(false); | // const [loading, setLoading] = useState(false); | ||||
| useEffect(() => { | useEffect(() => { | ||||
| const requestIframeUrl = async (type: IframePageType) => { | const requestIframeUrl = async (type: IframePageType) => { | ||||
| // setLoading(true); | |||||
| Loading.show(); | |||||
| if (showLoading) { | |||||
| Loading.show(); | |||||
| } | |||||
| const [res] = await to(getRequestAPI(type)()); | const [res] = await to(getRequestAPI(type)()); | ||||
| if (res && res.data) { | if (res && res.data) { | ||||
| setIframeUrl(res.data); | setIframeUrl(res.data); | ||||
| } else { | } else { | ||||
| Loading.hide(); | |||||
| // setLoading(false); | |||||
| if (showLoading) { | |||||
| Loading.hide(); | |||||
| } | |||||
| } | } | ||||
| }; | }; | ||||
| if (type) { | if (type) { | ||||
| requestIframeUrl(type); | requestIframeUrl(type); | ||||
| } else if (url) { | } else if (url) { | ||||
| Loading.show(); | |||||
| if (showLoading) { | |||||
| Loading.show(); | |||||
| } | |||||
| setIframeUrl(url); | setIframeUrl(url); | ||||
| } | } | ||||
| }, [type, url]); | |||||
| }, [type, url, showLoading]); | |||||
| const handleLoad = () => { | const handleLoad = () => { | ||||
| // setLoading(false); | |||||
| Loading.hide(); | |||||
| if (showLoading) { | |||||
| Loading.hide(); | |||||
| } | |||||
| }; | }; | ||||
| const handleError = (error?: React.SyntheticEvent<HTMLIFrameElement, Event>) => { | const handleError = (error?: React.SyntheticEvent<HTMLIFrameElement, Event>) => { | ||||
| // setLoading(false); | |||||
| console.log('error', error); | console.log('error', error); | ||||
| Loading.hide(); | |||||
| if (showLoading) { | |||||
| Loading.hide(); | |||||
| } | |||||
| }; | }; | ||||
| return ( | return ( | ||||
| @@ -395,9 +395,9 @@ function ExperimentList({ type }: ExperimentListProps) { | |||||
| }, | }, | ||||
| ...diffColumns, | ...diffColumns, | ||||
| { | { | ||||
| title: '创建时间', | |||||
| dataIndex: 'create_time', | |||||
| key: 'create_time', | |||||
| title: '更新时间', | |||||
| dataIndex: 'update_time', | |||||
| key: 'update_time', | |||||
| width: '20%', | width: '20%', | ||||
| render: tableCellRender(true, TableCellValueType.Date), | render: tableCellRender(true, TableCellValueType.Date), | ||||
| }, | }, | ||||
| @@ -58,7 +58,7 @@ function ServiceVersionInfo() { | |||||
| key: ModelDeploymentTabKey.Predict, | key: ModelDeploymentTabKey.Predict, | ||||
| label: '预测', | label: '预测', | ||||
| icon: <KFIcon type="icon-yuce" />, | icon: <KFIcon type="icon-yuce" />, | ||||
| children: <IframePage url={versionInfo?.page_path}></IframePage>, | |||||
| children: <IframePage url={versionInfo?.page_path} showLoading={false}></IframePage>, | |||||
| }); | }); | ||||
| } | } | ||||
| @@ -110,7 +110,7 @@ const EditPipeline = () => { | |||||
| // console.log(data); | // console.log(data); | ||||
| const errorNode = data.nodes.find((item) => item.formError === true); | const errorNode = data.nodes.find((item) => item.formError === true); | ||||
| if (errorNode) { | if (errorNode) { | ||||
| message.error(`【${errorNode.label}】节点必填项必须配置`); | |||||
| message.error(`【${errorNode.label}】节点配置验证失败`); | |||||
| const graphNode = graph.findById(errorNode.id); | const graphNode = graph.findById(errorNode.id); | ||||
| if (graphNode) { | if (graphNode) { | ||||
| openNodeDrawer(graphNode, true); | openNodeDrawer(graphNode, true); | ||||
| @@ -19,6 +19,7 @@ import { openAntdModal } from '@/utils/modal'; | |||||
| import { to } from '@/utils/promise'; | import { to } from '@/utils/promise'; | ||||
| import { INode } from '@antv/g6'; | import { INode } from '@antv/g6'; | ||||
| import { Button, Drawer, Form, Input, MenuProps } from 'antd'; | import { Button, Drawer, Form, Input, MenuProps } from 'antd'; | ||||
| import { RuleObject } from 'antd/es/form'; | |||||
| import { NamePath } from 'antd/es/form/interface'; | import { NamePath } from 'antd/es/form/interface'; | ||||
| import { forwardRef, useImperativeHandle, useState } from 'react'; | import { forwardRef, useImperativeHandle, useState } from 'react'; | ||||
| import PropsLabel from '../PropsLabel'; | import PropsLabel from '../PropsLabel'; | ||||
| @@ -309,16 +310,41 @@ const PipelineNodeParameter = forwardRef(({ onFormChange }: PipelineNodeParamete | |||||
| ); | ); | ||||
| }; | }; | ||||
| // 模型部署-服务版本验证 | |||||
| const serviceVersionValidator = (_rule: RuleObject, value: any) => { | |||||
| // 输入参数值都是对象,如果是手动输入,要求 /^[a-zA-Z0-9._-]+$/ | |||||
| if ( | |||||
| typeof value === 'object' && | |||||
| value && | |||||
| !value.fromSelect && | |||||
| value.value && | |||||
| !/^[a-zA-Z0-9._-]+$/.test(value.value) | |||||
| ) { | |||||
| return Promise.reject('服务版本只支持字母、数字、点(.)、下划线(_)、中横线(-)'); | |||||
| } | |||||
| return Promise.resolve(); | |||||
| }; | |||||
| // 必填项校验规则 | // 必填项校验规则 | ||||
| const getFormRules = (item: { key: string; value: PipelineNodeModelParameter }) => { | const getFormRules = (item: { key: string; value: PipelineNodeModelParameter }) => { | ||||
| return item.value.require | |||||
| const id = form.getFieldValue('id') as string; | |||||
| const rules = item.value.require | |||||
| ? [ | ? [ | ||||
| { | { | ||||
| validator: requiredValidator, | validator: requiredValidator, | ||||
| message: '必填项', | |||||
| }, | }, | ||||
| ] | ] | ||||
| : []; | : []; | ||||
| // 模型部署-服务版本验证 | |||||
| if (id.startsWith('model-deploy') && item.key === '--version') { | |||||
| rules.push({ | |||||
| validator: serviceVersionValidator, | |||||
| }); | |||||
| } | |||||
| return rules; | |||||
| }; | }; | ||||
| // 控制策略 | // 控制策略 | ||||