Skip to content

Commit 45bd96c

Browse files
committed
Move CLI details into edit sheet
1 parent 8230665 commit 45bd96c

1 file changed

Lines changed: 32 additions & 14 deletions

File tree

Sources/App/Views/ManagementViews.swift

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ struct CLISecretsView: View {
6565
@State private var pendingUnregister: CLIRegistrationSummary?
6666
@State private var deleteSecrets = false
6767
@State private var showingPolicyEditor = false
68+
@State private var editingCLIName: String?
6869

6970
var body: some View {
7071
ControlPlanePageFrame(
@@ -86,14 +87,9 @@ struct CLISecretsView: View {
8687
} else if store.filteredCLIRegistrations.isEmpty {
8788
NoMatchingCLIView(store: store)
8889
} else {
89-
HSplitView {
90-
CLIRegistrationTable(store: store)
91-
.frame(minWidth: 560, idealWidth: 700)
92-
CLIRegistrationDetail(
93-
store: store,
94-
pendingUnregister: $pendingUnregister
95-
)
96-
.frame(minWidth: 460)
90+
CLIRegistrationTable(store: store) { cliName in
91+
store.selectedCLI = cliName
92+
editingCLIName = cliName
9793
}
9894
.frame(minHeight: 460)
9995
}
@@ -102,6 +98,16 @@ struct CLISecretsView: View {
10298
CLIDeliveryPolicyEditorSheet(store: store)
10399
.frame(width: 900, height: 720)
104100
}
101+
.sheet(isPresented: Binding(
102+
get: { editingCLIName != nil },
103+
set: { if !$0 { editingCLIName = nil } }
104+
)) {
105+
CLIRegistrationEditorSheet(
106+
store: store,
107+
pendingUnregister: $pendingUnregister
108+
)
109+
.frame(width: 760, height: 760)
110+
}
105111
.confirmationDialog("Unregister CLI?", isPresented: Binding(
106112
get: { pendingUnregister != nil },
107113
set: {
@@ -199,6 +205,7 @@ private struct CLIDeliveryPolicyMetric: View {
199205

200206
private struct CLIRegistrationTable: View {
201207
@Bindable var store: ControlPlaneStore
208+
var edit: (String) -> Void
202209

203210
var body: some View {
204211
Table(store.filteredCLIRegistrations, selection: $store.selectedCLI) {
@@ -247,16 +254,15 @@ private struct CLIRegistrationTable: View {
247254

248255
TableColumn("") { item in
249256
Button {
250-
store.selectedCLI = item.name
257+
edit(item.name)
251258
} label: {
252-
Label("Details", systemImage: "sidebar.right")
253-
.labelStyle(.iconOnly)
259+
Label("Edit", systemImage: "slider.horizontal.3")
254260
}
255261
.buttonStyle(.borderless)
256-
.help("Show details for \(item.name)")
257-
.accessibilityLabel("Show details for \(item.name)")
262+
.help("Edit delivery settings for \(item.name)")
263+
.accessibilityLabel("Edit \(item.name)")
258264
}
259-
.width(44)
265+
.width(min: 86, ideal: 96)
260266
}
261267
.accessibilityLabel("Registered CLI delivery table")
262268
}
@@ -266,6 +272,18 @@ private struct CLIRegistrationTable: View {
266272
}
267273
}
268274

275+
private struct CLIRegistrationEditorSheet: View {
276+
@Bindable var store: ControlPlaneStore
277+
@Binding var pendingUnregister: CLIRegistrationSummary?
278+
279+
var body: some View {
280+
CLIRegistrationDetail(
281+
store: store,
282+
pendingUnregister: $pendingUnregister
283+
)
284+
}
285+
}
286+
269287
private struct CLIDeliveryPolicyEditorSheet: View {
270288
@Bindable var store: ControlPlaneStore
271289
@Environment(\.dismiss) private var dismiss

0 commit comments

Comments
 (0)