From c44f25ec1f6efece9ede1d63c575913e66dca3d3 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Fri, 8 May 2026 12:56:08 +0200 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20Phase=205c-iv=20(b)=20?= =?UTF-8?q?=E2=80=94=20cpu-history=20/=20xray-logs=20/=20xray-version=20mo?= =?UTF-8?q?dals?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wires up the three remaining dashboard buttons that were stubbed in 5c-iv (a): the CPU history button on StatusCard, the xray-logs button in XrayStatusCard's error popover and ipLimitEnable action, and the "Switch xray" button in XrayStatusCard's action footer. - Sparkline.vue: shared SVG line chart (composition-API port of the inline Vue 2 component). Per-instance gradient id avoids defs collisions between sparklines on the same page. - CpuHistoryModal.vue: bucket dropdown (2m/30m/1h/2h/3h/5h) drives GET /panel/api/server/cpuHistory/{bucket}; renders via Sparkline. - XrayLogModal.vue: rows + filter + direct/blocked/proxy checkboxes; POST /panel/api/server/xraylogs/{rows} returns access-log entries rendered as a colored HTML table; download button serializes to text. - VersionModal.vue: collapse with Xray panel (radio list of versions from getXrayVersion, install via installXray/{version}) and Geofiles panel (per-file reload + Update all). CustomGeo collapse panel is Phase 5c-v. Co-Authored-By: Claude Opus 4.7 --- frontend/src/components/Sparkline.vue | 252 +++++++++++++++++++ frontend/src/pages/index/CpuHistoryModal.vue | 100 ++++++++ frontend/src/pages/index/IndexPage.vue | 17 +- frontend/src/pages/index/VersionModal.vue | 137 ++++++++++ frontend/src/pages/index/XrayLogModal.vue | 174 +++++++++++++ 5 files changed, 675 insertions(+), 5 deletions(-) create mode 100644 frontend/src/components/Sparkline.vue create mode 100644 frontend/src/pages/index/CpuHistoryModal.vue create mode 100644 frontend/src/pages/index/VersionModal.vue create mode 100644 frontend/src/pages/index/XrayLogModal.vue diff --git a/frontend/src/components/Sparkline.vue b/frontend/src/components/Sparkline.vue new file mode 100644 index 00000000..07d84127 --- /dev/null +++ b/frontend/src/components/Sparkline.vue @@ -0,0 +1,252 @@ + + + + + diff --git a/frontend/src/pages/index/CpuHistoryModal.vue b/frontend/src/pages/index/CpuHistoryModal.vue new file mode 100644 index 00000000..bc20a818 --- /dev/null +++ b/frontend/src/pages/index/CpuHistoryModal.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/frontend/src/pages/index/IndexPage.vue b/frontend/src/pages/index/IndexPage.vue index 8eca5521..42805641 100644 --- a/frontend/src/pages/index/IndexPage.vue +++ b/frontend/src/pages/index/IndexPage.vue @@ -13,6 +13,9 @@ import XrayStatusCard from './XrayStatusCard.vue'; import PanelUpdateModal from './PanelUpdateModal.vue'; import LogModal from './LogModal.vue'; import BackupModal from './BackupModal.vue'; +import CpuHistoryModal from './CpuHistoryModal.vue'; +import XrayLogModal from './XrayLogModal.vue'; +import VersionModal from './VersionModal.vue'; // Drive AD-Vue 4's built-in dark algorithm from our reactive theme. const antdThemeConfig = computed(() => ({ @@ -45,6 +48,9 @@ const requestUri = window.location.pathname; const logsOpen = ref(false); const backupOpen = ref(false); const panelUpdateOpen = ref(false); +const cpuHistoryOpen = ref(false); +const xrayLogsOpen = ref(false); +const versionOpen = ref(false); // Page-level loading overlay; modals can request it via @busy. const loading = ref(false); @@ -64,11 +70,9 @@ async function restartXray() { await refresh(); } -// Modal-button stubs that aren't ported yet — keep wired so buttons -// don't appear broken; full implementations come in 5c-iv-b / -v. -function openCpuHistory() { /* CPU history sparkline — 5c-iv-b */ } -function openXrayLogs() { /* xray-logs viewer — 5c-iv-b */ } -function openVersionSwitch() { /* xray version picker — 5c-iv-b */ } +function openCpuHistory() { cpuHistoryOpen.value = true; } +function openXrayLogs() { xrayLogsOpen.value = true; } +function openVersionSwitch() { versionOpen.value = true; } diff --git a/frontend/src/pages/index/VersionModal.vue b/frontend/src/pages/index/VersionModal.vue new file mode 100644 index 00000000..30d044ae --- /dev/null +++ b/frontend/src/pages/index/VersionModal.vue @@ -0,0 +1,137 @@ + + + + + diff --git a/frontend/src/pages/index/XrayLogModal.vue b/frontend/src/pages/index/XrayLogModal.vue new file mode 100644 index 00000000..f03251e4 --- /dev/null +++ b/frontend/src/pages/index/XrayLogModal.vue @@ -0,0 +1,174 @@ + + + + + + +