chore: use drawer for creation
This commit is contained in:
@@ -322,12 +322,12 @@ export default (props: any) => {
|
|||||||
}}
|
}}
|
||||||
modal={{
|
modal={{
|
||||||
mask: {
|
mask: {
|
||||||
blur: true
|
blur: false
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
drawer={{
|
drawer={{
|
||||||
mask: {
|
mask: {
|
||||||
blur: true
|
blur: false
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
import ModalFooter from '@/components/modal-footer';
|
||||||
|
import GSDrawer from '@/components/scroller-modal/gs-drawer';
|
||||||
|
import ColumnWrapper from '@/pages/_components/column-wrapper';
|
||||||
|
|
||||||
|
const ModalFooterStyle = {
|
||||||
|
padding: '16px 24px 8px',
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'flex-end'
|
||||||
|
};
|
||||||
|
|
||||||
|
type AddModalProps = {
|
||||||
|
title: string;
|
||||||
|
open: boolean;
|
||||||
|
onCancel: () => void;
|
||||||
|
children?: React.ReactNode;
|
||||||
|
onSubmit: () => void;
|
||||||
|
width?: number;
|
||||||
|
};
|
||||||
|
const FormDrawer: React.FC<AddModalProps> = ({
|
||||||
|
title,
|
||||||
|
open,
|
||||||
|
onCancel,
|
||||||
|
onSubmit,
|
||||||
|
children,
|
||||||
|
width = 600
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<GSDrawer
|
||||||
|
title={title}
|
||||||
|
open={open}
|
||||||
|
onClose={onCancel}
|
||||||
|
destroyOnHidden={true}
|
||||||
|
closeIcon={false}
|
||||||
|
maskClosable={false}
|
||||||
|
keyboard={false}
|
||||||
|
styles={{
|
||||||
|
wrapper: { width }
|
||||||
|
}}
|
||||||
|
footer={false}
|
||||||
|
>
|
||||||
|
<ColumnWrapper
|
||||||
|
styles={{
|
||||||
|
container: { paddingBlock: 0 }
|
||||||
|
}}
|
||||||
|
footer={
|
||||||
|
<ModalFooter
|
||||||
|
onOk={onSubmit}
|
||||||
|
onCancel={onCancel}
|
||||||
|
style={ModalFooterStyle}
|
||||||
|
></ModalFooter>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</ColumnWrapper>
|
||||||
|
</GSDrawer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default FormDrawer;
|
||||||
@@ -38,8 +38,17 @@ const Content = styled.div`
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const StepWrapper = styled.div`
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
background: var(--ant-color-bg-elevated);
|
||||||
|
z-index: 10;
|
||||||
|
padding: 16px 24px;
|
||||||
|
`;
|
||||||
|
|
||||||
const MainWrapper = styled.div`
|
const MainWrapper = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -308,7 +317,15 @@ const ClusterCreate: React.FC<{
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<MainWrapper>
|
<MainWrapper>
|
||||||
|
{!isAddWorkerStep && (
|
||||||
|
<StepWrapper>
|
||||||
|
<ClusterSteps steps={steps} currentStep={currentStep}></ClusterSteps>
|
||||||
|
</StepWrapper>
|
||||||
|
)}
|
||||||
<ColumnWrapper
|
<ColumnWrapper
|
||||||
|
maxHeight={
|
||||||
|
isAddWorkerStep ? 'calc(100vh - 200px)' : 'calc(100vh - 150px)'
|
||||||
|
}
|
||||||
styles={{
|
styles={{
|
||||||
container: { paddingTop: 16, paddingBottom: 16 }
|
container: { paddingTop: 16, paddingBottom: 16 }
|
||||||
}}
|
}}
|
||||||
@@ -324,14 +341,6 @@ const ClusterCreate: React.FC<{
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{!isAddWorkerStep && (
|
|
||||||
<div style={{ marginBottom: 32 }}>
|
|
||||||
<ClusterSteps
|
|
||||||
steps={steps}
|
|
||||||
currentStep={currentStep}
|
|
||||||
></ClusterSteps>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div style={{ flex: 1 }}>
|
<div style={{ flex: 1 }}>
|
||||||
{currentStep === startStep && (
|
{currentStep === startStep && (
|
||||||
<ProviderCatalog
|
<ProviderCatalog
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import ModalFooter from '@/components/modal-footer';
|
|
||||||
import ScrollerModal from '@/components/scroller-modal/index';
|
|
||||||
import { PageActionType } from '@/config/types';
|
import { PageActionType } from '@/config/types';
|
||||||
|
import FormDrawer from '@/pages/_components/form-drawer';
|
||||||
import React, { useRef } from 'react';
|
import React, { useRef } from 'react';
|
||||||
import { ProviderType } from '../config';
|
import { ProviderType } from '../config';
|
||||||
import {
|
import {
|
||||||
@@ -48,19 +47,12 @@ const AddCluster: React.FC<AddModalProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollerModal
|
<FormDrawer
|
||||||
title={title}
|
title={title}
|
||||||
open={open}
|
open={open}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
destroyOnHidden={true}
|
onSubmit={handleSubmit}
|
||||||
closeIcon={true}
|
width={700}
|
||||||
maskClosable={false}
|
|
||||||
keyboard={false}
|
|
||||||
centered={true}
|
|
||||||
width={680}
|
|
||||||
footer={
|
|
||||||
<ModalFooter onOk={handleSubmit} onCancel={onCancel}></ModalFooter>
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<ClusterForm
|
<ClusterForm
|
||||||
ref={form}
|
ref={form}
|
||||||
@@ -70,7 +62,7 @@ const AddCluster: React.FC<AddModalProps> = ({
|
|||||||
currentData={currentData}
|
currentData={currentData}
|
||||||
onFinish={handleOk}
|
onFinish={handleOk}
|
||||||
/>
|
/>
|
||||||
</ScrollerModal>
|
</FormDrawer>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import ModalFooter from '@/components/modal-footer';
|
|
||||||
import ScrollerModal from '@/components/scroller-modal';
|
|
||||||
import SealInput from '@/components/seal-form/seal-input';
|
import SealInput from '@/components/seal-form/seal-input';
|
||||||
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 useAppUtils from '@/hooks/use-app-utils';
|
||||||
|
import FormDrawer from '@/pages/_components/form-drawer';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Form } from 'antd';
|
import { Form } from 'antd';
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
@@ -66,19 +65,11 @@ const AddModal: React.FC<AddModalProps> = ({
|
|||||||
}, [currentData]);
|
}, [currentData]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollerModal
|
<FormDrawer
|
||||||
title={title}
|
title={title}
|
||||||
open={open}
|
open={open}
|
||||||
centered={true}
|
onSubmit={handleSumit}
|
||||||
onOk={handleSumit}
|
onCancel={handleCancel}
|
||||||
destroyOnHidden={true}
|
|
||||||
closeIcon={false}
|
|
||||||
maskClosable={false}
|
|
||||||
keyboard={false}
|
|
||||||
width={600}
|
|
||||||
footer={
|
|
||||||
<ModalFooter onOk={handleSumit} onCancel={handleCancel}></ModalFooter>
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<Form form={form} onFinish={handleOk} preserve={false}>
|
<Form form={form} onFinish={handleOk} preserve={false}>
|
||||||
<Form.Item<FormData>
|
<Form.Item<FormData>
|
||||||
@@ -140,7 +131,7 @@ const AddModal: React.FC<AddModalProps> = ({
|
|||||||
></SealInput.TextArea>
|
></SealInput.TextArea>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</ScrollerModal>
|
</FormDrawer>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import ModalFooter from '@/components/modal-footer';
|
|
||||||
import ScrollerModal from '@/components/scroller-modal';
|
|
||||||
import { PageActionType } from '@/config/types';
|
import { PageActionType } from '@/config/types';
|
||||||
|
import FormDrawer from '@/pages/_components/form-drawer';
|
||||||
import React, { useEffect, useRef } from 'react';
|
import React, { useEffect, useRef } from 'react';
|
||||||
import { ProviderType } from '../config';
|
import { ProviderType } from '../config';
|
||||||
import {
|
import {
|
||||||
@@ -61,20 +60,11 @@ const AddPool: React.FC<AddModalProps> = ({
|
|||||||
}, [clusterData, open]);
|
}, [clusterData, open]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollerModal
|
<FormDrawer
|
||||||
title={title}
|
title={title}
|
||||||
open={open}
|
open={open}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
destroyOnHidden={true}
|
onSubmit={handleSubmit}
|
||||||
closeIcon={true}
|
|
||||||
centered={true}
|
|
||||||
maskClosable={false}
|
|
||||||
keyboard={false}
|
|
||||||
width={600}
|
|
||||||
maxContentHeight={'max(calc(100vh - 300px), 500px)'}
|
|
||||||
footer={
|
|
||||||
<ModalFooter onOk={handleSubmit} onCancel={onCancel}></ModalFooter>
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<PoolForm
|
<PoolForm
|
||||||
ref={formRef}
|
ref={formRef}
|
||||||
@@ -83,7 +73,7 @@ const AddPool: React.FC<AddModalProps> = ({
|
|||||||
currentData={currentData}
|
currentData={currentData}
|
||||||
onFinish={handleOnFinish}
|
onFinish={handleOnFinish}
|
||||||
></PoolForm>
|
></PoolForm>
|
||||||
</ScrollerModal>
|
</FormDrawer>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import metaxLogo from '@/assets/logo/metax.png';
|
|||||||
import mooreLogo from '@/assets/logo/moore-logo.png';
|
import mooreLogo from '@/assets/logo/moore-logo.png';
|
||||||
import nvidiaLogo from '@/assets/logo/nvidia.png';
|
import nvidiaLogo from '@/assets/logo/nvidia.png';
|
||||||
import IconFont from '@/components/icon-font';
|
import IconFont from '@/components/icon-font';
|
||||||
|
import useUserSettings from '@/hooks/use-user-settings';
|
||||||
import {
|
import {
|
||||||
AddWorkerDockerNotes,
|
AddWorkerDockerNotes,
|
||||||
GPUDriverMap
|
GPUDriverMap
|
||||||
@@ -46,6 +47,17 @@ const Box = styled.div`
|
|||||||
background-color: var(--ant-blue-1);
|
background-color: var(--ant-blue-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&.dark-theme {
|
||||||
|
.template-card-wrapper {
|
||||||
|
background-color: rgba(255, 255, 255, 0.05);
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--ant-color-bg-solid);
|
||||||
|
}
|
||||||
|
&.active {
|
||||||
|
background-color: var(--ant-color-bg-solid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const ProviderImage = ({ src, height }: { src: string; height?: number }) => {
|
const ProviderImage = ({ src, height }: { src: string; height?: number }) => {
|
||||||
@@ -72,6 +84,7 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
|
|||||||
current
|
current
|
||||||
}) => {
|
}) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
const { userSettings } = useUserSettings();
|
||||||
|
|
||||||
const supportedHardPlatforms = [
|
const supportedHardPlatforms = [
|
||||||
{
|
{
|
||||||
@@ -97,7 +110,7 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
|
|||||||
icon: (
|
icon: (
|
||||||
<IconFont
|
<IconFont
|
||||||
type="icon-amd-logo"
|
type="icon-amd-logo"
|
||||||
style={{ fontSize: 64, color: 'var(--ant-color-text)' }}
|
style={{ fontSize: 64, color: '#000' }}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -174,7 +187,7 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
|
|||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box className={userSettings?.theme === 'realDark' ? 'dark-theme' : ''}>
|
||||||
<ProviderCatalog
|
<ProviderCatalog
|
||||||
onSelect={onSelect}
|
onSelect={onSelect}
|
||||||
height={60}
|
height={60}
|
||||||
|
|||||||
@@ -114,10 +114,10 @@ const Credentials: React.FC = () => {
|
|||||||
firstAddWorker: false,
|
firstAddWorker: false,
|
||||||
firstAddCluster: true
|
firstAddCluster: true
|
||||||
});
|
});
|
||||||
|
setIsFromCluster(false);
|
||||||
navigate(-1);
|
navigate(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setIsFromCluster(false);
|
|
||||||
fetchData();
|
fetchData();
|
||||||
setOpenModalStatus({ ...openModalStatus, open: false });
|
setOpenModalStatus({ ...openModalStatus, open: false });
|
||||||
message.success(intl.formatMessage({ id: 'common.message.success' }));
|
message.success(intl.formatMessage({ id: 'common.message.success' }));
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import IconFont from '@/components/icon-font';
|
import IconFont from '@/components/icon-font';
|
||||||
import ModalFooter from '@/components/modal-footer';
|
|
||||||
import ScrollerModal from '@/components/scroller-modal';
|
|
||||||
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 SealSwitch from '@/components/seal-form/seal-switch';
|
import SealSwitch from '@/components/seal-form/seal-switch';
|
||||||
@@ -9,6 +7,7 @@ import { PageActionType } from '@/config/types';
|
|||||||
import { useIntl, useModel } from '@umijs/max';
|
import { useIntl, useModel } from '@umijs/max';
|
||||||
import { Form, Select } from 'antd';
|
import { Form, Select } from 'antd';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
import FormDrawer from '../../_components/form-drawer';
|
||||||
import { UserRoles, UserRolesOptions } from '../config';
|
import { UserRoles, UserRolesOptions } from '../config';
|
||||||
import { FormData, ListItem } from '../config/types';
|
import { FormData, ListItem } from '../config/types';
|
||||||
|
|
||||||
@@ -47,7 +46,7 @@ const AddModal: React.FC<AddModalProps> = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSumit = () => {
|
const handleSubmit = () => {
|
||||||
form.submit();
|
form.submit();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -56,20 +55,11 @@ const AddModal: React.FC<AddModalProps> = ({
|
|||||||
}, [open]);
|
}, [open]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollerModal
|
<FormDrawer
|
||||||
title={title}
|
title={title}
|
||||||
open={open}
|
open={open}
|
||||||
centered={true}
|
|
||||||
onOk={handleSumit}
|
|
||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
destroyOnHidden={true}
|
onSubmit={handleSubmit}
|
||||||
closeIcon={false}
|
|
||||||
maskClosable={false}
|
|
||||||
keyboard={false}
|
|
||||||
width={600}
|
|
||||||
footer={
|
|
||||||
<ModalFooter onOk={handleSumit} onCancel={onCancel}></ModalFooter>
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<Form name="addUserForm" form={form} onFinish={onOk} preserve={false}>
|
<Form name="addUserForm" form={form} onFinish={onOk} preserve={false}>
|
||||||
<Form.Item<FormData>
|
<Form.Item<FormData>
|
||||||
@@ -165,7 +155,7 @@ const AddModal: React.FC<AddModalProps> = ({
|
|||||||
></SealInput.Password>
|
></SealInput.Password>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</ScrollerModal>
|
</FormDrawer>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user