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

Method displayBackups

internal/ui/components/vm_backups.go:196–222  ·  view source on GitHub ↗
(backups []api.Backup)

Source from the content-addressed store, hash-verified

194}
195
196func (bm *BackupManager) displayBackups(backups []api.Backup) {
197 // Prepend active tasks from the App's global state
198 activeTasks := bm.app.GetActiveBackupsForVM(bm.vm.ID)
199 for _, task := range activeTasks {
200 // Create a fake backup entry for the running task
201 runningBackup := api.Backup{
202 VolID: "TASK: " + task.UPID,
203 Name: utils.GetIconLabel("Backup in Progress...", "⚠️", bm.app.config.ShowIcons),
204 Date: task.StartTime,
205 Notes: fmt.Sprintf("Status: %s", task.Status),
206 Size: 0,
207 Format: "task",
208 Storage: "Unknown",
209 }
210 // Prepend
211 backups = append([]api.Backup{runningBackup}, backups...)
212 }
213
214 bm.backupTable.DisplayBackups(backups)
215
216 if len(backups) == 0 {
217 bm.updateInfoText("No backups found for this VM.")
218 return
219 }
220
221 bm.updateInfoText(utils.GetIconLabel(fmt.Sprintf("Loaded %d backups (Ctrl+R to refresh)", len(backups)), "✅", bm.app.config.ShowIcons))
222}
223
224func (bm *BackupManager) updateInfoText(text string) {
225 bm.infoText.SetText(text)

Callers 1

loadBackupsMethod · 0.95

Calls 4

updateInfoTextMethod · 0.95
GetIconLabelFunction · 0.92
GetActiveBackupsForVMMethod · 0.80
DisplayBackupsMethod · 0.80

Tested by

no test coverage detected