feat(kubernetes): Add sorting and namespace filter to K8s UI

- Add sortable table headers for Pod and Deployment views
- Click column headers to toggle sort direction
- Sort state persists across sessions
- Add namespace dropdown filter for Pods/Deployments views
- Auto-populates from available namespaces
- Include namespace filter in reset and active filters check
This commit is contained in:
rcourtman 2025-12-12 23:24:04 +00:00
parent 655c9f81c3
commit eee11d0c66
5 changed files with 658 additions and 30 deletions

View file

@ -655,6 +655,8 @@ type Monitor struct {
dlqInsightMap map[string]*dlqInsight
nodeLastOnline map[string]time.Time // Track last time each node was seen online (for grace period)
resourceStore ResourceStoreInterface // Optional unified resource store for polling optimization
mockMetricsCancel context.CancelFunc
mockMetricsWg sync.WaitGroup
}
type rrdMemCacheEntry struct {
@ -3403,6 +3405,11 @@ func (m *Monitor) Start(ctx context.Context, wsHub *websocket.Hub) {
m.runtimeCtx = ctx
m.wsHub = wsHub
m.mu.Unlock()
defer m.stopMockMetricsSampler()
if mock.IsMockEnabled() {
m.startMockMetricsSampler(ctx)
}
// Initialize and start discovery service if enabled
if mock.IsMockEnabled() {
@ -7259,18 +7266,28 @@ func (m *Monitor) SetMockMode(enable bool) {
}
if enable {
m.stopMockMetricsSampler()
mock.SetEnabled(true)
m.alertManager.ClearActiveAlerts()
m.mu.Lock()
m.resetStateLocked()
m.metricsHistory.Reset()
m.mu.Unlock()
m.StopDiscoveryService()
m.mu.RLock()
ctx := m.runtimeCtx
m.mu.RUnlock()
if ctx != nil {
m.startMockMetricsSampler(ctx)
}
log.Info().Msg("Switched monitor to mock mode")
} else {
m.stopMockMetricsSampler()
mock.SetEnabled(false)
m.alertManager.ClearActiveAlerts()
m.mu.Lock()
m.resetStateLocked()
m.metricsHistory.Reset()
m.mu.Unlock()
log.Info().Msg("Switched monitor to real data mode")
}