fix: display offline workspaces#39
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
f5fdeeb to
c1bc5ad
Compare
d434e77 to
024d7e3
Compare
a9e3504 to
caf84f1
Compare
caf84f1 to
ce1883e
Compare
| // `.alert` from SwiftUI doesn't play nice when the calling view is in the | ||
| // menu bar. | ||
| private func showAlert() { |
There was a problem hiding this comment.
If you use .alert, the menu bar window dismisses itself, and takes the alert with it - it basically doesn't work at all.
This older NSAlert API creates a temporary, managed, window instead.
If we need to create popup alerts for something that's part of the normal user flow later, we'll need to find a better way.
| @Environment(\.dismiss) var dismiss | ||
| @EnvironmentObject var vpn: VPN | ||
| var msg: String { | ||
| "\(vpn.menuState.invalidAgents.count) invalid \(vpn.menuState.invalidAgents.count > 1 ? "agents" : "agent").." |
There was a problem hiding this comment.
Are we purposefully calling it an invalid agent or should we stick to invalid workspace?
There was a problem hiding this comment.
Good point. Let's stick with agent for now since this an internal error we're surfacing.
ThomasK33
left a comment
There was a problem hiding this comment.
LGTM. Only one question regarding naming consistency

The app previously didn't match the proposed design (and the Windows app) and display offline workspaces with a gray status.
Also improves the app's handling of invalid agents, indicating to the user that something went wrong. Clicking the button opens an alert with info. It's possible for invalid agents to resolve themselves, such as if the workspace update is sent at a later time.
Formatting these legacy API alert messages (such as to uncentre the text) is a pain, but ideally users never see these errors in the first place, so I think it's okay.
Also, for some reason I had the display of an agent in the list as always .coder. Whilst it usually is that value, if there's multiple agents in a workspace coderd will not send .coder as a FQDN, in which case we should instead display the next shortest FQDN, which we do now.