From f75744e252d13fefc69a46e2cd3cafb74648c728 Mon Sep 17 00:00:00 2001 From: CyJaySong <29367599+CyJaySong@users.noreply.github.com> Date: Mon, 4 Sep 2023 15:51:10 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E5=AE=B9=E5=99=A8=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=B7=BB=E5=8A=A0=E7=BD=91=E7=BB=9C=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E5=88=97=20(#2169)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/dto/container.go | 3 ++- backend/app/service/container.go | 8 ++++++++ frontend/src/lang/modules/en.ts | 1 + frontend/src/lang/modules/tw.ts | 1 + frontend/src/lang/modules/zh.ts | 1 + frontend/src/views/container/container/index.vue | 15 +++++++++++++-- 6 files changed, 26 insertions(+), 3 deletions(-) diff --git a/backend/app/dto/container.go b/backend/app/dto/container.go index db8cbbd68..b3c6343e9 100644 --- a/backend/app/dto/container.go +++ b/backend/app/dto/container.go @@ -24,7 +24,8 @@ type ContainerInfo struct { State string `json:"state"` RunTime string `json:"runTime"` - Ports []string `json:"ports"` + Network []string `json:"network"` + Ports []string `json:"ports"` IsFromApp bool `json:"isFromApp"` IsFromCompose bool `json:"isFromCompose"` diff --git a/backend/app/service/container.go b/backend/app/service/container.go index d79f0234b..2ce008bf3 100644 --- a/backend/app/service/container.go +++ b/backend/app/service/container.go @@ -167,6 +167,14 @@ func (u *ContainerService) Page(req dto.PageContainer) (int64, interface{}, erro IsFromApp: IsFromApp, IsFromCompose: IsFromCompose, } + if item.NetworkSettings != nil && len(item.NetworkSettings.Networks) > 0 { + networks := make([]string, 0, len(item.NetworkSettings.Networks)) + for key := range item.NetworkSettings.Networks { + networks = append(networks, key+":"+item.NetworkSettings.Networks[key].IPAddress) + } + sort.Strings(networks) + backDatas[i].Network = networks + } } return int64(total), backDatas, nil diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index b9a29aba0..d278c697e 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -78,6 +78,7 @@ const message = { interval: 'Interval', user: 'User', title: 'Title', + network: 'Network', port: 'Port', protocol: 'Protocol', tableSetting: 'Table setting', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index 5a4e462f7..858c9dad2 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -78,6 +78,7 @@ const message = { interval: '耗時', user: '用戶', title: '標題', + network: '網絡', port: '端口', protocol: '協議', tableSetting: '列表設置', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 590fbd8f7..c427a0459 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -78,6 +78,7 @@ const message = { interval: '耗时', user: '用户', title: '标题', + network: '网络', port: '端口', protocol: '协议', tableSetting: '列表设置', diff --git a/frontend/src/views/container/container/index.vue b/frontend/src/views/container/container/index.vue index 27fa8d52c..e5e309516 100644 --- a/frontend/src/views/container/container/index.vue +++ b/frontend/src/views/container/container/index.vue @@ -90,14 +90,25 @@ - CPU: {{ row.cpuPercent.toFixed(2) }}% - {{ $t('monitor.memory') }}: {{ row.memoryPercent.toFixed(2) }}% + CPU: {{ row.cpuPercent.toFixed(2) }}% {{ $t('monitor.memory') }}: {{ row.memoryPercent.toFixed(2) }}% + + + + {{ item }} + + +