Skip to content

Commit bc3b86c

Browse files
committed
clean up web a little and upgrade vite
1 parent 832d992 commit bc3b86c

File tree

3 files changed

+12
-29
lines changed

3 files changed

+12
-29
lines changed

internal/web/ui/package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/web/ui/src/components/SideMenu.svelte

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
let componentId = Math.random().toString(36).substr(2, 9);
2020
let isLargeScreen = $state(false);
2121
22-
// Use the dropdown states from the store instead of local state
23-
// let dropdownStates = $state({}); // Remove this line
24-
2522
const checkScreenSize = () => {
2623
isLargeScreen = window.innerWidth >= 768;
2724
};
@@ -58,7 +55,6 @@
5855
if (activeDropdown && !dropdownStates[activeDropdown]) {
5956
dropdownStates[activeDropdown] = true;
6057
}
61-
// Don't close other dropdowns when navigating - only open the relevant one
6258
});
6359
6460
onMount(() => {
@@ -141,7 +137,6 @@
141137
onclick={option.type !== MenuComponent.Dropdown
142138
? (e) => {
143139
push(option?.location);
144-
// Close menu on mobile after navigation
145140
if (!isLargeScreen) {
146141
isMenuOpen.set(false);
147142
}
@@ -155,7 +150,6 @@
155150
? (e) => {
156151
if (e.key === "Enter") {
157152
push(option?.location);
158-
// Close menu on mobile after navigation
159153
if (!isLargeScreen) {
160154
isMenuOpen.set(false);
161155
}
@@ -203,7 +197,6 @@
203197
: ''}"
204198
onclick={() => {
205199
push(item.location);
206-
// Close menu on mobile after navigation
207200
if (!isLargeScreen) {
208201
isMenuOpen.set(false);
209202
}
@@ -213,7 +206,6 @@
213206
onkeydown={(e) => {
214207
if (e.key === "Enter") {
215208
push(item.location);
216-
// Close menu on mobile after navigation
217209
if (!isLargeScreen) {
218210
isMenuOpen.set(false);
219211
}

internal/web/ui/src/scenes/dns/DNSStatistics.svelte

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
let queryByClientCounter = $state([]);
1414
let refreshInterval = null;
1515
16-
const REFRESH_RATE = 30000; // Refresh every 30 seconds
16+
const REFRESH_RATE = 30000;
1717
1818
const metricsService = new PrometheusMetricsService();
1919
@@ -22,10 +22,8 @@
2222
loading = true;
2323
error = null;
2424
25-
// Fetch histogram for DNS request time
2625
dnsRequestTime = await metricsService.getHistogram("dns_req_time");
2726
28-
// Fetch counter vectors
2927
queryCounters = await metricsService.getCounterVec("dns_query_count");
3028
cacheHitCounters = await metricsService.getCounterVec(
3129
"dns_cache_hit_count",
@@ -47,7 +45,6 @@
4745
onMount(() => {
4846
fetchDNSMetrics();
4947
50-
// Set up automatic refresh
5148
refreshInterval = setInterval(fetchDNSMetrics, REFRESH_RATE);
5249
5350
return () => {
@@ -57,15 +54,13 @@
5754
};
5855
});
5956
60-
// Prepare histogram chart data
6157
const histogramChartData = $derived.by(() => {
6258
if (!dnsRequestTime?.buckets) {
6359
return { series: [], categories: [] };
6460
}
6561
6662
const buckets = dnsRequestTime.buckets;
6763
68-
// Calculate incremental counts for each bucket
6964
const incrementalCounts = [];
7065
for (let i = 0; i < buckets.length; i++) {
7166
const current = buckets[i].count;
@@ -84,7 +79,6 @@
8479
};
8580
});
8681
87-
// Aggregate query counters by domain (summing across upstreams and results)
8882
const queryByDomain = $derived.by(() => {
8983
if (!queryCounters || queryCounters.length === 0) return [];
9084
@@ -99,7 +93,7 @@
9993
return Array.from(domainMap.entries())
10094
.map(([domain, count]) => ({ domain, count }))
10195
.sort((a, b) => b.count - a.count)
102-
.slice(0, 10); // Top 10 domains
96+
.slice(0, 10);
10397
});
10498
10599
const countByUpstream = $derived.by(() => {
@@ -128,13 +122,12 @@
128122
count: counter.value,
129123
}))
130124
.sort((a, b) => b.count - a.count)
131-
.slice(0, 10); // Top 10 blocked domains
125+
.slice(0, 10);
132126
});
133127
134128
const clientDomains = $derived.by(() => {
135129
if (!queryByClientCounter || queryByClientCounter.length === 0) return [];
136130
137-
// Group by IP and sum all queries regardless of result
138131
const ipMap = new Map();
139132
140133
for (const counter of queryByClientCounter) {
@@ -148,7 +141,6 @@
148141
.sort((a, b) => b.count - a.count);
149142
});
150143
151-
// Prepare top domains chart
152144
const topDomainsChartData = $derived.by(() => {
153145
if (!queryByDomain || queryByDomain.length === 0) {
154146
return { series: [], categories: [] };
@@ -165,7 +157,6 @@
165157
};
166158
});
167159
168-
// Prepare blocked domains chart
169160
const blockedDomainsChartData = $derived.by(() => {
170161
if (!blockedDomains || blockedDomains.length === 0) {
171162
return { series: [], categories: [] };

0 commit comments

Comments
 (0)