feat: add provider menu

This commit is contained in:
jialin
2026-02-03 18:21:08 +08:00
parent cb5413c2ce
commit 2dfdd4a0d9
21 changed files with 701 additions and 7 deletions
@@ -0,0 +1,62 @@
import { PageActionType } from '@/config/types';
import FormDrawer from '@/pages/_components/form-drawer';
import React, { useRef } from 'react';
import { FormData, MaasProviderItem as ListItem } from '../config/types';
import { maasProviderType } from '../config';
import ProviderForm from '../forms';
type AddModalProps = {
title: string;
action: PageActionType;
open: boolean;
currentData?: ListItem; // Used when action is EDIT
provider: maasProviderType | null;
onOk: (values: FormData) => void;
onCancel: () => void;
};
const AddProvider: React.FC<AddModalProps> = ({
title,
action,
open,
provider,
currentData,
onOk,
onCancel
}) => {
const form = useRef<any>(null);
const handleSubmit = () => {
form.current?.submit();
};
const handleOk = async (data: FormData) => {
onOk({
...data
});
};
const handleCancel = () => {
form.current?.resetFields();
onCancel();
};
return (
<FormDrawer
title={title}
open={open}
onCancel={handleCancel}
onSubmit={handleSubmit}
width={600}
>
<ProviderForm
ref={form}
action={action}
currentData={currentData}
onFinish={handleOk}
/>
</FormDrawer>
);
};
export default AddProvider;
@@ -0,0 +1,11 @@
import React from 'react';
interface ProviderModelProps {
name: string;
}
const ProviderModels: React.FC<ProviderModelProps> = () => {
return <div>Provider Models Component</div>;
};
export default ProviderModels;