-
Notifications
You must be signed in to change notification settings - Fork 2
fix: display offline workspaces #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we purposefully calling it an invalid agent or should we stick to invalid workspace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Let's stick with agent for now since this an internal error we're surfacing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Only one question regarding naming consistency
7ffa48b
into
ethan/quarantine-workaround
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.