mirror of https://github.com/1Panel-dev/1Panel
🎨 容器列表添加网络地址列 (#2169)
parent
ecc444db9f
commit
f75744e252
|
@ -24,6 +24,7 @@ type ContainerInfo struct {
|
|||
State string `json:"state"`
|
||||
RunTime string `json:"runTime"`
|
||||
|
||||
Network []string `json:"network"`
|
||||
Ports []string `json:"ports"`
|
||||
|
||||
IsFromApp bool `json:"isFromApp"`
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -78,6 +78,7 @@ const message = {
|
|||
interval: 'Interval',
|
||||
user: 'User',
|
||||
title: 'Title',
|
||||
network: 'Network',
|
||||
port: 'Port',
|
||||
protocol: 'Protocol',
|
||||
tableSetting: 'Table setting',
|
||||
|
|
|
@ -78,6 +78,7 @@ const message = {
|
|||
interval: '耗時',
|
||||
user: '用戶',
|
||||
title: '標題',
|
||||
network: '網絡',
|
||||
port: '端口',
|
||||
protocol: '協議',
|
||||
tableSetting: '列表設置',
|
||||
|
|
|
@ -78,6 +78,7 @@ const message = {
|
|||
interval: '耗时',
|
||||
user: '用户',
|
||||
title: '标题',
|
||||
network: '网络',
|
||||
port: '端口',
|
||||
protocol: '协议',
|
||||
tableSetting: '列表设置',
|
||||
|
|
|
@ -90,14 +90,25 @@
|
|||
<el-table-column :label="$t('container.source')" show-overflow-tooltip min-width="100" fix>
|
||||
<template #default="{ row }">
|
||||
<div v-if="row.hasLoad">
|
||||
<div>CPU: {{ row.cpuPercent.toFixed(2) }}%</div>
|
||||
<div>{{ $t('monitor.memory') }}: {{ row.memoryPercent.toFixed(2) }}%</div>
|
||||
<div>CPU: {{ row.cpuPercent.toFixed(2) }}% {{ $t('monitor.memory') }}: {{ row.memoryPercent.toFixed(2) }}%</div>
|
||||
</div>
|
||||
<div v-if="!row.hasLoad">
|
||||
<el-button link loading></el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="$t('commons.table.network')"
|
||||
:width="mobile ? 80 : 'auto'"
|
||||
min-width="80"
|
||||
fix
|
||||
>
|
||||
<div v-if="row.network">
|
||||
<div v-for="(item, index) in row.network" :key="index">
|
||||
<div>{{ item }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="$t('commons.table.port')"
|
||||
:width="mobile ? 260 : 'auto'"
|
||||
|
|
Loading…
Reference in New Issue