-
+
+
{{ props.mountpoint }}
@@ -24,59 +24,67 @@ const colorBlank = getBlankColor(props.used / props.total * 100);
{{ format2Size(props.used, props.total) }} [{{ props.fstype }}]
+
+
+
+
{{ (props.used / props.total * 100).toFixed(1) }}%
+
+
\ No newline at end of file
diff --git a/src/components/Host.vue b/src/components/Host.vue
index 5f0ce4f..7d031ef 100644
--- a/src/components/Host.vue
+++ b/src/components/Host.vue
@@ -4,7 +4,7 @@ import {computed, onMounted, ref, watch} from "vue";
import * as echarts from "echarts";
import {
format2Size,
- formatDate,
+ formatDate, formatDuration,
formatSizeByUnit,
formatUptime,
getBaseColor,
@@ -63,6 +63,7 @@ const hoverBorderColor = computed(() => {
return statusColor.value
})
+const fontFam = 'Josefin Sans'
function onMountedFunc() {
const cpuChart = echarts.init(cpuChartRef.value);
@@ -73,15 +74,16 @@ function onMountedFunc() {
// style
const titleStyle = {
color: 'rgba(0, 0, 0, 0.8)',
- fontSize: 15,
+ fontSize: 18,
}
- const radius = ['65%', '90%']
+ const radius = ['65%', '80%']
const netColor = ['#a2d8f4', '#0194e3'] // Tx Rx
const pieLabelPosition = 'center'
const emphasis = {
label: {
show: true,
fontSize: 15,
+ fontFamily: fontFam,
position: ['50%', '20%'] // 设置标签位置为圆环外部
},
}
@@ -96,7 +98,7 @@ function onMountedFunc() {
function update() {
const timeDiff = (Date.now()) / 1000 - status.value.meta.observed_at
- deltaTime.value = timeDiff.toFixed(1)
+ deltaTime.value = formatDuration(timeDiff)
// 判断该时间与上一个时间不同才push
if (netStats.length === 0 || netStats[netStats.length - 1][0] !== status.value.meta.observed_at) {
netStats.push([status.value.meta.observed_at, status.value.hardware.net.up, status.value.hardware.net.down]) // 时间 上行 下行
@@ -119,6 +121,9 @@ function onMountedFunc() {
top: 'center',
textStyle: titleStyle,
},
+ textStyle: {
+ fontFamily: fontFam
+ },
series: [
{
type: 'pie',
@@ -154,6 +159,9 @@ function onMountedFunc() {
top: 'center',
textStyle: titleStyle
},
+ textStyle: {
+ fontFamily: fontFam
+ },
series: [
{
type: 'pie',
@@ -187,6 +195,9 @@ function onMountedFunc() {
top: 'center',
textStyle: titleStyle,
},
+ textStyle: {
+ fontFamily: fontFam
+ },
series: [
{
type: 'pie',
@@ -215,6 +226,12 @@ function onMountedFunc() {
netChart.setOption(
{
color: netColor,
+ title: {
+ textStyle: titleStyle
+ },
+ textStyle: {
+ fontFamily: fontFam
+ },
tooltip: {
trigger: 'axis',
axisPointer: {
@@ -228,7 +245,7 @@ function onMountedFunc() {
} else {
return formatDate(params.value, true);
}
- }
+ },
}
},
formatter: function (params: any) {
@@ -237,12 +254,10 @@ function onMountedFunc() {
result += item.marker + (item.seriesName == 'Tx' ? '↑' : '↓') + ': ' + formatSizeByUnit(item.value * 8, null, 'bps') + '
';
});
return result;
- }
+ },
},
toolbox: {
- feature: {
- saveAsImage: {}
- }
+ feature: {}
},
grid: {
top: '25%',
@@ -259,7 +274,7 @@ function onMountedFunc() {
axisLabel: {
formatter: function (value: number) {
return formatDate(value, true)
- }
+ },
}
}
],
@@ -269,7 +284,7 @@ function onMountedFunc() {
axisLabel: {
formatter: function (value: number) {
return formatSizeByUnit(value * 8, null, 'b')
- }
+ },
}
}
],
@@ -280,7 +295,7 @@ function onMountedFunc() {
stack: 'Total',
areaStyle: {},
emphasis: {
- focus: 'series'
+ focus: 'series',
},
data: netStats.map(item => item[1]),
showSymbol: false,
@@ -318,9 +333,9 @@ function onMountedFunc() {
// link.download = `screenshot-${status.value.meta.id}-${formatDate(Date.now(), false)}.svg`;
function downloadScreenshot() {
- const hostElement = document.querySelector(".host#"+status.value.meta.id);
+ const hostElement = document.querySelector(".host#" + status.value.meta.id);
if (hostElement) {
- html2canvas(
hostElement, { scale: 2 }).then((canvas) => {
+ html2canvas(hostElement, {scale: 2}).then((canvas) => {
const dataURL = canvas.toDataURL("image/png");
const link = document.createElement("a");
link.href = dataURL;
@@ -335,19 +350,21 @@ onMounted(
onMountedFunc()
}
)
-
-
+
{{ status.meta.name }}
-
+
Network
@@ -398,7 +415,7 @@ onMounted(
-
+
Storage
@@ -484,7 +501,7 @@ onMounted(
align-items: center;
}
-.uptime {
+.time-tag {
padding: 0 0.5rem;
font-size: 0.8rem;
border-radius: 50px;
diff --git a/src/style.css b/src/style.css
index 10e9434..97ab8fd 100644
--- a/src/style.css
+++ b/src/style.css
@@ -12,7 +12,7 @@
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
--text-color-1: #000;
- --text-color-2: #383838;
+ --text-color-2: #5f5f5f;
}
diff --git a/src/views/Home.vue b/src/views/Home.vue
index b2aa849..71ebe2b 100644
--- a/src/views/Home.vue
+++ b/src/views/Home.vue
@@ -49,7 +49,7 @@ onUnmounted(() => {