fix: Implement proper scrolling and sorting for Analysis calls list
This commit is contained in:
@@ -153,6 +153,27 @@ func (s *CallFlowStore) GetRecentFlows(n int) []*CallFlow {
|
||||
return flows
|
||||
}
|
||||
|
||||
// GetSortedFlows returns all call flows sorted by StartTime (oldest first)
|
||||
func (s *CallFlowStore) GetSortedFlows() []*CallFlow {
|
||||
flows := s.GetAllFlows()
|
||||
|
||||
// Sort by start time ascending (oldest first), then by CallID for stable order
|
||||
for i := 0; i < len(flows)-1; i++ {
|
||||
for j := i + 1; j < len(flows); j++ {
|
||||
// Compare by StartTime first
|
||||
if flows[i].StartTime.After(flows[j].StartTime) {
|
||||
flows[i], flows[j] = flows[j], flows[i]
|
||||
} else if flows[i].StartTime.Equal(flows[j].StartTime) {
|
||||
// If same time, sort by CallID for stable order
|
||||
if flows[i].CallID > flows[j].CallID {
|
||||
flows[i], flows[j] = flows[j], flows[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return flows
|
||||
}
|
||||
|
||||
// Count returns the number of call flows
|
||||
func (s *CallFlowStore) Count() int {
|
||||
s.mu.RLock()
|
||||
|
||||
Reference in New Issue
Block a user