Skip to content

Commit cefb0c5

Browse files
committed
feat: show when workspace apps are loading
ethan/workspace-apps-loading
1 parent 2adace3 commit cefb0c5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenuItem.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ struct MenuItemView: View {
7272

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

75+
@State private var loadingApps: Bool = true
76+
7577
var hasApps: Bool { !apps.isEmpty }
7678

7779
private var itemName: AttributedString {
@@ -129,9 +131,13 @@ struct MenuItemView: View {
129131
MenuItemIcons(item: item, wsURL: wsURL)
130132
}
131133
if isExpanded {
132-
if hasApps {
134+
switch (loadingApps, hasApps) {
135+
case (true, _):
136+
CircularProgressView(value: nil, strokeWidth: 3, diameter: 15)
137+
.padding(.top, 5)
138+
case (false, true):
133139
MenuItemCollapsibleView(apps: apps)
134-
} else {
140+
case (false, false):
135141
HStack {
136142
Text(item.status == .off ? "Workspace is offline." : "No apps available.")
137143
.font(.body)
@@ -146,6 +152,7 @@ struct MenuItemView: View {
146152
}
147153

148154
func loadApps() async {
155+
defer { loadingApps = false }
149156
// If this menu item is an agent, and the user is logged in
150157
if case let .agent(agent) = item,
151158
let client = state.client,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy