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:
@@ -1,6 +1,7 @@
|
||||
package pipeline
|
||||
|
||||
import (
|
||||
"hash/fnv"
|
||||
"time"
|
||||
|
||||
"evobgp/internal/store"
|
||||
@@ -10,6 +11,8 @@ import (
|
||||
const SchedulerTickSec = 30
|
||||
|
||||
// ModuleDueForScheduler reports whether a module's refresh interval bucket rolled since the last scheduler tick.
|
||||
// A stable per-module offset (fnv32 of ID) spreads bucket boundaries so modules with the same interval
|
||||
// do not all become due on the same tick (thundering herd).
|
||||
func ModuleDueForScheduler(mod *store.Module, now time.Time) bool {
|
||||
if mod == nil || !mod.Enabled || mod.Type == "IP_RANGES" || mod.RefreshIntervalSec <= 0 {
|
||||
return false
|
||||
@@ -18,7 +21,21 @@ func ModuleDueForScheduler(mod *store.Module, now time.Time) bool {
|
||||
if win < 60 {
|
||||
win = 60
|
||||
}
|
||||
cur := now.Unix() / win
|
||||
prev := (now.Unix() - SchedulerTickSec) / win
|
||||
offset := moduleSchedulerOffset(mod.ID, win)
|
||||
cur := (now.Unix() - offset) / win
|
||||
prev := (now.Unix() - offset - SchedulerTickSec) / win
|
||||
return cur != prev
|
||||
}
|
||||
|
||||
func moduleSchedulerOffset(moduleID string, win int64) int64 {
|
||||
if win <= 0 {
|
||||
return 0
|
||||
}
|
||||
return int64(fnv32a(moduleID) % uint32(win))
|
||||
}
|
||||
|
||||
func fnv32a(s string) uint32 {
|
||||
h := fnv.New32a()
|
||||
_, _ = h.Write([]byte(s))
|
||||
return h.Sum32()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user