update getting hosts that use keys to use new key system

This commit is contained in:
neon443
2025-07-01 19:40:01 +01:00
parent 93d9636960
commit 0af64a4efd
2 changed files with 3 additions and 2 deletions

View File

@@ -200,10 +200,11 @@ class HostsManager: ObservableObject, @unchecked Sendable {
return result return result
} }
func getHostsKeysUsedOn(_ keys: [Keypair]) -> [Host] { func getHostsUsingKeys(_ keys: [Keypair]) -> [Host] {
var result: [Host] = [] var result: [Host] = []
for key in keys { for key in keys {
let hosts = hosts.filter({ let hosts = hosts.filter({
$0.privateKeyID == key.id ||
$0.publicKey == key.publicKey && $0.publicKey == key.publicKey &&
$0.privateKey == key.privateKey $0.privateKey == key.privateKey
}) })

View File

@@ -20,7 +20,7 @@ struct KeyDetailView: View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
Text("Used on") Text("Used on")
.bold() .bold()
ForEach(hostsManager.getHostsKeysUsedOn([keypair])) { host in ForEach(hostsManager.getHostsUsingKeys([keypair])) { host in
HStack { HStack {
SymbolPreview(symbol: host.symbol, label: host.label) SymbolPreview(symbol: host.symbol, label: host.label)
.frame(width: 40, height: 40) .frame(width: 40, height: 40)