feat(k8s): 统一 YAML 查看编辑并补齐 Pod/导出能力
- 抽取 YamlCodeMirror/YamlEditorToolbar,修复弹窗滚动与固定高度布局 - 对齐集群导出精简规则(Service/Ingress/Workload/PVC 注解等) - Deployment/Pod/Service/Ingress 分资源配置:Pod 只读,支持单文件下载 - 修复 Deployment Pod YAML 弹窗未渲染,补全 PodsTab 与详情页 YAML 入口 - 命名空间列表页新增导出 YAML(tar.gz),与集群导出 API 一致
This commit is contained in:
1 parent
eeba677850
commit
fd7b04b9d6
15 files changed
+651
-150
No files matched your search
@@ -5,9 +5,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { ModalOverlay } from '@/components/ui/modal-overlay';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import CodeMirror from '@uiw/react-codemirror';
|
||||
import { yaml } from '@codemirror/lang-yaml';
|
||||
import { oneDark } from '@codemirror/theme-one-dark';
|
||||
import { YamlCodeMirror } from './YamlCodeMirror';
|
||||
|
||||
interface YamlImportDialogProps {
|
||||
clusterCode: string;
|
||||
@@ -39,7 +37,7 @@ export function YamlImportDialog({ clusterCode, onClose, onApplied }: YamlImport
|
||||
return (
|
||||
<ModalOverlay onClose={onClose}>
|
||||
<div
|
||||
className="bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[92vw] max-w-4xl max-h-[85vh] flex flex-col shadow-2xl"
|
||||
className="bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[92vw] max-w-4xl h-[85vh] flex flex-col shadow-2xl"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div className="flex items-center justify-between p-4 border-b border-[var(--dg-border)]">
|
||||
@@ -52,19 +50,15 @@ export function YamlImportDialog({ clusterCode, onClose, onApplied }: YamlImport
|
||||
</div>
|
||||
<Button variant="ghost" size="icon" className="h-8 w-8" onClick={onClose}><X className="h-4 w-4" /></Button>
|
||||
</div>
|
||||
<div className="flex-1 overflow-auto p-4">
|
||||
<CodeMirror
|
||||
<div className="flex-1 min-h-0 flex flex-col overflow-hidden p-4">
|
||||
<YamlCodeMirror
|
||||
value={content}
|
||||
height="420px"
|
||||
theme={oneDark}
|
||||
extensions={[yaml()]}
|
||||
fill
|
||||
fontSize="12px"
|
||||
onChange={setContent}
|
||||
placeholder="粘贴 YAML 内容..."
|
||||
basicSetup={{ lineNumbers: true, foldGutter: true, highlightActiveLine: true }}
|
||||
style={{ fontSize: '12px' }}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex justify-end gap-2 p-4 border-t border-[var(--dg-border)]">
|
||||
<div className="flex justify-end gap-2 p-4 border-t border-[var(--dg-border)] shrink-0">
|
||||
<Button variant="outline" onClick={onClose}>取消</Button>
|
||||
<Button className="bg-blue-600 hover:bg-blue-700" onClick={apply} disabled={applying}>
|
||||
{applying ? <Loader2 className="h-4 w-4 animate-spin mr-1" /> : <Upload className="h-4 w-4 mr-1" />}
|
||||
|
||||
Reference in new issue
Block a user