From 896494d8953756890c0b8e5319641bc8c8486223 Mon Sep 17 00:00:00 2001 From: jason5ng32 Date: Sun, 25 Oct 2026 11:19:36 +0800 Subject: [PATCH] Refactor(ip-infos): split IpDetailPanel into advanced and ASN blocks IpDetailPanel had grown to ~750 lines holding three independent regions. It is now the shell (metadata grid, inline Map / Country-traffic panels, dialogs) with unchanged props, emits and multi-root template, rendering IpAdvancedBlock (with ScoreDetailsPanel beside ScenarioFrictionPanel) and IpAsnBlock, which relay view-usage / open-tool through it. The inline /api/asn-history fetch becomes loadAsnHistoryInto in utils/ip/asn-history.js, matching the other ASN loaders, now with tests. Markup, copy, analytics and per-IP reset behaviour are unchanged. Co-Authored-By: Claude Opus 5.5 --- .../components/advanced-tools/AsnProfile.vue | 2 +- frontend/components/ip-infos/ASNHistory.vue | 2 +- .../components/ip-infos/IpAdvancedBlock.vue | 375 ++++++++++++ frontend/components/ip-infos/IpAsnBlock.vue | 156 +++++ .../components/ip-infos/IpDetailPanel.vue | 562 +----------------- .../ip-infos/ScenarioFrictionPanel.vue | 2 +- .../components/ip-infos/ScoreDetailsPanel.vue | 56 ++ frontend/composables/use-asn-info.js | 2 +- frontend/utils/ip/asn-connectivity.js | 2 +- frontend/utils/ip/asn-history.js | 27 + frontend/utils/ip/ip-score-details.js | 2 +- tests/asn-history.test.js | 68 +++ 12 files changed, 707 insertions(+), 549 deletions(-) create mode 100644 frontend/components/ip-infos/IpAdvancedBlock.vue create mode 100644 frontend/components/ip-infos/IpAsnBlock.vue create mode 100644 frontend/components/ip-infos/ScoreDetailsPanel.vue create mode 100644 frontend/utils/ip/asn-history.js create mode 100644 tests/asn-history.test.js diff --git a/frontend/components/advanced-tools/AsnProfile.vue b/frontend/components/advanced-tools/AsnProfile.vue index 3293048c..4290db0f 100644 --- a/frontend/components/advanced-tools/AsnProfile.vue +++ b/frontend/components/advanced-tools/AsnProfile.vue @@ -454,7 +454,7 @@ import { Separator } from '@/components/ui/separator'; import { Spinner } from '@/components/ui/spinner'; import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'; -// Heavy (dagre + SVG) — async, as IpDetailPanel loads it. +// Heavy (dagre + SVG) — async, as IpAsnBlock loads it. const ASNConnectivity = defineAsyncComponent(() => import('@/components/ip-infos/ASNConnectivity.vue')); const { t, locale } = useI18n(); diff --git a/frontend/components/ip-infos/ASNHistory.vue b/frontend/components/ip-infos/ASNHistory.vue index 354d8d59..4017ac8d 100644 --- a/frontend/components/ip-infos/ASNHistory.vue +++ b/frontend/components/ip-infos/ASNHistory.vue @@ -1,5 +1,5 @@