Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 3 commits into from
Feb 12, 2025

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Feb 10, 2025

The app previously didn't match the proposed design (and the Windows app) and display offline workspaces with a gray status.

image

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.

image image

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.

Copy link
Member Author

ethanndickson commented Feb 10, 2025

@ethanndickson ethanndickson force-pushed the ethan/offline-workspaces branch from f5fdeeb to c1bc5ad Compare February 10, 2025 08:19
@ethanndickson ethanndickson force-pushed the ethan/quarantine-workaround branch from d434e77 to 024d7e3 Compare February 10, 2025 10:27
@ethanndickson ethanndickson force-pushed the ethan/offline-workspaces branch 2 times, most recently from a9e3504 to caf84f1 Compare February 10, 2025 12:06
@ethanndickson ethanndickson marked this pull request as ready for review February 11, 2025 04:18
@ethanndickson ethanndickson self-assigned this Feb 11, 2025
@ethanndickson ethanndickson force-pushed the ethan/offline-workspaces branch from caf84f1 to ce1883e Compare February 11, 2025 11:29
Comment on lines +19 to +21
// `.alert` from SwiftUI doesn't play nice when the calling view is in the
// menu bar.
private func showAlert() {
Copy link
Member Author

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").."
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

@ThomasK33 ThomasK33 left a 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

@ethanndickson ethanndickson merged commit 7ffa48b into ethan/quarantine-workaround Feb 12, 2025
3 of 4 checks passed
@ethanndickson ethanndickson deleted the ethan/offline-workspaces branch February 12, 2025 10:59
@ethanndickson ethanndickson restored the ethan/offline-workspaces branch February 12, 2025 11:01
ethanndickson added a commit that referenced this pull request Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants