diff --git a/packages/frontend/src/filters/bytes-net-sizes.ts b/packages/frontend/src/filters/bytes-net-sizes.ts
new file mode 100644
index 0000000000..61f54eabac
--- /dev/null
+++ b/packages/frontend/src/filters/bytes-net-sizes.ts
@@ -0,0 +1,7 @@
+export default (v) => {
+ if (v == null) return '?';
+ const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
+ if (v === 0) return sizes[0];
+ const i = Math.floor(Math.log(v) / Math.log(1024));
+ return sizes[i];
+};
diff --git a/packages/frontend/src/filters/bytes-net-v.ts b/packages/frontend/src/filters/bytes-net-v.ts
new file mode 100644
index 0000000000..f3a64ce705
--- /dev/null
+++ b/packages/frontend/src/filters/bytes-net-v.ts
@@ -0,0 +1,8 @@
+export default (v, digits = 0) => {
+ if (v == null) return '?';
+ if (v === 0) return '0';
+ const isMinus = v < 0;
+ if (isMinus) v = -v;
+ const i = Math.floor(Math.log(v) / Math.log(1024));
+ return (isMinus ? '-' : '') + (v / Math.pow(1024, i)).toFixed(digits).replace(/\.0+$/, '');
+};
diff --git a/packages/frontend/src/widgets/server-metric/cpu-mem-net-pie.vue b/packages/frontend/src/widgets/server-metric/cpu-mem-net-pie.vue
new file mode 100644
index 0000000000..dc86676f9d
--- /dev/null
+++ b/packages/frontend/src/widgets/server-metric/cpu-mem-net-pie.vue
@@ -0,0 +1,105 @@
+
+
+
+
+
+
CPU
+
{{ (cpuUsage * 100).toFixed(1) }}%
+
+
+
+
RAM
+
{{ (memUsage * 100).toFixed(1) }}%
+
+
+
+
+
+
+
+
NET rx
+
{{ bytes(inRecent, 1) }}{{ bytesSizes(inRecent) }}
+
+
+
+
+
NET tx
+
{{ bytes(outRecent, 1) }}{{ bytesSizes(outRecent) }}
+
+
+
+
+
+
+
+
diff --git a/packages/frontend/src/widgets/server-metric/index.vue b/packages/frontend/src/widgets/server-metric/index.vue
index 5eee3e8a66..75f6b7cab4 100644
--- a/packages/frontend/src/widgets/server-metric/index.vue
+++ b/packages/frontend/src/widgets/server-metric/index.vue
@@ -7,10 +7,12 @@
-
-
-
-
+
+
+
+
+
+
@@ -21,6 +23,8 @@ import { useWidgetPropsManager, Widget, WidgetComponentExpose } from '../widget'
import XCpuMemory from './cpu-mem.vue';
import XCpuMemoryCompact from './cpu-mem-pie.vue';
import XNet from './net.vue';
+import XNetCompact from './net-pie.vue';
+import XCpuMemoryNetCompact from './cpu-mem-net-pie.vue';
import XCpu from './cpu.vue';
import XMemory from './mem.vue';
import XDisk from './disk.vue';
@@ -69,7 +73,7 @@ os.api('server-info', {}).then(res => {
});
const toggleView = () => {
- if (widgetProps.view === 5) {
+ if (widgetProps.view === 7) {
widgetProps.view = 0;
} else {
widgetProps.view++;
diff --git a/packages/frontend/src/widgets/server-metric/net-pie.vue b/packages/frontend/src/widgets/server-metric/net-pie.vue
new file mode 100644
index 0000000000..b89bd9270b
--- /dev/null
+++ b/packages/frontend/src/widgets/server-metric/net-pie.vue
@@ -0,0 +1,73 @@
+
+
+
+
+
+
NET rx
+
{{ bytes(inRecent, 1) }}{{ bytesSizes(inRecent) }}
+
+
+
+
+
NET tx
+
{{ bytes(outRecent, 1) }}{{ bytesSizes(outRecent) }}
+
+
+
+
+
+
+