Skip to content

Commit eea8885

Browse files
committed
fixup
1 parent c24fa6b commit eea8885

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

Coder-Desktop/Coder-Desktop/VPN/MenuState.swift

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ struct Agent: Identifiable, Equatable, Comparable, Hashable {
1010
let wsName: String
1111
let wsID: UUID
1212

13-
// Agents are sorted by name
13+
// Agents are sorted by stauts, and then by name
1414
static func < (lhs: Agent, rhs: Agent) -> Bool {
15-
lhs.wsName.localizedCompare(rhs.wsName) == .orderedAscending
15+
if lhs.status != rhs.status {
16+
return lhs.status < rhs.status
17+
}
18+
return lhs.wsName.localizedCompare(rhs.wsName) == .orderedAscending
1619
}
1720

1821
let primaryHost: String

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

+1-16
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,7 @@ struct MenuItemIconButton: View {
233233
let action: @MainActor () -> Void
234234

235235
var body: some View {
236-
Button {
237-
action()
238-
} label: {
236+
Button(action: action) {
239237
Image(systemName: systemName)
240238
.padding(3)
241239
.contentShape(Rectangle())
@@ -259,16 +257,3 @@ struct AnimatedChevron: View {
259257
.animation(.easeInOut(duration: Theme.Animation.collapsibleDuration), value: isExpanded)
260258
}
261259
}
262-
263-
#if DEBUG
264-
#Preview {
265-
let appState = AppState(persistent: false)
266-
appState.login(baseAccessURL: URL(string: "http://127.0.0.1:8080")!, sessionToken: "")
267-
// appState.clearSession()
268-
269-
return VPNMenu<PreviewVPN, PreviewFileSync>().frame(width: 256)
270-
.environmentObject(PreviewVPN())
271-
.environmentObject(appState)
272-
.environmentObject(PreviewFileSync())
273-
}
274-
#endif

Coder-Desktop/Coder-DesktopTests/AgentsTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct AgentsTests {
6262
let forEach = try view.inspect().find(ViewType.ForEach.self)
6363
#expect(forEach.count == Theme.defaultVisibleAgents)
6464
// Agents are sorted by status, and then by name in alphabetical order
65-
#expect(throws: Never.self) { try view.inspect().find(link: "a1.coder") }
65+
#expect(throws: Never.self) { try view.inspect().find(text: "a1.coder") }
6666
}
6767

6868
@Test
@@ -115,7 +115,7 @@ struct AgentsTests {
115115
try await sut.inspection.inspect { view in
116116
let forEach = try view.find(ViewType.ForEach.self)
117117
#expect(forEach.count == Theme.defaultVisibleAgents)
118-
#expect(throws: Never.self) { try view.find(link: "offline.coder") }
118+
#expect(throws: Never.self) { try view.find(text: "offline.coder") }
119119
}
120120
}
121121
}

0 commit comments

Comments
 (0)