Skip to content

feat: show when workspace apps are loading #163

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 2 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Coder-Desktop/Coder-Desktop/Views/FileSync/FilePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ struct FilePicker: View {
VStack(spacing: 0) {
if model.rootIsLoading {
Spacer()
ProgressView()
.controlSize(.large)
CircularProgressView(value: nil)
Spacer()
} else if let loadError = model.error {
Text("\(loadError.description)")
Expand Down Expand Up @@ -125,7 +124,8 @@ struct FilePickerEntry: View {
Label {
Text(entry.name)
ZStack {
ProgressView().controlSize(.small).opacity(entry.isLoading && entry.error == nil ? 1 : 0)
CircularProgressView(value: nil, strokeWidth: 2, diameter: 10)
.opacity(entry.isLoading && entry.error == nil ? 1 : 0)
Image(systemName: "exclamationmark.triangle.fill")
.opacity(entry.error != nil ? 1 : 0)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct FileSyncSessionModal<VPN: VPNService, FS: FileSyncDaemon>: View {
Text(msg).foregroundStyle(.secondary)
}
if loading {
ProgressView().controlSize(.small)
CircularProgressView(value: nil, strokeWidth: 3, diameter: 15)
}
Button("Cancel", action: { dismiss() }).keyboardShortcut(.cancelAction)
Button(existingSession == nil ? "Add" : "Save") { Task { await submit() }}
Expand Down
11 changes: 9 additions & 2 deletions Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenuItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ struct MenuItemView: View {

@State private var apps: [WorkspaceApp] = []

@State private var loadingApps: Bool = true

var hasApps: Bool { !apps.isEmpty }

private var itemName: AttributedString {
Expand Down Expand Up @@ -129,9 +131,13 @@ struct MenuItemView: View {
MenuItemIcons(item: item, wsURL: wsURL)
}
if isExpanded {
if hasApps {
switch (loadingApps, hasApps) {
case (true, _):
CircularProgressView(value: nil, strokeWidth: 3, diameter: 15)
.padding(.top, 5)
case (false, true):
MenuItemCollapsibleView(apps: apps)
} else {
case (false, false):
HStack {
Text(item.status == .off ? "Workspace is offline." : "No apps available.")
.font(.body)
Expand All @@ -146,6 +152,7 @@ struct MenuItemView: View {
}

func loadApps() async {
defer { loadingApps = false }
// If this menu item is an agent, and the user is logged in
if case let .agent(agent) = item,
let client = state.client,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct WorkspaceAppIcon: View {
) { $0 }
placeholder: {
if app.icon != nil {
ProgressView().controlSize(.small)
CircularProgressView(value: nil, strokeWidth: 2, diameter: 10)
} else {
Image(systemName: "questionmark").frame(
width: Theme.Size.appIconWidth,
Expand Down
Loading