fix: cluster issues
This commit is contained in:
@@ -18,6 +18,7 @@ const LabelWrapper = styled.div.attrs({
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
padding-bottom: 2px;
|
||||||
background-color: var(--ant-color-bg-container);
|
background-color: var(--ant-color-bg-container);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -111,11 +112,13 @@ const SealTextArea: React.FC<InputTextareaProps & SealFormItemProps> = (
|
|||||||
[onInput]
|
[onInput]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log('style=========', style, rest);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<InputWrapper>
|
<InputWrapper>
|
||||||
<Wrapper
|
<Wrapper
|
||||||
status={status}
|
status={status}
|
||||||
label={label}
|
label={<LabelWrapper>{label}</LabelWrapper>}
|
||||||
isFocus={isFocus}
|
isFocus={isFocus}
|
||||||
required={required}
|
required={required}
|
||||||
description={description}
|
description={description}
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ const InputWrapper = styled.div`
|
|||||||
}
|
}
|
||||||
.ant-input.seal-textarea {
|
.ant-input.seal-textarea {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
overflow-y: auto !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-input-number {
|
.ant-input-number {
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import useQueryBackends from '../hooks/use-query-backends';
|
|||||||
import AdvanceConfig from './advance-config';
|
import AdvanceConfig from './advance-config';
|
||||||
import BasicForm from './basic';
|
import BasicForm from './basic';
|
||||||
|
|
||||||
|
const requiredFields = ['gpu_selector', 'backend'];
|
||||||
|
|
||||||
interface DataFormProps {
|
interface DataFormProps {
|
||||||
initialValues?: any;
|
initialValues?: any;
|
||||||
ref?: any;
|
ref?: any;
|
||||||
@@ -147,18 +149,24 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
setActiveKey(Array.isArray(keys) ? keys : [keys]);
|
setActiveKey(Array.isArray(keys) ? keys : [keys]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleOnFinishFailed = (errorInfo: any) => {
|
||||||
|
const { errorFields } = errorInfo;
|
||||||
|
if (errorFields && errorFields.length > 0) {
|
||||||
|
const names = errorFields.map((item: any) => item.name[0]);
|
||||||
|
const isRequired = names.some((name: string) =>
|
||||||
|
requiredFields.includes(name)
|
||||||
|
);
|
||||||
|
if (isRequired) {
|
||||||
|
setActiveKey(['advanced']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleTargetChange = (val: string) => {
|
const handleTargetChange = (val: string) => {
|
||||||
console.log('val', val);
|
form.scrollToField(val, {
|
||||||
// if (val === 'performance' && performanceRef.current) {
|
behavior: 'smooth',
|
||||||
// scrollToTarget?.(performanceRef.current);
|
block: 'center'
|
||||||
// }
|
});
|
||||||
// if (val === 'advanced' && advanceRef.current) {
|
|
||||||
// scrollToTarget?.(advanceRef.current);
|
|
||||||
// }
|
|
||||||
// scrollToBottom?.();
|
|
||||||
// setTimeout(() => {
|
|
||||||
// setTarget(val);
|
|
||||||
// }, 100);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useImperativeHandle(ref, () => {
|
useImperativeHandle(ref, () => {
|
||||||
@@ -202,22 +210,25 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
onBackendChange: handleBackendChange
|
onBackendChange: handleBackendChange
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* <div className="m-b-8">
|
{/* <div
|
||||||
|
className="m-b-8"
|
||||||
|
style={{ position: 'sticky', top: 0, zIndex: 100 }}
|
||||||
|
>
|
||||||
<Segmented
|
<Segmented
|
||||||
value={target}
|
value={target}
|
||||||
defaultValue="Basic"
|
defaultValue="Basic"
|
||||||
onChange={handleTargetChange}
|
onChange={handleTargetChange}
|
||||||
options={[
|
options={[
|
||||||
{
|
{
|
||||||
value: 'basic',
|
value: 'name',
|
||||||
label: 'Basic'
|
label: 'Basic'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'performance',
|
value: 'categories',
|
||||||
label: 'Performance'
|
label: 'Performance'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'advanced',
|
value: 'categories',
|
||||||
label: 'Advanced'
|
label: 'Advanced'
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
@@ -230,6 +241,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
preserve={false}
|
preserve={false}
|
||||||
clearOnDestroy={true}
|
clearOnDestroy={true}
|
||||||
onValuesChange={handleOnValuesChange}
|
onValuesChange={handleOnValuesChange}
|
||||||
|
onFinishFailed={handleOnFinishFailed}
|
||||||
scrollToFirstError={true}
|
scrollToFirstError={true}
|
||||||
initialValues={{
|
initialValues={{
|
||||||
replicas: 1,
|
replicas: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user