import { useRef } from 'react' import { Dialog, DialogTitle, DialogContent, DialogActions, Button, Stack, Box, Typography, IconButton, TextField, CircularProgress, } from '@mui/material' import CloseIcon from '@mui/icons-material/Close' import UploadFileIcon from '@mui/icons-material/UploadFile' interface CreateYamlDialogProps { open: boolean onClose: () => void onApply: (yaml: string) => void yamlContent: string onYamlChange: (value: string) => void loading: boolean } export default function CreateYamlDialog({ open, onClose, onApply, yamlContent, onYamlChange, loading, }: CreateYamlDialogProps) { const fileInputRef = useRef(null) const handleFileUpload = (event: React.ChangeEvent) => { const file = event.target.files?.[0] if (file) { const reader = new FileReader() reader.onload = (e) => { const content = e.target?.result as string onYamlChange(content) } reader.readAsText(file) } } return ( 创建资源 onYamlChange(e.target.value)} placeholder="粘贴或编辑 YAML 内容..." fullWidth variant="outlined" /> ) }