mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-10-25 09:43:07 +08:00
fix: 根目录 1Panel 改为小写
This commit is contained in:
@@ -133,12 +133,12 @@ func (u *SnapshotService) SnapshotCreate(req dto.SnapshotCreate) error {
|
||||
return
|
||||
}
|
||||
|
||||
if err := u.handlePanelDatas(fileOp, "snapshot", global.CONF.BaseDir+"/1Panel", backupPanelDir, localDir, dockerDataDir); err != nil {
|
||||
if err := u.handlePanelDatas(fileOp, "snapshot", global.CONF.BaseDir+"/1panel", backupPanelDir, localDir, dockerDataDir); err != nil {
|
||||
updateSnapshotStatus(snap.ID, constant.StatusFailed, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
snapJson := SnapshotJson{DockerDataDir: dockerDataDir, BackupDataDir: localDir, PanelDataDir: global.CONF.BaseDir + "/1Panel", LiveRestoreEnabled: liveRestoreStatus}
|
||||
snapJson := SnapshotJson{DockerDataDir: dockerDataDir, BackupDataDir: localDir, PanelDataDir: global.CONF.BaseDir + "/1panel", LiveRestoreEnabled: liveRestoreStatus}
|
||||
if err := u.saveJson(snapJson, rootDir); err != nil {
|
||||
updateSnapshotStatus(snap.ID, constant.StatusFailed, fmt.Sprintf("save snapshot json failed, err: %v", err))
|
||||
return
|
||||
@@ -235,7 +235,7 @@ func (u *SnapshotService) SnapshotRecover(req dto.SnapshotRecover) error {
|
||||
isReTry = false
|
||||
}
|
||||
|
||||
snapJson.OldPanelDataDir = global.CONF.BaseDir + "/1Panel"
|
||||
snapJson.OldPanelDataDir = global.CONF.BaseDir + "/1panel"
|
||||
snapJson.OldBackupDataDir = localDir
|
||||
recoverPanelDir := fmt.Sprintf("%s/%s/1panel", baseDir, snap.Name)
|
||||
liveRestore := false
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/1Panel-dev/1Panel/backend/init/log"
|
||||
"github.com/1Panel-dev/1Panel/backend/init/viper"
|
||||
"github.com/1Panel-dev/1Panel/backend/utils/files"
|
||||
"github.com/google/go-github/github"
|
||||
)
|
||||
|
||||
func TestDi(t *testing.T) {
|
||||
viper.Init()
|
||||
log.Init()
|
||||
ti := time.Now().Format("20060102150405")
|
||||
oss := "https://1panel.oss-cn-hangzhou.aliyuncs.com"
|
||||
tmpPath := fmt.Sprintf("/opt/1Panel/data/tmp/%s_upgrade.tar.gz", ti)
|
||||
fileOp := files.NewFileOp()
|
||||
downloadPath := fmt.Sprintf("%s/releases/v1.0.1/v1.0.1.tar.gz", oss)
|
||||
if err := fileOp.DownloadFile(downloadPath, tmpPath); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGit(t *testing.T) {
|
||||
client := github.NewClient(nil)
|
||||
stats, _, err := client.Repositories.GetLatestRelease(context.Background(), "KubeOperator", "KubeOperator")
|
||||
fmt.Println(github.Timestamp(*stats.PublishedAt), err)
|
||||
}
|
||||
|
||||
func TestSdasd(t *testing.T) {
|
||||
u := NewISnapshotService()
|
||||
var snapjson SnapshotJson
|
||||
snapjson, _ = u.readFromJson("/Users/slooop/Downloads/snapshot.json")
|
||||
fmt.Println(111, snapjson)
|
||||
// if err := ioutil.WriteFile("/Users/slooop/Downloads/snapshot.json", []byte("111xxxxx"), 0640); err != nil {
|
||||
// fmt.Println(err)
|
||||
// }
|
||||
}
|
||||
|
||||
func TestCp(t *testing.T) {
|
||||
_, err := ioutil.ReadFile("/Users/slooop/Downloads/test/main")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
if err := ioutil.WriteFile("/Users/slooop/Downloads/test/main", []byte("sdadasd"), 0640); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
@@ -175,6 +175,7 @@ var AddTableImageRepo = &gormigrate.Migration{
|
||||
}
|
||||
item := &model.ImageRepo{
|
||||
Name: "Docker Hub",
|
||||
Protocol: "https",
|
||||
DownloadUrl: "docker.io",
|
||||
Status: constant.StatusSuccess,
|
||||
}
|
||||
|
||||
@@ -3,16 +3,22 @@ package viper
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/1Panel-dev/1Panel/backend/configs"
|
||||
"github.com/1Panel-dev/1Panel/backend/global"
|
||||
"github.com/1Panel-dev/1Panel/backend/utils/cmd"
|
||||
"github.com/1Panel-dev/1Panel/cmd/server/conf"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func Init() {
|
||||
baseDir := "/opt"
|
||||
stdout, err := cmd.Exec("grep '^BASE_DIR=' /Users/slooop/Downloads/1pctl | cut -d'=' -f2")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
baseDir := strings.ReplaceAll(stdout, "\n", "")
|
||||
v := viper.NewWithOptions()
|
||||
v.SetConfigType("yaml")
|
||||
reader := bytes.NewReader(conf.AppYaml)
|
||||
@@ -30,10 +36,10 @@ func Init() {
|
||||
}
|
||||
global.CONF = serverConfig
|
||||
global.CONF.BaseDir = baseDir
|
||||
global.CONF.System.DataDir = global.CONF.BaseDir + "/1Panel/data"
|
||||
global.CONF.System.Cache = global.CONF.BaseDir + "/1Panel/data/cache"
|
||||
global.CONF.System.Backup = global.CONF.BaseDir + "/1Panel/data/backup"
|
||||
global.CONF.System.DbPath = global.CONF.BaseDir + "/1Panel/data/db"
|
||||
global.CONF.System.LogPath = global.CONF.BaseDir + "/1Panel/log"
|
||||
global.CONF.System.DataDir = global.CONF.BaseDir + "/1panel/data"
|
||||
global.CONF.System.Cache = global.CONF.BaseDir + "/1panel/data/cache"
|
||||
global.CONF.System.Backup = global.CONF.BaseDir + "/1panel/data/backup"
|
||||
global.CONF.System.DbPath = global.CONF.BaseDir + "/1panel/data/db"
|
||||
global.CONF.System.LogPath = global.CONF.BaseDir + "/1panel/log"
|
||||
global.Viper = v
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
]"
|
||||
/>
|
||||
<el-row :gutter="20" style="margin-top: 20px">
|
||||
<el-col :span="18">
|
||||
<el-col :span="16">
|
||||
<CardWithHeader :header="$t('home.overview')">
|
||||
<template #body>
|
||||
<el-form label-position="top" label-width="100px">
|
||||
@@ -108,17 +108,17 @@
|
||||
<div
|
||||
v-if="chartOption === 'io'"
|
||||
id="ioChart"
|
||||
style="margin-top: 20px; width: 100%; height: 320px"
|
||||
style="margin-top: 20px; width: 100%; height: 324px"
|
||||
></div>
|
||||
<div
|
||||
v-if="chartOption === 'network'"
|
||||
id="networkChart"
|
||||
style="margin-top: 20px; width: 100%; height: 320px"
|
||||
style="margin-top: 20px; width: 100%; height: 324px"
|
||||
></div>
|
||||
</template>
|
||||
</CardWithHeader>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-col :span="8">
|
||||
<CardWithHeader :header="$t('home.systemInfo')">
|
||||
<template #body>
|
||||
<el-form style="margin-left: 10px">
|
||||
|
||||
@@ -1,140 +1,100 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="6" align="center">
|
||||
<el-popover placement="bottom" :width="300" trigger="hover">
|
||||
<div style="margin-bottom: 10px">
|
||||
<el-tag>{{ baseInfo.cpuModelName }}</el-tag>
|
||||
</div>
|
||||
<el-tag>
|
||||
{{ $t('home.core') }} *{{ baseInfo.cpuCores }}; {{ $t('home.logicCore') }} *{{
|
||||
baseInfo.cpuLogicalCores
|
||||
}}
|
||||
</el-tag>
|
||||
<br />
|
||||
<el-tag style="margin-top: 5px" v-for="(item, index) of currentInfo.cpuPercent" :key="index">
|
||||
CPU-{{ index }}: {{ formatNumber(item) }}%
|
||||
</el-tag>
|
||||
<template #reference>
|
||||
<el-progress
|
||||
type="dashboard"
|
||||
:width="100"
|
||||
:stroke-width="10"
|
||||
:percentage="formatNumber(currentInfo.cpuUsedPercent)"
|
||||
>
|
||||
<template #default="{ percentage }">
|
||||
<span class="percentage-value">{{ percentage }}%</span>
|
||||
<span class="percentage-label">CPU</span>
|
||||
</template>
|
||||
</el-progress>
|
||||
</template>
|
||||
</el-popover>
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="6" align="center">
|
||||
<el-popover placement="bottom" :width="300" trigger="hover">
|
||||
<div style="margin-bottom: 10px">
|
||||
<el-tag>{{ baseInfo.cpuModelName }}</el-tag>
|
||||
</div>
|
||||
<el-tag>
|
||||
{{ $t('home.core') }} *{{ baseInfo.cpuCores }}; {{ $t('home.logicCore') }} *{{
|
||||
baseInfo.cpuLogicalCores
|
||||
}}
|
||||
</el-tag>
|
||||
<br />
|
||||
<span class="input-help">
|
||||
( {{ formatNumber(currentInfo.cpuUsed) }} / {{ currentInfo.cpuTotal }} ) Core
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col :span="6" align="center">
|
||||
<el-progress
|
||||
type="dashboard"
|
||||
:width="100"
|
||||
:stroke-width="10"
|
||||
:percentage="formatNumber(currentInfo.MemoryUsedPercent)"
|
||||
>
|
||||
<template #default="{ percentage }">
|
||||
<span class="percentage-value">{{ percentage }}%</span>
|
||||
<span class="percentage-label">{{ $t('monitor.memory') }}</span>
|
||||
</template>
|
||||
</el-progress>
|
||||
<br />
|
||||
<span class="input-help">
|
||||
( {{ formatNumber(currentInfo.memoryUsed / 1024 / 1024) }} /
|
||||
{{ formatNumber(currentInfo.memoryTotal / 1024 / 1024) }} ) MB
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col :span="6" align="center">
|
||||
<el-popover placement="bottom" :width="200" trigger="hover">
|
||||
<el-tag style="margin-top: 5px">
|
||||
{{ $t('home.loadAverage', [1]) }}: {{ formatNumber(currentInfo.load1) }}
|
||||
</el-tag>
|
||||
<el-tag style="margin-top: 5px">
|
||||
{{ $t('home.loadAverage', [5]) }}: {{ formatNumber(currentInfo.load5) }}
|
||||
</el-tag>
|
||||
<el-tag style="margin-top: 5px">
|
||||
{{ $t('home.loadAverage', [15]) }}: {{ formatNumber(currentInfo.load15) }}
|
||||
</el-tag>
|
||||
<template #reference>
|
||||
<el-progress
|
||||
type="dashboard"
|
||||
:width="100"
|
||||
:stroke-width="10"
|
||||
:percentage="formatNumber(currentInfo.loadUsagePercent)"
|
||||
>
|
||||
<template #default="{ percentage }">
|
||||
<span class="percentage-value">{{ percentage }}%</span>
|
||||
<span class="percentage-label">{{ $t('home.load') }}</span>
|
||||
</template>
|
||||
</el-progress>
|
||||
</template>
|
||||
</el-popover>
|
||||
<br />
|
||||
<span class="input-help">{{ loadStatus(currentInfo.loadUsagePercent) }}</span>
|
||||
</el-col>
|
||||
<el-col :span="6" align="center">
|
||||
<el-popover placement="bottom" :width="160" trigger="hover">
|
||||
<el-tag>{{ $t('home.mount') }}: /</el-tag>
|
||||
<div><el-tag style="margin-top: 10px">iNode</el-tag></div>
|
||||
<el-tag style="margin-top: 5px">{{ $t('home.total') }}: {{ currentInfo.inodesTotal }}</el-tag>
|
||||
<el-tag style="margin-top: 3px">{{ $t('home.used') }}: {{ currentInfo.inodesUsed }}</el-tag>
|
||||
<el-tag style="margin-top: 3px">{{ $t('home.free') }}: {{ currentInfo.inodesFree }}</el-tag>
|
||||
<el-tag style="margin-top: 3px">
|
||||
{{ $t('home.percent') }}: {{ formatNumber(currentInfo.inodesUsedPercent) }}%
|
||||
</el-tag>
|
||||
<el-tag style="margin-top: 5px" v-for="(item, index) of currentInfo.cpuPercent" :key="index">
|
||||
CPU-{{ index }}: {{ formatNumber(item) }}%
|
||||
</el-tag>
|
||||
<template #reference>
|
||||
<div id="cpu" style="width: 100%; height: 200px"></div>
|
||||
</template>
|
||||
</el-popover>
|
||||
<span class="input-help" style="margin-top: -10px">
|
||||
( {{ formatNumber(currentInfo.cpuUsed) }} / {{ currentInfo.cpuTotal }} ) Core
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col :span="6" align="center">
|
||||
<div id="memory" style="width: 100%; height: 200px"></div>
|
||||
<span class="input-help">
|
||||
( {{ formatNumber(currentInfo.memoryUsed / 1024 / 1024) }} /
|
||||
{{ formatNumber(currentInfo.memoryTotal / 1024 / 1024) }} ) MB
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col :span="6" align="center">
|
||||
<el-popover placement="bottom" :width="200" trigger="hover">
|
||||
<el-tag style="margin-top: 5px">
|
||||
{{ $t('home.loadAverage', [1]) }}: {{ formatNumber(currentInfo.load1) }}
|
||||
</el-tag>
|
||||
<el-tag style="margin-top: 5px">
|
||||
{{ $t('home.loadAverage', [5]) }}: {{ formatNumber(currentInfo.load5) }}
|
||||
</el-tag>
|
||||
<el-tag style="margin-top: 5px">
|
||||
{{ $t('home.loadAverage', [15]) }}: {{ formatNumber(currentInfo.load15) }}
|
||||
</el-tag>
|
||||
<template #reference>
|
||||
<div id="load" style="width: 100%; height: 200px"></div>
|
||||
</template>
|
||||
</el-popover>
|
||||
<span class="input-help">{{ loadStatus(currentInfo.loadUsagePercent) }}</span>
|
||||
</el-col>
|
||||
<el-col :span="6" align="center">
|
||||
<el-popover placement="bottom" :width="260" trigger="hover">
|
||||
<el-row :gutter="5">
|
||||
<el-col :span="12">
|
||||
<el-tag>{{ $t('home.mount') }}: /</el-tag>
|
||||
<div><el-tag style="margin-top: 10px">iNode</el-tag></div>
|
||||
<el-tag style="margin-top: 5px">{{ $t('home.total') }}: {{ currentInfo.inodesTotal }}</el-tag>
|
||||
<el-tag style="margin-top: 3px">{{ $t('home.used') }}: {{ currentInfo.inodesUsed }}</el-tag>
|
||||
<el-tag style="margin-top: 3px">{{ $t('home.free') }}: {{ currentInfo.inodesFree }}</el-tag>
|
||||
<el-tag style="margin-top: 3px">
|
||||
{{ $t('home.percent') }}: {{ formatNumber(currentInfo.inodesUsedPercent) }}%
|
||||
</el-tag>
|
||||
</el-col>
|
||||
|
||||
<div>
|
||||
<el-tag style="margin-top: 10px">{{ $t('monitor.disk') }}</el-tag>
|
||||
</div>
|
||||
<el-tag style="margin-top: 5px">
|
||||
{{ $t('home.total') }}: {{ formatNumber(currentInfo.total / 1024 / 1024 / 1024) }} GB
|
||||
</el-tag>
|
||||
<el-tag style="margin-top: 3px">
|
||||
{{ $t('home.used') }}: {{ formatNumber(currentInfo.used / 1024 / 1024 / 1024) }} GB
|
||||
</el-tag>
|
||||
<el-tag style="margin-top: 3px">
|
||||
{{ $t('home.free') }}: {{ formatNumber(currentInfo.free / 1024 / 1024 / 1024) }} GB
|
||||
</el-tag>
|
||||
<el-tag style="margin-top: 3px">
|
||||
{{ $t('home.percent') }}: {{ formatNumber(currentInfo.usedPercent) }}%
|
||||
</el-tag>
|
||||
<template #reference>
|
||||
<el-progress
|
||||
type="dashboard"
|
||||
:width="100"
|
||||
:stroke-width="10"
|
||||
:percentage="formatNumber(currentInfo.usedPercent)"
|
||||
>
|
||||
<template #default="{ percentage }">
|
||||
<span class="percentage-value">{{ percentage }}%</span>
|
||||
<span class="percentage-label">{{ $t('monitor.disk') }}</span>
|
||||
</template>
|
||||
</el-progress>
|
||||
</template>
|
||||
</el-popover>
|
||||
|
||||
<br />
|
||||
<span class="input-help">
|
||||
( {{ formatNumber(currentInfo.used / 1024 / 1024 / 1024) }} /
|
||||
{{ formatNumber(currentInfo.total / 1024 / 1024 / 1024) }} ) GB
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-col :span="12">
|
||||
<div>
|
||||
<el-tag style="margin-top: 35px">{{ $t('monitor.disk') }}</el-tag>
|
||||
</div>
|
||||
<el-tag style="margin-top: 5px">
|
||||
{{ $t('home.total') }}: {{ formatNumber(currentInfo.total / 1024 / 1024 / 1024) }} GB
|
||||
</el-tag>
|
||||
<el-tag style="margin-top: 3px">
|
||||
{{ $t('home.used') }}: {{ formatNumber(currentInfo.used / 1024 / 1024 / 1024) }} GB
|
||||
</el-tag>
|
||||
<el-tag style="margin-top: 3px">
|
||||
{{ $t('home.free') }}: {{ formatNumber(currentInfo.free / 1024 / 1024 / 1024) }} GB
|
||||
</el-tag>
|
||||
<el-tag style="margin-top: 3px">
|
||||
{{ $t('home.percent') }}: {{ formatNumber(currentInfo.usedPercent) }}%
|
||||
</el-tag>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<template #reference>
|
||||
<div id="disk" style="width: 100%; height: 200px"></div>
|
||||
</template>
|
||||
</el-popover>
|
||||
<span class="input-help">
|
||||
( {{ formatNumber(currentInfo.used / 1024 / 1024 / 1024) }} /
|
||||
{{ formatNumber(currentInfo.total / 1024 / 1024 / 1024) }} ) GB
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
<script setup lang="ts">
|
||||
import { Dashboard } from '@/api/interface/dashboard';
|
||||
import i18n from '@/lang';
|
||||
import { ref } from 'vue';
|
||||
import * as echarts from 'echarts';
|
||||
import { onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
|
||||
const baseInfo = ref<Dashboard.BaseInfo>({
|
||||
haloID: 0,
|
||||
@@ -206,11 +166,90 @@ const currentInfo = ref<Dashboard.CurrentInfo>({
|
||||
const acceptParams = (current: Dashboard.CurrentInfo, base: Dashboard.BaseInfo): void => {
|
||||
currentInfo.value = current;
|
||||
baseInfo.value = base;
|
||||
freshChart('cpu', 'CPU', formatNumber(currentInfo.value.cpuUsedPercent));
|
||||
freshChart('memory', i18n.global.t('monitor.memory'), formatNumber(currentInfo.value.MemoryUsedPercent));
|
||||
freshChart('load', i18n.global.t('home.load'), formatNumber(currentInfo.value.loadUsagePercent));
|
||||
freshChart('disk', i18n.global.t('monitor.disk'), formatNumber(currentInfo.value.usedPercent));
|
||||
};
|
||||
|
||||
function formatNumber(val: number) {
|
||||
return Number(val.toFixed(2));
|
||||
}
|
||||
const freshChart = (chartName: string, Title: string, Data: number) => {
|
||||
let myChart = echarts.getInstanceByDom(document.getElementById(chartName) as HTMLElement);
|
||||
if (myChart === null || myChart === undefined) {
|
||||
myChart = echarts.init(document.getElementById(chartName) as HTMLElement);
|
||||
}
|
||||
const option = {
|
||||
title: [
|
||||
{
|
||||
text: Data + '%',
|
||||
x: 'center',
|
||||
top: '55%',
|
||||
textStyle: { fontSize: 16, fontWeight: '100' },
|
||||
},
|
||||
{
|
||||
text: Title,
|
||||
x: 'center',
|
||||
y: 'center',
|
||||
textStyle: {
|
||||
fontSize: '20',
|
||||
fontFamily: 'DINAlternate-Bold, DINAlternate',
|
||||
foontWeight: '600',
|
||||
},
|
||||
},
|
||||
],
|
||||
backgroundColor: '#FFFFFF',
|
||||
polar: { radius: ['42%', '52%'], center: ['50%', '50%'] },
|
||||
angleAxis: { max: 100, show: false },
|
||||
radiusAxis: {
|
||||
type: 'category',
|
||||
show: true,
|
||||
axisLabel: { show: false },
|
||||
axisLine: { show: false },
|
||||
axisTick: { show: false },
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '',
|
||||
type: 'bar',
|
||||
roundCap: true,
|
||||
barWidth: 30,
|
||||
showBackground: true,
|
||||
backgroundStyle: { color: 'rgba(66, 66, 66, .3)' },
|
||||
data: [Data],
|
||||
coordinateSystem: 'polar',
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
|
||||
{
|
||||
offset: 0,
|
||||
color: '#16CEB9',
|
||||
},
|
||||
{ offset: 1, color: '#6648FF' },
|
||||
]),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: '',
|
||||
type: 'pie',
|
||||
startAngle: 80,
|
||||
radius: ['56%'],
|
||||
center: ['50%', '50%'],
|
||||
itemStyle: { color: 'rgba(66, 66, 66, .1)', borderWidth: 1, borderColor: '#5269EE' },
|
||||
data: [100],
|
||||
},
|
||||
{
|
||||
name: '',
|
||||
type: 'pie',
|
||||
startAngle: 80,
|
||||
radius: ['38%'],
|
||||
center: ['50%', '50%'],
|
||||
itemStyle: { color: 'rgba(66, 66, 66, .1)', borderWidth: 1, borderColor: '#5269EE' },
|
||||
data: [100],
|
||||
},
|
||||
],
|
||||
};
|
||||
myChart.setOption(option, true);
|
||||
};
|
||||
|
||||
function loadStatus(val: number) {
|
||||
if (val < 30) {
|
||||
@@ -224,19 +263,27 @@ function loadStatus(val: number) {
|
||||
}
|
||||
return i18n.global.t('home.runJam');
|
||||
}
|
||||
|
||||
function formatNumber(val: number) {
|
||||
return Number(val.toFixed(2));
|
||||
}
|
||||
|
||||
function changeChartSize() {
|
||||
echarts.getInstanceByDom(document.getElementById('cpu') as HTMLElement)?.resize();
|
||||
echarts.getInstanceByDom(document.getElementById('memory') as HTMLElement)?.resize();
|
||||
echarts.getInstanceByDom(document.getElementById('load') as HTMLElement)?.resize();
|
||||
echarts.getInstanceByDom(document.getElementById('disk') as HTMLElement)?.resize();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('resize', changeChartSize);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('resize', changeChartSize);
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
acceptParams,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.percentage-value {
|
||||
display: block;
|
||||
font-size: 16px;
|
||||
}
|
||||
.percentage-label {
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user