style: backend check info
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
.alert-info-block {
|
.alert-info-block {
|
||||||
padding: 6px 10px;
|
padding: 6px 10px;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-top: 35px;
|
padding-left: 32px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
border-radius: var(--border-radius-base);
|
border-radius: var(--border-radius-base);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@@ -30,22 +30,11 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 30px;
|
height: 32px;
|
||||||
width: 100%;
|
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
border-radius: var(--border-radius-base) var(--border-radius-base) 0 0;
|
border-radius: var(--border-radius-base) var(--border-radius-base) 0 0;
|
||||||
|
|
||||||
&.danger {
|
|
||||||
background-color: var(--ant-color-error-bg-filled-hover);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.warning {
|
|
||||||
background-color: var(--ant-color-warning-bg-hover);
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-icon {
|
.info-icon {
|
||||||
margin-right: 8px;
|
|
||||||
|
|
||||||
&.danger {
|
&.danger {
|
||||||
color: var(--ant-color-error);
|
color: var(--ant-color-error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ interface AlertInfoProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const AlertInfo: React.FC<AlertInfoProps> = (props) => {
|
const AlertInfo: React.FC<AlertInfoProps> = (props) => {
|
||||||
const { message, type, rows = 1, ellipsis, style, title } = props;
|
const { message, type, rows = 1, ellipsis, style } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -25,17 +25,14 @@ const AlertInfo: React.FC<AlertInfoProps> = (props) => {
|
|||||||
>
|
>
|
||||||
<Typography.Paragraph
|
<Typography.Paragraph
|
||||||
ellipsis={
|
ellipsis={
|
||||||
ellipsis !== undefined
|
ellipsis ?? {
|
||||||
? ellipsis
|
rows: rows,
|
||||||
: {
|
tooltip: message
|
||||||
rows: rows,
|
}
|
||||||
tooltip: message
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div className={classNames('title', type)}>
|
<div className={classNames('title', type)}>
|
||||||
<WarningFilled className={classNames('info-icon', type)} />
|
<WarningFilled className={classNames('info-icon', type)} />
|
||||||
<span className="text">{title}</span>
|
|
||||||
</div>
|
</div>
|
||||||
<span className="content">{message}</span>
|
<span className="content">{message}</span>
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { useIntl } from '@umijs/max';
|
||||||
|
|
||||||
|
const useAppUtils = () => {
|
||||||
|
const intl = useIntl();
|
||||||
|
|
||||||
|
const getRuleMessage = (
|
||||||
|
type: 'input' | 'select',
|
||||||
|
name: string,
|
||||||
|
locale = true
|
||||||
|
) => {
|
||||||
|
const nameStr = locale ? intl.formatMessage({ id: name }) : name;
|
||||||
|
|
||||||
|
if (type === 'input') {
|
||||||
|
return intl.formatMessage(
|
||||||
|
{ id: 'common.form.rule.input' },
|
||||||
|
{ name: nameStr }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return intl.formatMessage(
|
||||||
|
{ id: 'common.form.rule.select' },
|
||||||
|
{ name: nameStr }
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
getRuleMessage
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useAppUtils;
|
||||||
+14
-17
@@ -17,6 +17,7 @@ import {
|
|||||||
import { getAllLocales, history, setLocale } from '@umijs/max';
|
import { getAllLocales, history, setLocale } from '@umijs/max';
|
||||||
import { Avatar, Menu, Spin } from 'antd';
|
import { Avatar, Menu, Spin } from 'antd';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
export const getRightRenderContent = (opts: {
|
export const getRightRenderContent = (opts: {
|
||||||
runtimeConfig: any;
|
runtimeConfig: any;
|
||||||
@@ -282,27 +283,23 @@ export const getRightRenderContent = (opts: {
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getMenuStyle = (
|
||||||
|
collapsed: boolean,
|
||||||
|
siderWidth: number,
|
||||||
|
extraStyle: React.CSSProperties = {}
|
||||||
|
) => ({
|
||||||
|
width: collapsed ? 40 : `calc(${siderWidth}px - 16px)`,
|
||||||
|
...extraStyle
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Menu
|
<Menu {...helpMenu} style={getMenuStyle(collapsed, siderWidth)} />
|
||||||
{...helpMenu}
|
<Menu {...langMenu} style={getMenuStyle(collapsed, siderWidth)} />
|
||||||
style={{
|
|
||||||
width: collapsed ? 40 : `calc(${siderWidth}px - 16px)`
|
|
||||||
}}
|
|
||||||
></Menu>
|
|
||||||
<Menu
|
|
||||||
{...langMenu}
|
|
||||||
style={{
|
|
||||||
width: collapsed ? 40 : `calc(${siderWidth}px - 16px)`
|
|
||||||
}}
|
|
||||||
></Menu>
|
|
||||||
<Menu
|
<Menu
|
||||||
{...userMenu}
|
{...userMenu}
|
||||||
style={{
|
style={getMenuStyle(collapsed, siderWidth, { marginTop: 20 })}
|
||||||
width: collapsed ? 40 : `calc(${siderWidth}px - 16px)`,
|
/>
|
||||||
marginTop: 20
|
|
||||||
}}
|
|
||||||
></Menu>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import SealInput from '@/components/seal-form/seal-input';
|
|||||||
import SealSelect from '@/components/seal-form/seal-select';
|
import SealSelect from '@/components/seal-form/seal-select';
|
||||||
import TooltipList from '@/components/tooltip-list';
|
import TooltipList from '@/components/tooltip-list';
|
||||||
import { PageActionType } from '@/config/types';
|
import { PageActionType } from '@/config/types';
|
||||||
|
import useAppUtils from '@/hooks/use-app-utils';
|
||||||
import { QuestionCircleOutlined, RightOutlined } from '@ant-design/icons';
|
import { QuestionCircleOutlined, RightOutlined } from '@ant-design/icons';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import {
|
import {
|
||||||
@@ -42,6 +43,7 @@ interface AdvanceConfigProps {
|
|||||||
|
|
||||||
const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
||||||
const { form, isGGUF, gpuOptions, source } = props;
|
const { form, isGGUF, gpuOptions, source } = props;
|
||||||
|
const { getRuleMessage } = useAppUtils();
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const wokerSelector = Form.useWatch('worker_selector', form);
|
const wokerSelector = Form.useWatch('worker_selector', form);
|
||||||
const EnviromentVars = Form.useWatch('env', form);
|
const EnviromentVars = Form.useWatch('env', form);
|
||||||
@@ -289,16 +291,7 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('select', 'models.form.gpuselector')
|
||||||
{
|
|
||||||
id: 'common.form.rule.select'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: intl.formatMessage({
|
|
||||||
id: 'models.form.gpuselector'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import SealSelect from '@/components/seal-form/seal-select';
|
|||||||
import TooltipList from '@/components/tooltip-list';
|
import TooltipList from '@/components/tooltip-list';
|
||||||
import { PageAction } from '@/config';
|
import { PageAction } from '@/config';
|
||||||
import { PageActionType } from '@/config/types';
|
import { PageActionType } from '@/config/types';
|
||||||
|
import useAppUtils from '@/hooks/use-app-utils';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Form, Typography } from 'antd';
|
import { Form, Typography } from 'antd';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
@@ -53,13 +54,6 @@ interface DataFormProps {
|
|||||||
fields?: string[];
|
fields?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GPUOption {
|
|
||||||
label: string;
|
|
||||||
value: string;
|
|
||||||
disableCheckbox?: boolean;
|
|
||||||
children: GPUOption[];
|
|
||||||
}
|
|
||||||
|
|
||||||
const SEARCH_SOURCE = [
|
const SEARCH_SOURCE = [
|
||||||
modelSourceMap.huggingface_value,
|
modelSourceMap.huggingface_value,
|
||||||
modelSourceMap.modelscope_value
|
modelSourceMap.modelscope_value
|
||||||
@@ -80,7 +74,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
onSourceChange,
|
onSourceChange,
|
||||||
onOk
|
onOk
|
||||||
} = props;
|
} = props;
|
||||||
console.log('DataForm -> props');
|
const { getRuleMessage } = useAppUtils();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [modelTask, setModelTask] = useState<Record<string, any>>({
|
const [modelTask, setModelTask] = useState<Record<string, any>>({
|
||||||
@@ -208,12 +202,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('input', 'models.form.repoid')
|
||||||
{
|
|
||||||
id: 'common.form.rule.input'
|
|
||||||
},
|
|
||||||
{ name: intl.formatMessage({ id: 'models.form.repoid' }) }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -230,12 +219,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('input', 'models.form.filename')
|
||||||
{
|
|
||||||
id: 'common.form.rule.input'
|
|
||||||
},
|
|
||||||
{ name: intl.formatMessage({ id: 'models.form.filename' }) }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -259,12 +243,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('input', 'models.table.name')
|
||||||
{
|
|
||||||
id: 'common.form.rule.input'
|
|
||||||
},
|
|
||||||
{ name: intl.formatMessage({ id: 'models.table.name' }) }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -308,12 +287,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('input', 'models.form.filePath')
|
||||||
{
|
|
||||||
id: 'common.form.rule.input'
|
|
||||||
},
|
|
||||||
{ name: intl.formatMessage({ id: 'models.form.filePath' }) }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -351,12 +325,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('input', 'size', false)
|
||||||
{
|
|
||||||
id: 'common.form.rule.select'
|
|
||||||
},
|
|
||||||
{ name: 'size' }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -378,12 +347,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('select', 'quantization', false)
|
||||||
{
|
|
||||||
id: 'common.form.rule.select'
|
|
||||||
},
|
|
||||||
{ name: 'quantization' }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -534,12 +498,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('input', 'common.table.name')
|
||||||
{
|
|
||||||
id: 'common.form.rule.input'
|
|
||||||
},
|
|
||||||
{ name: intl.formatMessage({ id: 'common.table.name' }) }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -556,12 +515,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('select', 'models.form.source')
|
||||||
{
|
|
||||||
id: 'common.form.rule.select'
|
|
||||||
},
|
|
||||||
{ name: intl.formatMessage({ id: 'models.form.source' }) }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -627,14 +581,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('input', 'models.form.replicas')
|
||||||
{
|
|
||||||
id: 'common.form.rule.input'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: intl.formatMessage({ id: 'models.form.replicas' })
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { CloseOutlined } from '@ant-design/icons';
|
|||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button, Drawer } from 'antd';
|
import { Button, Drawer } from 'antd';
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { FC, useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { backendOptionsMap, modelSourceMap } from '../config';
|
import { backendOptionsMap, modelSourceMap } from '../config';
|
||||||
import { FormData } from '../config/types';
|
import { FormData } from '../config/types';
|
||||||
import ColumnWrapper from './column-wrapper';
|
import ColumnWrapper from './column-wrapper';
|
||||||
@@ -27,7 +27,7 @@ type AddModalProps = {
|
|||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const AddModal: React.FC<AddModalProps> = (props) => {
|
const AddModal: FC<AddModalProps> = (props) => {
|
||||||
const {
|
const {
|
||||||
title,
|
title,
|
||||||
open,
|
open,
|
||||||
@@ -235,28 +235,30 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
)}
|
)}
|
||||||
<div style={{ display: 'flex', flex: 1, maxWidth: '100%' }}>
|
<div style={{ display: 'flex', flex: 1, maxWidth: '100%' }}>
|
||||||
<ColumnWrapper
|
<ColumnWrapper
|
||||||
paddingBottom={warningStatus.show ? 155 : 50}
|
paddingBottom={warningStatus.show ? 125 : 50}
|
||||||
footer={
|
footer={
|
||||||
<>
|
<>
|
||||||
{warningStatus.show && (
|
<div style={{ paddingInline: 12 }}>
|
||||||
<AlertBlockInfo
|
{warningStatus.show && (
|
||||||
ellipsis={false}
|
<AlertBlockInfo
|
||||||
message={
|
ellipsis={false}
|
||||||
<span
|
message={
|
||||||
style={{}}
|
<span
|
||||||
dangerouslySetInnerHTML={{
|
style={{}}
|
||||||
__html: intl.formatMessage({
|
dangerouslySetInnerHTML={{
|
||||||
id: warningStatus.message
|
__html: intl.formatMessage({
|
||||||
})
|
id: warningStatus.message
|
||||||
}}
|
})
|
||||||
></span>
|
}}
|
||||||
}
|
></span>
|
||||||
title={intl.formatMessage({
|
}
|
||||||
id: 'common.text.tips'
|
title={intl.formatMessage({
|
||||||
})}
|
id: 'common.text.tips'
|
||||||
type="warning"
|
})}
|
||||||
></AlertBlockInfo>
|
type="warning"
|
||||||
)}
|
></AlertBlockInfo>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<ModalFooter
|
<ModalFooter
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
onOk={handleSumit}
|
onOk={handleSumit}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import SealSelect from '@/components/seal-form/seal-select';
|
|||||||
import TooltipList from '@/components/tooltip-list';
|
import TooltipList from '@/components/tooltip-list';
|
||||||
import { PageAction } from '@/config';
|
import { PageAction } from '@/config';
|
||||||
import { PageActionType } from '@/config/types';
|
import { PageActionType } from '@/config/types';
|
||||||
|
import useAppUtils from '@/hooks/use-app-utils';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Form, Modal, Typography } from 'antd';
|
import { Form, Modal, Typography } from 'antd';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
@@ -16,7 +17,8 @@ import {
|
|||||||
backendTipsList,
|
backendTipsList,
|
||||||
localPathTipsList,
|
localPathTipsList,
|
||||||
modelSourceMap,
|
modelSourceMap,
|
||||||
ollamaModelOptions
|
ollamaModelOptions,
|
||||||
|
sourceOptions
|
||||||
} from '../config';
|
} from '../config';
|
||||||
import { FormData, ListItem } from '../config/types';
|
import { FormData, ListItem } from '../config/types';
|
||||||
import AdvanceConfig from './advance-config';
|
import AdvanceConfig from './advance-config';
|
||||||
@@ -40,30 +42,6 @@ const SEARCH_SOURCE = [
|
|||||||
modelSourceMap.modelscope_value
|
modelSourceMap.modelscope_value
|
||||||
];
|
];
|
||||||
|
|
||||||
const sourceOptions = [
|
|
||||||
{
|
|
||||||
label: 'Hugging Face',
|
|
||||||
value: modelSourceMap.huggingface_value,
|
|
||||||
key: 'huggingface'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Ollama Library',
|
|
||||||
value: modelSourceMap.ollama_library_value,
|
|
||||||
key: 'ollama_library'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'ModelScope',
|
|
||||||
value: modelSourceMap.modelscope_value,
|
|
||||||
key: 'model_scope'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'models.form.localPath',
|
|
||||||
value: modelSourceMap.local_path_value,
|
|
||||||
locale: true,
|
|
||||||
key: 'local_path'
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
const UpdateModal: React.FC<AddModalProps> = (props) => {
|
const UpdateModal: React.FC<AddModalProps> = (props) => {
|
||||||
const {
|
const {
|
||||||
title,
|
title,
|
||||||
@@ -73,6 +51,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
onCancel,
|
onCancel,
|
||||||
updateFormInitials: { gpuOptions, isGGUF, data: formData }
|
updateFormInitials: { gpuOptions, isGGUF, data: formData }
|
||||||
} = props || {};
|
} = props || {};
|
||||||
|
const { getRuleMessage } = useAppUtils();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const localPathCache = useRef<string>('');
|
const localPathCache = useRef<string>('');
|
||||||
@@ -428,9 +407,9 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
>
|
>
|
||||||
<ColumnWrapper
|
<ColumnWrapper
|
||||||
maxHeight={550}
|
maxHeight={550}
|
||||||
paddingBottom={warningStatus.show ? 100 : 0}
|
paddingBottom={warningStatus.show ? 70 : 0}
|
||||||
footer={
|
footer={
|
||||||
<>
|
<div style={{ paddingInline: 12 }}>
|
||||||
{warningStatus.show && (
|
{warningStatus.show && (
|
||||||
<AlertBlockInfo
|
<AlertBlockInfo
|
||||||
ellipsis={false}
|
ellipsis={false}
|
||||||
@@ -449,7 +428,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
type="warning"
|
type="warning"
|
||||||
></AlertBlockInfo>
|
></AlertBlockInfo>
|
||||||
)}
|
)}
|
||||||
</>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Form
|
<Form
|
||||||
@@ -471,12 +450,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('input', 'common.table.name')
|
||||||
{
|
|
||||||
id: 'common.form.rule.input'
|
|
||||||
},
|
|
||||||
{ name: intl.formatMessage({ id: 'common.table.name' }) }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -492,12 +466,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('select', 'models.form.source')
|
||||||
{
|
|
||||||
id: 'common.form.rule.select'
|
|
||||||
},
|
|
||||||
{ name: intl.formatMessage({ id: 'models.form.source' }) }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -555,14 +524,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('input', 'models.form.replicas')
|
||||||
{
|
|
||||||
id: 'common.form.rule.input'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: intl.formatMessage({ id: 'models.form.replicas' })
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import IconFont from '@/components/icon-font';
|
|||||||
import SealAutoComplete from '@/components/seal-form/auto-complete';
|
import SealAutoComplete from '@/components/seal-form/auto-complete';
|
||||||
import SealInput from '@/components/seal-form/seal-input';
|
import SealInput from '@/components/seal-form/seal-input';
|
||||||
import SealSelect from '@/components/seal-form/seal-select';
|
import SealSelect from '@/components/seal-form/seal-select';
|
||||||
|
import useAppUtils from '@/hooks/use-app-utils';
|
||||||
import { ModelFile as FormData } from '@/pages/resources/config/types';
|
import { ModelFile as FormData } from '@/pages/resources/config/types';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Form, Typography } from 'antd';
|
import { Form, Typography } from 'antd';
|
||||||
@@ -15,6 +16,7 @@ interface TargetFormProps {
|
|||||||
|
|
||||||
const TargetForm: React.FC<TargetFormProps> = (props) => {
|
const TargetForm: React.FC<TargetFormProps> = (props) => {
|
||||||
const { onOk, source } = props;
|
const { onOk, source } = props;
|
||||||
|
const { getRuleMessage } = useAppUtils();
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
@@ -31,12 +33,7 @@ const TargetForm: React.FC<TargetFormProps> = (props) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('input', 'models.table.name')
|
||||||
{
|
|
||||||
id: 'common.form.rule.input'
|
|
||||||
},
|
|
||||||
{ name: intl.formatMessage({ id: 'models.table.name' }) }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -88,12 +85,7 @@ const TargetForm: React.FC<TargetFormProps> = (props) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('select', 'models.form.source')
|
||||||
{
|
|
||||||
id: 'common.form.rule.select'
|
|
||||||
},
|
|
||||||
{ name: intl.formatMessage({ id: 'models.form.source' }) }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -104,12 +96,7 @@ const TargetForm: React.FC<TargetFormProps> = (props) => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: intl.formatMessage(
|
message: getRuleMessage('input', 'common.table.name')
|
||||||
{
|
|
||||||
id: 'common.form.rule.input'
|
|
||||||
},
|
|
||||||
{ name: intl.formatMessage({ id: 'common.table.name' }) }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user