1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 22:18:07 +08:00

fix: 解决概览页 CPU 核心过多导致的显示问题 (#4490)

Refs #3966
This commit is contained in:
ssongliu 2024-04-13 19:44:07 +08:00 committed by GitHub
parent 62bead5c50
commit c055a07e57
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 22 additions and 8 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt"
"net/http"
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/i18n"
"github.com/1Panel-dev/1Panel/backend/middleware"
@ -63,6 +64,8 @@ func Routers() *gin.Engine {
PublicGroup.GET("/health", func(c *gin.Context) {
c.JSON(200, "ok")
})
baseApi := v1.ApiGroupApp.BaseApi
PublicGroup.GET("/api/v1/respagecode", baseApi.GetResponsePage)
PublicGroup.Use(gzip.Gzip(gzip.DefaultCompression))
setWebStatic(PublicGroup)
}

View File

@ -18,6 +18,5 @@ func (s *BaseRouter) InitRouter(Router *gin.RouterGroup) {
baseRouter.POST("/logout", baseApi.LogOut)
baseRouter.GET("/demo", baseApi.CheckIsDemo)
baseRouter.GET("/language", baseApi.GetLanguage)
baseRouter.GET("/respagecode", baseApi.GetResponsePage)
}
}

View File

@ -22,7 +22,7 @@ export const checkIsSafety = (code: string) => {
};
export const getResponsePage = () => {
return http.get<string>(`/auth/respagecode`);
return http.get<string>(`/respagecode`);
};
export const checkIsDemo = () => {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

View File

@ -1,7 +1,12 @@
<template>
<el-row :gutter="10">
<el-col :xs="12" :sm="12" :md="6" :lg="6" :xl="6" align="center">
<el-popover placement="bottom" :width="300" trigger="hover" v-if="chartsOption['cpu']">
<el-popover
placement="bottom"
:width="currentInfo.cpuPercent.length < 36 ? 300 : (currentInfo.cpuPercent.length / 12) * 150"
trigger="hover"
v-if="chartsOption['cpu']"
>
<div>
<el-tooltip
effect="dark"
@ -23,11 +28,9 @@
}}
</el-tag>
<br />
<el-row :gutter="5">
<el-col :span="12" v-for="(item, index) of currentInfo.cpuPercent" :key="index">
<el-tag class="tagClass">CPU-{{ index }}: {{ formatNumber(item) }}%</el-tag>
</el-col>
</el-row>
<div v-for="(item, index) of currentInfo.cpuPercent" :key="index">
<el-tag class="tagCPUClass">CPU-{{ index }}: {{ formatNumber(item) }}%</el-tag>
</div>
<template #reference>
<v-charts
height="160px"
@ -370,6 +373,15 @@ defineExpose({
margin-top: 3px;
}
.tagCPUClass {
justify-content: flex-start !important;
text-align: left !important;
float: left;
margin-top: 3px;
margin-left: 4px;
width: 100px;
}
.buttonClass {
margin-top: 28%;
font-size: 14px;