MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / loadTasksData

Method loadTasksData

internal/ui/components/refresh.go:673–711  ·  view source on GitHub ↗

loadTasksData loads and updates task data with proper filtering.

()

Source from the content-addressed store, hash-verified

671
672// loadTasksData loads and updates task data with proper filtering.
673func (a *App) loadTasksData() {
674 go func() {
675 // Snapshot connection state under lock so reads are race-free.
676 conn := a.snapConn()
677
678 var tasks []*api.ClusterTask
679 var err error
680
681 if conn.isGroupMode {
682 // Create context with timeout for group operations
683 ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
684 defer cancel()
685 tasks, err = conn.groupManager.GetGroupTasks(ctx)
686 } else {
687 tasks, err = conn.client.GetClusterTasks()
688 }
689
690 if err == nil {
691 a.QueueUpdateDraw(func() {
692 // Update global state with tasks
693 models.GlobalState.OriginalTasks = make([]*api.ClusterTask, len(tasks))
694 models.GlobalState.FilteredTasks = make([]*api.ClusterTask, len(tasks))
695 copy(models.GlobalState.OriginalTasks, tasks)
696 copy(models.GlobalState.FilteredTasks, tasks)
697
698 // Check for existing search filters
699 taskSearchState := models.GlobalState.GetSearchState(api.PageTasks)
700 if taskSearchState != nil && taskSearchState.Filter != "" {
701 // Apply existing filter
702 models.FilterTasks(taskSearchState.Filter)
703 a.tasksList.SetFilteredTasks(models.GlobalState.FilteredTasks)
704 } else {
705 // No filter, use original data
706 a.tasksList.SetTasks(tasks)
707 }
708 })
709 }
710 }()
711}

Callers 6

doEnrichNodesMethod · 0.95
doRefreshVMDataMethod · 0.95
switchToGroupMethod · 0.95
enqueueVMOperationMethod · 0.95

Calls 8

snapConnMethod · 0.95
FilterTasksFunction · 0.92
GetGroupTasksMethod · 0.80
GetClusterTasksMethod · 0.80
QueueUpdateDrawMethod · 0.80
GetSearchStateMethod · 0.80
SetFilteredTasksMethod · 0.65
SetTasksMethod · 0.65

Tested by

no test coverage detected