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

Method toggleAutoRefresh

internal/ui/components/auto_refresh.go:10–33  ·  view source on GitHub ↗

toggleAutoRefresh toggles the auto-refresh functionality on/off.

()

Source from the content-addressed store, hash-verified

8
9// toggleAutoRefresh toggles the auto-refresh functionality on/off.
10func (a *App) toggleAutoRefresh() {
11 uiLogger := models.GetUILogger()
12
13 if a.autoRefreshEnabled {
14 // Disable auto-refresh
15 a.stopAutoRefresh()
16 a.autoRefreshEnabled = false
17 a.footer.UpdateAutoRefreshStatus(false)
18 a.header.ShowSuccess("Auto-refresh disabled")
19 uiLogger.Debug("Auto-refresh disabled by user")
20 } else {
21 // * Check if there are any pending operations before enabling auto-refresh
22 if models.GlobalState.HasPendingOperations() {
23 a.showMessageSafe("Cannot enable auto-refresh while there are pending operations in progress")
24 return
25 }
26 // Enable auto-refresh
27 a.autoRefreshEnabled = true
28 a.startAutoRefresh()
29 a.footer.UpdateAutoRefreshStatus(true)
30 a.header.ShowSuccess("Auto-refresh enabled (10s interval)")
31 uiLogger.Debug("Auto-refresh enabled by user")
32 }
33}
34
35// startAutoRefresh starts the auto-refresh timer.
36func (a *App) startAutoRefresh() {

Callers 2

setupKeyboardHandlersMethod · 0.95
ShowGlobalContextMenuMethod · 0.95

Calls 8

stopAutoRefreshMethod · 0.95
showMessageSafeMethod · 0.95
startAutoRefreshMethod · 0.95
GetUILoggerFunction · 0.92
HasPendingOperationsMethod · 0.80
ShowSuccessMethod · 0.65
DebugMethod · 0.65

Tested by

no test coverage detected