(agent codersdk.WorkspaceAgent)
| 299 | } |
| 300 | |
| 301 | func renderAgentStatus(agent codersdk.WorkspaceAgent) string { |
| 302 | switch agent.Status { |
| 303 | case codersdk.WorkspaceAgentConnecting: |
| 304 | since := dbtime.Now().Sub(agent.CreatedAt) |
| 305 | return pretty.Sprint(DefaultStyles.Warn, "⦾ connecting") + " " + |
| 306 | pretty.Sprint(DefaultStyles.Placeholder, "["+strconv.Itoa(int(since.Seconds()))+"s]") |
| 307 | case codersdk.WorkspaceAgentDisconnected: |
| 308 | since := dbtime.Now().Sub(*agent.DisconnectedAt) |
| 309 | return pretty.Sprint(DefaultStyles.Error, "⦾ disconnected") + " " + |
| 310 | pretty.Sprint(DefaultStyles.Placeholder, "["+strconv.Itoa(int(since.Seconds()))+"s]") |
| 311 | case codersdk.WorkspaceAgentTimeout: |
| 312 | since := dbtime.Now().Sub(agent.CreatedAt) |
| 313 | return fmt.Sprintf( |
| 314 | "%s %s", |
| 315 | pretty.Sprint(DefaultStyles.Warn, "⦾ timeout"), |
| 316 | pretty.Sprint(DefaultStyles.Placeholder, "["+strconv.Itoa(int(since.Seconds()))+"s]"), |
| 317 | ) |
| 318 | case codersdk.WorkspaceAgentConnected: |
| 319 | return pretty.Sprint(DefaultStyles.Keyword, "⦿ connected") |
| 320 | default: |
| 321 | return pretty.Sprint(DefaultStyles.Warn, "○ unknown") |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | func renderAgentHealth(agent codersdk.WorkspaceAgent) string { |
| 326 | if agent.Health.Healthy { |
no test coverage detected