mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 22:18:07 +08:00
style: 优化概览页 CPU 显示 (#4721)
This commit is contained in:
parent
6a30ccd5dc
commit
b9dde4ebf0
@ -140,6 +140,7 @@ export namespace Setting {
|
|||||||
upload: string;
|
upload: string;
|
||||||
}
|
}
|
||||||
export interface UpgradeInfo {
|
export interface UpgradeInfo {
|
||||||
|
testVersion: string;
|
||||||
newVersion: string;
|
newVersion: string;
|
||||||
latestVersion: string;
|
latestVersion: string;
|
||||||
releaseNote: string;
|
releaseNote: string;
|
||||||
|
@ -58,6 +58,8 @@ const message = {
|
|||||||
fullscreen: 'Fullscreen',
|
fullscreen: 'Fullscreen',
|
||||||
quitFullscreen: 'Quit Fullscreen',
|
quitFullscreen: 'Quit Fullscreen',
|
||||||
update: 'Edit',
|
update: 'Edit',
|
||||||
|
showAll: 'Show All',
|
||||||
|
hideSome: 'Hide Some',
|
||||||
},
|
},
|
||||||
search: {
|
search: {
|
||||||
timeStart: 'Time start',
|
timeStart: 'Time start',
|
||||||
|
@ -58,6 +58,8 @@ const message = {
|
|||||||
fullscreen: '全屏',
|
fullscreen: '全屏',
|
||||||
quitFullscreen: '退出全屏',
|
quitFullscreen: '退出全屏',
|
||||||
update: '編輯',
|
update: '編輯',
|
||||||
|
showAll: '顯示所有',
|
||||||
|
hideSome: '隱藏部分',
|
||||||
},
|
},
|
||||||
search: {
|
search: {
|
||||||
timeStart: '開始時間',
|
timeStart: '開始時間',
|
||||||
|
@ -58,6 +58,8 @@ const message = {
|
|||||||
fullscreen: '全屏',
|
fullscreen: '全屏',
|
||||||
quitFullscreen: '退出全屏',
|
quitFullscreen: '退出全屏',
|
||||||
update: '编辑',
|
update: '编辑',
|
||||||
|
showAll: '显示所有',
|
||||||
|
hideSome: '隐藏部分',
|
||||||
},
|
},
|
||||||
search: {
|
search: {
|
||||||
timeStart: '开始时间',
|
timeStart: '开始时间',
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col :xs="12" :sm="12" :md="6" :lg="6" :xl="6" align="center">
|
<el-col :xs="12" :sm="12" :md="6" :lg="6" :xl="6" align="center">
|
||||||
<el-popover
|
<el-popover placement="bottom" :width="loadWidth()" trigger="hover" v-if="chartsOption['cpu']">
|
||||||
placement="bottom"
|
|
||||||
:width="currentInfo.cpuPercent.length < 36 ? 300 : (currentInfo.cpuPercent.length / 12) * 150"
|
|
||||||
trigger="hover"
|
|
||||||
v-if="chartsOption['cpu']"
|
|
||||||
>
|
|
||||||
<div>
|
<div>
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
effect="dark"
|
effect="dark"
|
||||||
@ -14,7 +9,7 @@
|
|||||||
v-if="baseInfo.cpuModelName.length > 40"
|
v-if="baseInfo.cpuModelName.length > 40"
|
||||||
placement="top"
|
placement="top"
|
||||||
>
|
>
|
||||||
<el-tag>
|
<el-tag class="cpuModeTag">
|
||||||
{{ baseInfo.cpuModelName.substring(0, 40) + '...' }}
|
{{ baseInfo.cpuModelName.substring(0, 40) + '...' }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
@ -22,14 +17,24 @@
|
|||||||
{{ baseInfo.cpuModelName }}
|
{{ baseInfo.cpuModelName }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<el-tag class="tagClass">
|
<el-tag class="cpuDetailTag">{{ $t('home.core') }} *{{ baseInfo.cpuCores }}</el-tag>
|
||||||
{{ $t('home.core') }} *{{ baseInfo.cpuCores }} {{ $t('home.logicCore') }} *{{
|
<el-tag class="cpuDetailTag">{{ $t('home.logicCore') }} *{{ baseInfo.cpuLogicalCores }}</el-tag>
|
||||||
baseInfo.cpuLogicalCores
|
|
||||||
}}
|
|
||||||
</el-tag>
|
|
||||||
<br />
|
<br />
|
||||||
<div v-for="(item, index) of currentInfo.cpuPercent" :key="index">
|
<div v-for="(item, index) of currentInfo.cpuPercent" :key="index">
|
||||||
<el-tag class="tagCPUClass">CPU-{{ index }}: {{ formatNumber(item) }}%</el-tag>
|
<el-tag v-if="cpuShowAll || (!cpuShowAll && index < 32)" class="tagCPUClass">
|
||||||
|
CPU-{{ index }}: {{ formatNumber(item) }}%
|
||||||
|
</el-tag>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="currentInfo.cpuPercent.length > 32" class="mt-1 float-right">
|
||||||
|
<el-button v-if="!cpuShowAll" @click="cpuShowAll = true" link type="primary" size="small">
|
||||||
|
{{ $t('commons.button.showAll') }}
|
||||||
|
<el-icon><DArrowRight /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
<el-button v-if="cpuShowAll" @click="cpuShowAll = false" link type="primary" size="small">
|
||||||
|
{{ $t('commons.button.hideSome') }}
|
||||||
|
<el-icon><DArrowLeft /></el-icon>
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<v-charts
|
<v-charts
|
||||||
@ -302,6 +307,8 @@ const currentInfo = ref<Dashboard.CurrentInfo>({
|
|||||||
shotTime: new Date(),
|
shotTime: new Date(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const cpuShowAll = ref();
|
||||||
|
|
||||||
const chartsOption = ref({ cpu: null, memory: null, load: null });
|
const chartsOption = ref({ cpu: null, memory: null, load: null });
|
||||||
|
|
||||||
const acceptParams = (current: Dashboard.CurrentInfo, base: Dashboard.BaseInfo, isInit: boolean): void => {
|
const acceptParams = (current: Dashboard.CurrentInfo, base: Dashboard.BaseInfo, isInit: boolean): void => {
|
||||||
@ -359,6 +366,14 @@ const goGPU = () => {
|
|||||||
router.push({ name: 'GPU' });
|
router.push({ name: 'GPU' });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const loadWidth = () => {
|
||||||
|
if (!cpuShowAll.value || currentInfo.value.cpuPercent.length < 32) {
|
||||||
|
return 310;
|
||||||
|
}
|
||||||
|
let line = Math.floor(currentInfo.value.cpuPercent.length / 16);
|
||||||
|
return line * 141 + 28;
|
||||||
|
};
|
||||||
|
|
||||||
function formatNumber(val: number) {
|
function formatNumber(val: number) {
|
||||||
return Number(val.toFixed(2));
|
return Number(val.toFixed(2));
|
||||||
}
|
}
|
||||||
@ -369,6 +384,18 @@ defineExpose({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
.cpuModeTag {
|
||||||
|
justify-content: flex-start !important;
|
||||||
|
text-align: left !important;
|
||||||
|
width: 280px;
|
||||||
|
}
|
||||||
|
.cpuDetailTag {
|
||||||
|
justify-content: flex-start !important;
|
||||||
|
text-align: left !important;
|
||||||
|
width: 140px;
|
||||||
|
margin-top: 3px;
|
||||||
|
margin-left: 1px;
|
||||||
|
}
|
||||||
.tagClass {
|
.tagClass {
|
||||||
margin-top: 3px;
|
margin-top: 3px;
|
||||||
}
|
}
|
||||||
@ -378,8 +405,8 @@ defineExpose({
|
|||||||
text-align: left !important;
|
text-align: left !important;
|
||||||
float: left;
|
float: left;
|
||||||
margin-top: 3px;
|
margin-top: 3px;
|
||||||
margin-left: 4px;
|
margin-left: 1px;
|
||||||
width: 100px;
|
width: 140px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.buttonClass {
|
.buttonClass {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user