diff --git a/frontend/src/views/container/container/index.vue b/frontend/src/views/container/container/index.vue index 055542039..8c90ba9c6 100644 --- a/frontend/src/views/container/container/index.vue +++ b/frontend/src/views/container/container/index.vue @@ -98,7 +98,7 @@ show-overflow-tooltip > @@ -571,9 +571,9 @@ const onTerminal = (row: any) => { dialogTerminalRef.value!.acceptParams({ containerID: row.containerID, title: title }); }; -const onInspect = async (id: string) => { - const res = await inspect({ id: id, type: 'container' }); - containerInspectRef.value!.acceptParams({ data: res.data }); +const onInspect = async (row: any) => { + const res = await inspect({ id: row.containerID, type: 'container' }); + containerInspectRef.value!.acceptParams({ data: res.data, ports: row.ports }); }; const onClean = () => { diff --git a/frontend/src/views/container/container/inspect/index.vue b/frontend/src/views/container/container/inspect/index.vue index e44c9c779..4da5765b2 100644 --- a/frontend/src/views/container/container/inspect/index.vue +++ b/frontend/src/views/container/container/inspect/index.vue @@ -87,10 +87,8 @@ {{ inspectData?.Config?.Domainname || '-' }} -
- {{ item.hostIp }}:{{ item.hostPort }} - - {{ item.containerPort }} +
+ {{ item }}
@@ -175,14 +173,17 @@ const inspectData = ref(null); const rawJson = ref(''); const showRawJson = ref(false); +const ports = ref([]); interface DialogProps { data: any; + ports: string[]; } const acceptParams = (props: DialogProps): void => { visible.value = true; activeTab.value = 'overview'; showRawJson.value = false; + ports.value = props.ports || []; try { if (typeof props.data === 'string') { @@ -231,24 +232,6 @@ const formatDate = (dateStr: string): string => { } }; -const getPortBindings = (): any[] => { - const ports: any[] = []; - const portBindings = inspectData.value?.HostConfig?.PortBindings || {}; - - for (const [containerPort, bindings] of Object.entries(portBindings)) { - if (Array.isArray(bindings)) { - for (const binding of bindings) { - ports.push({ - containerPort, - hostIp: (binding as any).HostIp || '0.0.0.0', - hostPort: (binding as any).HostPort, - }); - } - } - } - return ports; -}; - const getEnvKey = (env: string): string => { const index = env.indexOf('='); return index > 0 ? env.substring(0, index) : env;