refactor(web): remove deprecated dashboard components and enhance KPI grid
quality / commitlint (push) Skipped
quality / changes (push) Successful in 9s
quality / docker-check (push) Skipped
quality / openapi (push) Successful in 46s
quality / web (push) Successful in 1m16s
quality / go (push) Successful in 2m42s
quality / bird2 (push) Successful in 16s
CD / quality (push) Successful in 5m19s
CD / publish (push) Successful in 7m19s
quality / commitlint (push) Skipped
quality / changes (push) Successful in 9s
quality / docker-check (push) Skipped
quality / openapi (push) Successful in 46s
quality / web (push) Successful in 1m16s
quality / go (push) Successful in 2m42s
quality / bird2 (push) Successful in 16s
CD / quality (push) Successful in 5m19s
CD / publish (push) Successful in 7m19s
- Deleted unused components: `DashboardActivityTimeline`, `DashboardFramePanel`, `DashboardModulesGrid`, `DashboardRecentJobsGrid`, and `DashboardRecentRevisionsGrid` to streamline the dashboard. - Updated `DashboardKpiGrid` to improve KPI display logic, including progress indicators and enhanced badge functionality. - Refactored `DashboardNetworkHealth` to provide better status representation based on loading states and network conditions. - Introduced new properties for KPI cards to support progress tracking and improved visual feedback. This cleanup aims to enhance performance and maintainability of the dashboard while providing a better user experience.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
package pipeline
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net/netip"
|
||||
"testing"
|
||||
|
||||
"evobgp/internal/store"
|
||||
)
|
||||
|
||||
// benchPrefixRows generates seed-stable pseudo-random prefixes for aggregation benchmarks.
|
||||
// v4 blocks are carved from TEST-NET-style ranges; v6 from 2001:db8::/32.
|
||||
func benchPrefixRows(n int, v6Share float64) []store.PrefixRow {
|
||||
r := rand.New(rand.NewSource(42))
|
||||
rows := make([]store.PrefixRow, 0, n)
|
||||
seen := make(map[string]struct{}, n)
|
||||
for len(rows) < n {
|
||||
var pfx netip.Prefix
|
||||
if r.Float64() < v6Share {
|
||||
var a [16]byte
|
||||
a[0], a[1] = 0x20, 0x01
|
||||
a[2], a[3] = 0x0d, 0xb8
|
||||
for i := 4; i < 10; i++ {
|
||||
a[i] = byte(r.Intn(256))
|
||||
}
|
||||
addr := netip.AddrFrom16(a)
|
||||
pfx = netip.PrefixFrom(addr, 48+r.Intn(17))
|
||||
} else {
|
||||
b := []byte{203, 0, 113, 0}
|
||||
b[1] = byte(r.Intn(256))
|
||||
b[2] = byte(r.Intn(256))
|
||||
b[3] = byte(r.Intn(256))
|
||||
addr := netip.AddrFrom4([4]byte{b[0], b[1], b[2], b[3]})
|
||||
pfx = netip.PrefixFrom(addr, 16+r.Intn(9))
|
||||
}
|
||||
s := pfx.Masked().String()
|
||||
if _, ok := seen[s]; ok {
|
||||
continue
|
||||
}
|
||||
seen[s] = struct{}{}
|
||||
rows = append(rows, store.PrefixRow{Prefix: s, Source: "ip_range"})
|
||||
}
|
||||
return rows
|
||||
}
|
||||
|
||||
func BenchmarkSmartAggregatePrefixRows(b *testing.B) {
|
||||
for _, n := range []int{1_000, 10_000, 50_000} {
|
||||
rows := benchPrefixRows(n, 0.3)
|
||||
b.Run(fmt.Sprintf("n=%d", n), func(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = smartAggregatePrefixRows(rows)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user