From c4b44e0fd2b277ead07f99d7b04d13f87b6780de Mon Sep 17 00:00:00 2001 From: qinglong Date: Sat, 13 Jun 2026 18:26:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BB=AA=E8=A1=A8=E7=9B=98=E5=8A=A8?= =?UTF-8?q?=E7=94=BB=E6=94=B9=E4=B8=BA=E6=A8=A1=E5=9D=97=E6=96=B9=E6=B3=95?= =?UTF-8?q?=20=5FanimateNumber=20(=E9=81=BF=E5=85=8D=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E4=BD=9C=E7=94=A8=E5=9F=9F=E9=97=AE=E9=A2=98)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/permissions/pending_requests.json | 22 ++++++++++++++ config/plugins/commands.yaml | 2 +- config/services/network_routes.yaml | 2 +- static/web_panel/pages/dashboard.js | 38 ++++++++++++------------ 4 files changed, 43 insertions(+), 21 deletions(-) diff --git a/config/permissions/pending_requests.json b/config/permissions/pending_requests.json index 54c98f8..2a00134 100644 --- a/config/permissions/pending_requests.json +++ b/config/permissions/pending_requests.json @@ -306,5 +306,27 @@ "framework.command.execute" ], "timestamp": 27941.297902882 + }, + "bf0ab570": { + "plugin_name": "example_plugin", + "permissions": [ + "plugin.example.read", + "plugin.example.write", + "plugin.example.execute", + "framework.event.subscribe", + "framework.command.execute" + ], + "timestamp": 28040.658771958 + }, + "2d3bd47f": { + "plugin_name": "sentinel", + "permissions": [ + "plugin.sentinel.read", + "plugin.sentinel.write", + "plugin.network.access", + "framework.event.subscribe", + "framework.command.execute" + ], + "timestamp": 28040.668302635 } } \ No newline at end of file diff --git a/config/plugins/commands.yaml b/config/plugins/commands.yaml index 0d4a60b..d389cb8 100644 --- a/config/plugins/commands.yaml +++ b/config/plugins/commands.yaml @@ -101,7 +101,7 @@ commands: permissions: - framework.command.test source: internal -last_updated: 27941.282839757 +last_updated: 28040.621524771 plugin_commands: example_plugin: echo: *id001 diff --git a/config/services/network_routes.yaml b/config/services/network_routes.yaml index c81ec75..8f72d2e 100644 --- a/config/services/network_routes.yaml +++ b/config/services/network_routes.yaml @@ -1,5 +1,5 @@ http_port: 4200 -last_updated: 27941.295580277 +last_updated: 28040.661568417 plugin_routes: example_plugin: - methods: diff --git a/static/web_panel/pages/dashboard.js b/static/web_panel/pages/dashboard.js index 39e6b75..d53b452 100644 --- a/static/web_panel/pages/dashboard.js +++ b/static/web_panel/pages/dashboard.js @@ -1,25 +1,25 @@ -/* ── 数字跳动动画 ── */ -function animateNumber(el, newVal, decimals, suffix) { - var oldVal = parseFloat(el.getAttribute('data-val') || newVal); - if (oldVal === newVal) { el.textContent = newVal.toFixed(decimals) + suffix; return; } - el.setAttribute('data-val', newVal); - var start = performance.now(); - var duration = 900; - function step(ts) { - var p = Math.min((ts - start) / duration, 1); - var eased = 1 - Math.pow(1 - p, 3); // ease-out - el.textContent = (oldVal + (newVal - oldVal) * eased).toFixed(decimals) + suffix; - if (p < 1) requestAnimationFrame(step); - } - requestAnimationFrame(step); -} - window.DashboardModule = { ws: null, reconnectTimer: null, reconnectDelay: 1000, charts: {}, + _animateNumber: function(el, newVal, decimals, suffix) { + var self = this; + var oldVal = parseFloat(el.getAttribute('data-val') || newVal); + if (Math.abs(oldVal - newVal) < 0.05) { el.textContent = newVal.toFixed(decimals) + suffix; return; } + el.setAttribute('data-val', newVal); + var start = performance.now(); + var duration = 900; + function step(ts) { + var p = Math.min((ts - start) / duration, 1); + var eased = 1 - Math.pow(1 - p, 3); + el.textContent = (oldVal + (newVal - oldVal) * eased).toFixed(decimals) + suffix; + if (p < 1) requestAnimationFrame(step); + } + requestAnimationFrame(step); + }, + init: function() { var self = this; @@ -89,7 +89,7 @@ window.DashboardModule = { // ── 内存 ── if (sys.memory) { var m = sys.memory.percent || 0; - var el = document.getElementById('d-mem'); if (el) animateNumber(el, m, 1, '%'); + var el = document.getElementById('d-mem'); if (el) self._animateNumber(el, m, 1, '%'); el = document.getElementById('d-mem-detail'); if (el) el.textContent = (sys.memory.used_gb || 0).toFixed(1) + ' / ' + (sys.memory.total_gb || 0).toFixed(1) + ' GB'; self.charts.mem.update(m); @@ -102,7 +102,7 @@ window.DashboardModule = { var load = (sys.cpu.load_avg && sys.cpu.load_avg[0]) ? sys.cpu.load_avg[0] : 0; cpuVal = Math.min(100, (load / (sys.cpu.cores || 1)) * 100); } - var el = document.getElementById('d-cpu'); if (el) animateNumber(el, cpuVal, 0, '%'); + var el = document.getElementById('d-cpu'); if (el) self._animateNumber(el, cpuVal, 0, '%'); self.charts.cpu.update(cpuVal); if (sys.cpu.load_avg) { @@ -133,7 +133,7 @@ window.DashboardModule = { // ── 进程内存 ── if (sys.process && sys.process.memory_mb !== undefined) { var pm = sys.process.memory_mb || 0; - var el = document.getElementById('d-proc-mem'); if (el) animateNumber(el, pm, 1, ' MB'); + var el = document.getElementById('d-proc-mem'); if (el) self._animateNumber(el, pm, 1, ' MB'); self.charts.proc_mem.update(pm); } if (sys.process && sys.process.pid !== undefined) {