()
| 309 | } |
| 310 | |
| 311 | func (m statusModel) View() string { |
| 312 | if m.err != nil { |
| 313 | return errorStyleTUI.Render(fmt.Sprintf("✗ Error: %v\n", m.err)) |
| 314 | } |
| 315 | |
| 316 | var b strings.Builder |
| 317 | |
| 318 | b.WriteString(m.renderTable()) |
| 319 | b.WriteString("\n") |
| 320 | |
| 321 | // Render provisioning progress section |
| 322 | provisioningSection := m.renderProvisioningSection() |
| 323 | if provisioningSection != "" { |
| 324 | b.WriteString(provisioningSection) |
| 325 | } |
| 326 | |
| 327 | // Render restoring progress section |
| 328 | restoringSection := m.renderRestoringSection() |
| 329 | if restoringSection != "" { |
| 330 | b.WriteString(restoringSection) |
| 331 | } |
| 332 | |
| 333 | // Render migrating progress section |
| 334 | migratingSection := m.renderMigratingSection() |
| 335 | if migratingSection != "" { |
| 336 | b.WriteString(migratingSection) |
| 337 | } |
| 338 | |
| 339 | // Render recent events section |
| 340 | eventsSection := m.renderEventsSection() |
| 341 | if eventsSection != "" { |
| 342 | b.WriteString(eventsSection) |
| 343 | } |
| 344 | |
| 345 | if m.quitting { |
| 346 | timestamp := m.lastUpdate.Format("15:04:05") |
| 347 | b.WriteString(m.styles.timestamp.Render(fmt.Sprintf("Last updated: %s", timestamp))) |
| 348 | b.WriteString("\n") |
| 349 | return b.String() |
| 350 | } |
| 351 | |
| 352 | if m.refreshErr != nil && !m.nextRetryAt.IsZero() { |
| 353 | b.WriteString(warningStyleTUI.Render(statusRefreshErrorMessage(m.refreshErr, m.nextRetryAt))) |
| 354 | b.WriteString("\n") |
| 355 | } |
| 356 | |
| 357 | if m.monitoring { |
| 358 | ts := m.lastUpdate.Format("15:04:05") |
| 359 | statusText := fmt.Sprintf("Last updated: %s", ts) |
| 360 | if len(m.instances) == 0 { |
| 361 | statusText = fmt.Sprintf("Last updated: %s; checking every %s", ts, formatRetryDelay(nextEmptyPollDelay(m.emptyStartedAt))) |
| 362 | } |
| 363 | b.WriteString(m.styles.timestamp.Render(statusText)) |
| 364 | b.WriteString(" ") |
| 365 | b.WriteString(m.spinner.View()) |
| 366 | b.WriteString("\n") |
| 367 | } |
| 368 |
nothing calls this directly
no test coverage detected