From 286f13e06786302c22c0748210fb2edd431a2c73 Mon Sep 17 00:00:00 2001 From: Zhaoxuan Chen Date: Tue, 2 Sep 2025 16:12:49 +0800 Subject: [PATCH] connect the real api --- src/components/Widgets/CompactGlance.vue | 363 +++++++++++++++-------- src/components/Widgets/CustomList.vue | 10 +- user-data/conf.yml | 63 +--- 3 files changed, 256 insertions(+), 180 deletions(-) diff --git a/src/components/Widgets/CompactGlance.vue b/src/components/Widgets/CompactGlance.vue index 47270dfd..1af34308 100644 --- a/src/components/Widgets/CompactGlance.vue +++ b/src/components/Widgets/CompactGlance.vue @@ -1,155 +1,278 @@ - diff --git a/src/components/Widgets/CustomList.vue b/src/components/Widgets/CustomList.vue index 50a1f81e..086af05a 100644 --- a/src/components/Widgets/CustomList.vue +++ b/src/components/Widgets/CustomList.vue @@ -36,7 +36,7 @@ export default { return this.options.title || ''; }, daysForNew() { - return parseInt(Number(this.options.daysForNew)) || false; + return parseInt(Number(this.options.daysForNew), 10) || false; }, }, methods: { @@ -51,10 +51,10 @@ export default { this.data = data.sort((a, b) => new Date(a.date) < new Date(b.date)); if (this.daysForNew) { const threshold = this.daysForNew * 1000 * 60 * 60 * 24; - this.data = this.data.map((item) => { - item.isNew = (today - new Date(item.date) < threshold); - return item; - }); + this.data = this.data.map((item) => ({ + ...item, + isNew: (today - new Date(item.date) < threshold), + })); } this.finishLoading(); }, diff --git a/user-data/conf.yml b/user-data/conf.yml index 6e5cc64a..c4806505 100644 --- a/user-data/conf.yml +++ b/user-data/conf.yml @@ -46,64 +46,17 @@ sections: url: https://github.com/Lissy93/dashy/blob/master/.github/SUPPORT.md icon: far fa-hands-helping -- name: Service Status Monitoring +- name: System Overview icon: fas fa-server widgets: - type: compact-glance options: - title: "Web Server" - icon: "fas fa-globe" - status: "up" - link: "https://github.com/Lissy93/dashy" - metrics: - - label: "Latency" - value: "23ms" - - - type: compact-glance - options: - title: "Database" - icon: "fas fa-database" - status: "up" - link: "https://www.baidu.com" - metrics: - - label: "Connections" - value: "45" - - - type: compact-glance - options: - title: "Backup Service" - icon: "fas fa-cloud" - status: "warn" - link: "https://www.google.com" - metrics: - - label: "Last Backup" - value: "2h ago" - - - type: compact-glance - options: - title: "Monitoring" - icon: "fas fa-chart-line" - status: "up" - link: "https://github.com" - metrics: - - label: "Alerts" - value: "0" - - - type: compact-glance - options: - title: "File Server" - icon: "fas fa-folder" - status: "down" - link: "https://stackoverflow.com" - metrics: - - label: "Status" - value: "Offline" - - - type: compact-glance - options: - title: "Mail Server" - icon: "fas fa-envelope" - status: "up" - link: "https://www.bilibili.com" + endpoint: http://127.0.0.1:61208/api/4/all + useProxy: false + poll: 5 + map: + cpu: $.cpu.total + mem: $.mem.percent + load: $.load.min1