-
-
-
+
+
+
+
diff --git a/frontend/src/components/kubernetes/DeploymentWorkload.tsx b/frontend/src/components/kubernetes/DeploymentWorkload.tsx
index e1eca6f..0c3b4aa 100644
--- a/frontend/src/components/kubernetes/DeploymentWorkload.tsx
+++ b/frontend/src/components/kubernetes/DeploymentWorkload.tsx
@@ -29,6 +29,8 @@ import { DeploymentEditBasic } from './DeploymentEditBasic';
import { DeploymentEditStorage } from './DeploymentEditStorage';
import { DeploymentEditAdvanced } from './DeploymentEditAdvanced';
import { DeploymentEditService } from './DeploymentEditService';
+import { PodExecTerminal } from './PodExecTerminal';
+import { PodFileBrowser } from './PodFileBrowser';
type WorkloadMode = 'view' | 'edit' | 'yaml';
@@ -67,6 +69,9 @@ export function DeploymentWorkload({ clusterCode, namespace, deploymentName, mod
const [newImage, setNewImage] = useState('');
// 伸缩
const [scaleValue, setScaleValue] = useState(0);
+ const [terminalPod, setTerminalPod] = useState
(null);
+ const [fileBrowserPod, setFileBrowserPod] = useState(null);
+ const clusterId = deployment?.cluster_id || deployment?.clusterId || clusterCode;
const toArray = (v: any) => (Array.isArray(v) ? v : (v?.list || v?.items || v?.data || []));
@@ -226,8 +231,11 @@ export function DeploymentWorkload({ clusterCode, namespace, deploymentName, mod
// 日志流(Pod 实时日志)
const handleShowPodLogs = (pod: any) => setModal({ kind: 'podLogs', pod: pod.name });
const handleShowPodYaml = (pod: any) => setModal({ kind: 'podYaml', pod: pod.name });
- const handleShowPodTerminal = (_pod: any) => {
- toast({ title: '容器终端', description: 'Pod exec 终端复用 KubectlTerminal 通道,开发中' });
+ const handleShowPodTerminal = (pod: any) => {
+ setTerminalPod(pod.name);
+ };
+ const handleShowPodFileBrowser = (pod: any) => {
+ setFileBrowserPod(pod.name);
};
// ============ 渲染 ============
@@ -397,6 +405,7 @@ export function DeploymentWorkload({ clusterCode, namespace, deploymentName, mod
onShowPodLogs={handleShowPodLogs}
onShowPodTerminal={handleShowPodTerminal}
onShowPodYaml={handleShowPodYaml}
+ onShowPodFileBrowser={handleShowPodFileBrowser}
/>
) : mode === 'yaml' ? (
/* YAML 编辑模式 — 内联 CodeMirror 编辑器 */
@@ -435,18 +444,6 @@ export function DeploymentWorkload({ clusterCode, namespace, deploymentName, mod
/>
)}
- {/* 弹窗:Pod YAML */}
- {modal?.kind === 'podYaml' && (
- setModal(null)}
- />
- )}
-
{/* ============ 弹窗:调整镜像版本 ============ */}
{modal?.kind === 'image' && (
setModal(null)}>
@@ -524,7 +521,7 @@ export function DeploymentWorkload({ clusterCode, namespace, deploymentName, mod
)}
- {/* ============ 弹窗:Pod 日志 ============ */}
+ {/* ============ Pod 日志 ============ */}
{modal?.kind === 'podLogs' && (
setModal(null)}
/>
)}
+
+ {/* ============ Pod 终端 ============ */}
+ { if (!open) setTerminalPod(null); }}
+ clusterId={clusterId}
+ namespace={namespace}
+ podName={terminalPod || ''}
+ containers={(pods.find((p: any) => p.name === terminalPod)?.containers || []).map((c: any) => c.name).filter(Boolean)}
+ />
+ {/* ============ Pod 文件浏览器 ============ */}
+ { if (!open) setFileBrowserPod(null); }}
+ clusterCode={clusterCode}
+ namespace={namespace}
+ podName={fileBrowserPod || ''}
+ containers={(pods.find((p: any) => p.name === fileBrowserPod)?.containers || []).map((c: any) => c.name).filter(Boolean)}
+ />
);
}
diff --git a/frontend/src/components/kubernetes/NamespaceResourcePage.tsx b/frontend/src/components/kubernetes/NamespaceResourcePage.tsx
index b9a1696..8df2147 100644
--- a/frontend/src/components/kubernetes/NamespaceResourcePage.tsx
+++ b/frontend/src/components/kubernetes/NamespaceResourcePage.tsx
@@ -13,9 +13,11 @@ import {
import {
RefreshCw, Search, Loader2, Boxes, Container,
Network, FileText, Shield, Activity, Clock, ChevronRight,
- Download, FileCode, Pencil,
+ Download, FileCode, Pencil, Terminal, HardDrive,
} from 'lucide-react';
import { YamlViewer } from './YamlViewer';
+import { PodExecTerminal } from './PodExecTerminal';
+import { PodFileBrowser } from './PodFileBrowser';
import { kubernetesApi } from '@/services/api';
import { useToast } from '@/hooks/use-toast';
@@ -29,7 +31,7 @@ const RESOURCE_CONFIG: Record