fix: adapter request not be triggered
This commit is contained in:
@@ -14,7 +14,7 @@ import { useIntl } from '@umijs/max';
|
|||||||
import { Form } from 'antd';
|
import { Form } from 'antd';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { sourceOptions } from '../config';
|
import { DeployFormKeyMap, sourceOptions } from '../config';
|
||||||
import { useFormContext } from '../config/form-context';
|
import { useFormContext } from '../config/form-context';
|
||||||
import { FormData } from '../config/types';
|
import { FormData } from '../config/types';
|
||||||
import BackendForm from './backend';
|
import BackendForm from './backend';
|
||||||
@@ -68,7 +68,6 @@ const ClusterOption = styled.span`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
interface BasicFormProps {
|
interface BasicFormProps {
|
||||||
fields?: string[];
|
|
||||||
sourceDisable?: boolean;
|
sourceDisable?: boolean;
|
||||||
sourceList?: Global.BaseOption<string>[];
|
sourceList?: Global.BaseOption<string>[];
|
||||||
clusterList: Global.BaseOption<
|
clusterList: Global.BaseOption<
|
||||||
@@ -88,7 +87,6 @@ interface BasicFormProps {
|
|||||||
|
|
||||||
const BasicForm: React.FC<BasicFormProps> = (props) => {
|
const BasicForm: React.FC<BasicFormProps> = (props) => {
|
||||||
const {
|
const {
|
||||||
fields = [],
|
|
||||||
sourceList,
|
sourceList,
|
||||||
clusterList,
|
clusterList,
|
||||||
sourceDisable,
|
sourceDisable,
|
||||||
@@ -98,7 +96,7 @@ const BasicForm: React.FC<BasicFormProps> = (props) => {
|
|||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const form = Form.useFormInstance();
|
const form = Form.useFormInstance();
|
||||||
const { getRuleMessage } = useAppUtils();
|
const { getRuleMessage } = useAppUtils();
|
||||||
const { onValuesChange, action } = useFormContext();
|
const { onValuesChange, action, formKey } = useFormContext();
|
||||||
|
|
||||||
const handleOnSourceChange = (val: string) => {
|
const handleOnSourceChange = (val: string) => {
|
||||||
onSourceChange?.(val);
|
onSourceChange?.(val);
|
||||||
@@ -183,30 +181,29 @@ const BasicForm: React.FC<BasicFormProps> = (props) => {
|
|||||||
required
|
required
|
||||||
></CInput.Input>
|
></CInput.Input>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{fields.includes('source') && (
|
|
||||||
<Form.Item<FormData>
|
|
||||||
name="source"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: getRuleMessage('select', 'models.form.source')
|
|
||||||
}
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
{
|
|
||||||
<SealSelect
|
|
||||||
onChange={handleOnSourceChange}
|
|
||||||
disabled={sourceDisable}
|
|
||||||
label={intl.formatMessage({
|
|
||||||
id: 'models.form.source'
|
|
||||||
})}
|
|
||||||
options={sourceList ?? sourceOptions}
|
|
||||||
required
|
|
||||||
></SealSelect>
|
|
||||||
}
|
|
||||||
</Form.Item>
|
|
||||||
)}
|
|
||||||
|
|
||||||
|
<Form.Item<FormData>
|
||||||
|
name="source"
|
||||||
|
hidden={formKey === DeployFormKeyMap.CATALOG}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: getRuleMessage('select', 'models.form.source')
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
<SealSelect
|
||||||
|
onChange={handleOnSourceChange}
|
||||||
|
disabled={sourceDisable}
|
||||||
|
label={intl.formatMessage({
|
||||||
|
id: 'models.form.source'
|
||||||
|
})}
|
||||||
|
options={sourceList ?? sourceOptions}
|
||||||
|
required
|
||||||
|
></SealSelect>
|
||||||
|
}
|
||||||
|
</Form.Item>
|
||||||
<OnlineSource></OnlineSource>
|
<OnlineSource></OnlineSource>
|
||||||
<LocalPathSource></LocalPathSource>
|
<LocalPathSource></LocalPathSource>
|
||||||
<Form.Item<FormData>
|
<Form.Item<FormData>
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
sourceDisable = true,
|
sourceDisable = true,
|
||||||
sourceList,
|
sourceList,
|
||||||
clusterList = [],
|
clusterList = [],
|
||||||
fields = ['source'],
|
|
||||||
clearCacheFormValues,
|
clearCacheFormValues,
|
||||||
onBackendChange,
|
onBackendChange,
|
||||||
onSourceChange,
|
onSourceChange,
|
||||||
@@ -456,7 +455,6 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<BasicForm
|
<BasicForm
|
||||||
fields={fields}
|
|
||||||
sourceList={sourceList}
|
sourceList={sourceList}
|
||||||
clusterList={clusterList}
|
clusterList={clusterList}
|
||||||
sourceDisable={sourceDisable}
|
sourceDisable={sourceDisable}
|
||||||
|
|||||||
Reference in New Issue
Block a user