|
|
|
|
@ -32,11 +32,11 @@ struct APICallsListView: View { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func load() { |
|
|
|
|
self.descriptors = Store.main.collectionNames().map { |
|
|
|
|
CollectionDescriptor(name: $0.0, type: $0.1) |
|
|
|
|
}.sorted(by: \.name, order: .ascending) |
|
|
|
|
Task { |
|
|
|
|
|
|
|
|
|
self.descriptors = await StoreCenter.main.apiCollectionDescriptors().map { |
|
|
|
|
CollectionDescriptor(name: $0.0, type: $0.1) |
|
|
|
|
}.sorted(by: \.name, order: .ascending) |
|
|
|
|
|
|
|
|
|
for descriptor in self.descriptors { |
|
|
|
|
if let type = descriptor.type as? any SyncedStorable.Type { |
|
|
|
|
await self.loadCount(type, descriptor) |
|
|
|
|
@ -85,14 +85,19 @@ struct APICallsView: View { |
|
|
|
|
|
|
|
|
|
var body: some View { |
|
|
|
|
List { |
|
|
|
|
ForEach(self.apiCalls, id: \.id) { apiCall in |
|
|
|
|
NavigationLink { |
|
|
|
|
APICallView(apiCall: apiCall, type: self.type) |
|
|
|
|
} label: { |
|
|
|
|
LabeledContent(apiCall.method.rawValue, value: apiCall.attemptsCount.string) |
|
|
|
|
Section(header: |
|
|
|
|
Text("\(apiCalls.count) API calls") |
|
|
|
|
.font(.headline) |
|
|
|
|
.foregroundColor(.primary) |
|
|
|
|
) { |
|
|
|
|
ForEach(self.apiCalls, id: \.id) { apiCall in |
|
|
|
|
NavigationLink { |
|
|
|
|
APICallView(apiCall: apiCall, type: self.type) |
|
|
|
|
} label: { |
|
|
|
|
LabeledContent(apiCall.method.rawValue, value: apiCall.attemptsCount.string) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// Text(self.text).lineLimit(nil) |
|
|
|
|
}.navigationTitle(self.name) |
|
|
|
|
.onAppear { |
|
|
|
|
self._load() |
|
|
|
|
|