Skip to content

refactor(frontend): share web-logs filters and network port helpers - #431

Open
Rem7474 wants to merge 1 commit into
fix/notification-permission-and-small-uxfrom
refactor/share-network-port-helpers
Open

Rem7474 wants to merge 1 commit into
fix/notification-permission-and-small-uxfrom
refactor/share-network-port-helpers

Conversation

@Rem7474

@Rem7474 Rem7474 commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • useWebLogsFilters (new): the URL-synced filter state (period, source, host, custom from/to, timeRange), period presets, applyTimeRange() and detailFilters() that useBot (Threats) and useTraffic (Traffic) each implemented. Fixes the hardcoded French 7j/30j preset labels (security.period7dLabel / period30dLabel).
  • utils/networkPorts.ts (new): buildDiscoveredPortsByHost, ensureHostPortConfig, getHostPortEntry, createDefaultPortSetting and their types — previously duplicated in useNetwork.ts (untyped) and NetworkTopologyConfig.vue, both mutating the same v-model'd hostPortConfig.
  • The domain/IP-specific search routing (handleSearch) stays per page: Threats opens the ban-capable timeline, Traffic the read-only one.

Stacked on #430.

Test plan

  • New specs: useWebLogsFilters (URL init, custom/preset ranges, URL mirroring, translated presets) and networkPorts (dedup by port+protocol, container-only ports, config bootstrap without overwriting user settings)
  • npm run test, typecheck, lint, lint:i18n
  • Manual: Traffic/Threats — change period, host, custom range, reload the page; Network → Configuration tab ports list

🤖 Generated with Claude Code

Two duplications between code that works on the same data:

- useBot (Threats) and useTraffic (Traffic) each built the same
  URL-synced filter state (period, source, host, custom from/to, time
  range), the same period presets and the same range/domain-filter logic.
  useWebLogsFilters holds it once. The 7-day / 30-day preset labels were
  hardcoded French ("7j", "30j") and are now translated.
- useNetwork and NetworkTopologyConfig each implemented port discovery
  from container mappings and the per-host port config bootstrap, both
  mutating the same v-model'd hostPortConfig array. The logic moves to
  utils/networkPorts.ts (typed; useNetwork's copy used `any`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rem7474
Rem7474 force-pushed the refactor/share-network-port-helpers branch from 26988d8 to 7697a99 Compare September 30, 2026 19:31
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant