mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-18 22:22:59 +08:00
feat:显示当前ip,系统网络代理地址 (#6235)
This commit is contained in:
parent
c83cfbe8b0
commit
3d5580ad9d
@ -16,7 +16,8 @@ type DashboardBase struct {
|
||||
KernelArch string `json:"kernelArch"`
|
||||
KernelVersion string `json:"kernelVersion"`
|
||||
VirtualizationSystem string `json:"virtualizationSystem"`
|
||||
|
||||
IpV4Addr string `json:"ipV4Addr"`
|
||||
SystemProxy string `json:"systemProxy"`
|
||||
CPUCores int `json:"cpuCores"`
|
||||
CPULogicalCores int `json:"cpuLogicalCores"`
|
||||
CPUModelName string `json:"cpuModelName"`
|
||||
|
@ -1,8 +1,10 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
@ -94,11 +96,20 @@ func (u *DashboardService) LoadBaseInfo(ioOption string, netOption string) (*dto
|
||||
baseInfo.KernelVersion = hostInfo.KernelVersion
|
||||
ss, _ := json.Marshal(hostInfo)
|
||||
baseInfo.VirtualizationSystem = string(ss)
|
||||
|
||||
baseInfo.IpV4Addr=host.IpV4AddrWithContext(context.Background())
|
||||
httpProxy := os.Getenv("http_proxy")
|
||||
if httpProxy == "" {
|
||||
httpProxy = os.Getenv("HTTP_PROXY") // 也检查大写的环境变量名
|
||||
}
|
||||
if httpProxy!=""{
|
||||
baseInfo.SystemProxy=httpProxy
|
||||
}
|
||||
baseInfo.SystemProxy="noProxy"
|
||||
appInstall, err := appInstallRepo.ListBy()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
baseInfo.AppInstalledNumber = len(appInstall)
|
||||
postgresqlDbs, err := postgresqlRepo.List()
|
||||
if err != nil {
|
||||
|
@ -22,7 +22,9 @@ export namespace Dashboard {
|
||||
kernelArch: string;
|
||||
kernelVersion: string;
|
||||
virtualizationSystem: string;
|
||||
|
||||
IpV4Addr: string;
|
||||
httpProxy: string;
|
||||
|
||||
cpuCores: number;
|
||||
cpuLogicalCores: number;
|
||||
cpuModelName: string;
|
||||
|
@ -344,6 +344,8 @@ const message = {
|
||||
kernelArch: 'Kernel arch',
|
||||
network: 'Network',
|
||||
io: 'Disk IO',
|
||||
ip: 'Ip Addr',
|
||||
proxy: 'System Proxy',
|
||||
baseInfo: 'Base info',
|
||||
totalSend: 'Total send',
|
||||
totalRecv: 'Total recv',
|
||||
|
@ -337,6 +337,8 @@ const message = {
|
||||
kernelArch: '系统类型',
|
||||
network: '流量',
|
||||
io: '磁盘 IO',
|
||||
ip: 'IP地址',
|
||||
proxy: '系统代理',
|
||||
baseInfo: '基本信息',
|
||||
totalSend: '总发送',
|
||||
totalRecv: '总接收',
|
||||
|
@ -225,6 +225,25 @@
|
||||
</template>
|
||||
{{ loadUpTime(currentInfo.uptime) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item class-name="system-content">
|
||||
<template #label>
|
||||
<span class="system-label">
|
||||
{{ $t('home.ip') }}
|
||||
</span>
|
||||
{{ baseInfo.IpV4Addr }}
|
||||
</template>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
v-if="baseInfo.httpProxy !== 'noProxy'"
|
||||
class-name="system-content"
|
||||
>
|
||||
<template #label>
|
||||
<span class="system-label">
|
||||
{{ $t('home.proxy') }}
|
||||
</span>
|
||||
{{ baseInfo.httpProxy }}
|
||||
</template>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-scrollbar>
|
||||
</template>
|
||||
@ -303,7 +322,8 @@ const baseInfo = ref<Dashboard.BaseInfo>({
|
||||
kernelArch: '',
|
||||
kernelVersion: '',
|
||||
virtualizationSystem: '',
|
||||
|
||||
IpV4Addr: '',
|
||||
httpProxy: '',
|
||||
cpuCores: 0,
|
||||
cpuLogicalCores: 0,
|
||||
cpuModelName: '',
|
||||
|
Loading…
Reference in New Issue
Block a user