Update traceroute list naming

This commit is contained in:
Brent Petit 2024-11-02 11:18:21 -05:00
parent 7f238d0b13
commit 564fadd017
2 changed files with 21 additions and 9 deletions

View file

@ -38,18 +38,25 @@
}
}
},
"%@ - %d Hops Towards %d Hops Back" : {
"%@ - %@ Towards %@ Back" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "%1$@ - %2$d Hops Towards %3$d Hops Back"
"value" : "%1$@ - %2$@ Towards %3$@ Back"
}
}
}
},
"%@ - 1 Hop" : {
"%@ - %d %@" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "%1$@ - %2$d %3$@"
}
}
}
},
"%@ - Direct" : {
@ -24065,4 +24072,4 @@
}
},
"version" : "1.0"
}
}

View file

@ -37,14 +37,19 @@ struct TraceRouteLog: View {
VStack {
List(node.traceRoutes?.reversed() as? [TraceRouteEntity] ?? [], id: \.self, selection: $selectedRoute) { route in
Label {
if route.response && route.hopsTowards == 0 {
if route.response && route.hopsTowards == 0 && route.hopsBack == 0 {
Text("\(route.time?.formatted() ?? "unknown".localized) - Direct")
.font(.caption)
} else if route.response && route.hopsTowards == 1 {
Text("\(route.time?.formatted() ?? "unknown".localized) - 1 Hop")
} else if route.response && route.hopsTowards == route.hopsBack {
let hopLabel = route.hopsTowards == 1 ? "Hop" : "Hops"
Text("\(route.time?.formatted() ?? "unknown".localized) - \(route.hopsTowards) \(hopLabel)")
.font(.caption)
} else if route.response {
Text("\(route.time?.formatted() ?? "unknown".localized) - \(route.hopsTowards) Hops Towards \(route.hopsBack) Hops Back")
let hopTowardsLabel = route.hopsTowards == 1 ? "Hop" : "Hops"
let hopBackLabel = route.hopsBack == 1 ? "Hop" : "Hops"
let hopTowardsString = (route.hopsTowards == 0) ? "Direct" : "\(route.hopsTowards) \(hopTowardsLabel)"
let hopBackString = (route.hopsBack == 0) ? "Direct" : "\(route.hopsBack) \(hopBackLabel)"
Text("\(route.time?.formatted() ?? "unknown".localized) - \(hopTowardsString) Towards \(hopBackString) Back")
.font(.caption)
} else if route.sent {
Text("\(route.time?.formatted() ?? "unknown".localized) - No Response")