refactor(ui): remove unused copy and repair metrics fixtures

Remove six unused title/discovery resource APIs and catalog entries while
retaining legacy preference compatibility and all remaining translations.
Replace stale negative discovery assertions with observable row/actions.

Provide the required AppModel to two direct metrics fixtures, sharing their
hosts/model and cleanup. Keep production ownership and UI opt-ins intact.
Validation: 38 focused layout/localization tests, strict formatting,
AppStrings validation, and localization checks passed.
This commit is contained in:
Kaede Akino committed 2026-10-17 09:51:00 +08:00
1 parent 3bf5915395
commit 9743589f86
6 files changed
+16 -301

No files matched your search

-270
View File
@@ -11700,53 +11700,6 @@
}
}
},
"Bonjour" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Bonjour"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Bonjour"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Bonjour"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "Bonjour"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "Bonjour"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "Bonjour"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "Bonjour"
}
}
}
},
"Both" : {
"extractionState" : "manual",
"localizations" : {
@@ -21001,47 +20954,6 @@
}
}
},
"Dark Custom Configuration" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Benutzerdefinierte dunkle Konfiguration"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Configuration sombre personnalisée"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "ダークモードのカスタム設定"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "다크 모드 사용자 설정"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "深色自定义配置"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "深色自訂設定"
}
}
}
},
"Dark Theme" : {
"extractionState" : "manual",
"localizations" : {
@@ -38151,47 +38063,6 @@
}
}
},
"Light Custom Configuration" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Benutzerdefinierte helle Konfiguration"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Configuration claire personnalisée"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "ライトモードのカスタム設定"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "라이트 모드 사용자 설정"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "浅色自定义配置"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "淺色自訂設定"
}
}
}
},
"Light Theme" : {
"extractionState" : "manual",
"localizations" : {
@@ -51818,53 +51689,6 @@
}
}
},
"Port 23 Open" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Port 23 offen"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Port 23 Open"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Port 23 ouvert"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "ポート23が開いています"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "포트 23 열림"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "端口23已开放"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "連接埠23已開啟"
}
}
}
},
"Port Forwarding" : {
"extractionState" : "manual",
"localizations" : {
@@ -60010,53 +59834,6 @@
}
}
},
"SSH Advertised" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "SSH angekündigt"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "SSH Advertised"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "SSH annoncé"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "SSHサービス公開中"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "SSH 서비스 광고됨"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "已广播SSH服务"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "已廣播SSH服務"
}
}
}
},
"SSH Certificate" : {
"extractionState" : "manual",
"localizations" : {
@@ -60262,53 +60039,6 @@
}
}
},
"SSH Verified" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "SSH bestätigt"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "SSH Verified"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "SSH vérifié"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "SSH確認済み"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "SSH 확인됨"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "已验证SSH"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "已驗證SSH"
}
}
}
},
"SSH and SFTP connection links cannot contain passwords." : {
"extractionState" : "manual",
"localizations" : {
@@ -56,18 +56,6 @@ extension AppStrings {
public static var scanFailed: LocalizedStringResource {
"Local discovery failed. Check your network and try again."
}
public static var bonjour: LocalizedStringResource {
"Bonjour"
}
public static var verifiedSSH: LocalizedStringResource {
"SSH Verified"
}
public static var telnetPortOpen: LocalizedStringResource {
"Port 23 Open"
}
public static var advertisedSSH: LocalizedStringResource {
"SSH Advertised"
}
public static var noMAC: LocalizedStringResource {
"No physical network adapter was found. Enter the MAC address manually."
}
@@ -225,10 +225,6 @@ extension AppStrings {
"Dark"
}
public static var darkCustomConfiguration: LocalizedStringResource {
"Dark Custom Configuration"
}
public static var deleteAllLoggingFilesConfirmation: LocalizedStringResource {
"Delete all logging files?"
}
@@ -420,10 +416,6 @@ extension AppStrings {
"Light"
}
public static var lightCustomConfiguration: LocalizedStringResource {
"Light Custom Configuration"
}
public static var limits: LocalizedStringResource {
"Limits"
}
@@ -89,13 +89,14 @@ struct MobileLocalDiscoveryRenderingTests {
try await Task.sleep(for: .milliseconds(700))
window.layoutIfNeeded()
let labels = accessibilityLabels(in: window)
#expect(labels.contains { $0.contains("192.168.1.24:22") })
for text in ["Mac mini", "mac-mini.local:22", "192.168.1.24:22", "Raspberry Pi", "raspberrypi.local:22"] {
#expect(labels.contains { $0.contains(text) })
}
for resource in [
AppStrings.LocalNetwork.bonjour, AppStrings.LocalNetwork.advertisedSSH,
AppStrings.LocalNetwork.verifiedSSH, AppStrings.LocalNetwork.telnetPortOpen,
AppStrings.LocalNetwork.discovery, AppStrings.LocalNetwork.rescan, AppStrings.Common.cancel,
] {
let unwanted = AppLocalization.resolve(resource, locale: Locale(identifier: language))
#expect(!labels.contains { $0.contains(unwanted) })
let title = AppLocalization.resolve(resource, locale: Locale(identifier: language))
#expect(labels.contains { $0.contains(title) })
}
let data = UIGraphicsImageRenderer(bounds: window.bounds).pngData { _ in
window.drawHierarchy(in: window.bounds, afterScreenUpdates: true)
+5 -3
View File
@@ -70,20 +70,22 @@ struct MetricsDetailToolbarTests {
@Test(arguments: [AppLanguage.english, .simplifiedChinese, .traditionalChinese])
func legacyCompactSearchOpensTheNativeFieldAndKeepsItsQueryWhenWidened(_ language: AppLanguage) async throws {
let configuration = ScreenshotDemoConfiguration(scene: .metricsDetail, language: language)
let model = configuration.makeMetricsModel(hosts: .demo())
let hosts = HostLibraryModel.demo()
let model = configuration.makeMetricsModel(hosts: hosts)
let app = AppModel(hosts: hosts, serverMetrics: model)
let server = try #require(model.servers.first)
let state = WindowModel()
state.selectedDestination = .metrics
state.metricsHostID = server.id
state.metricsModel = model
let root = LegacyMetricsToolbarFixture(server: server)
.environment(state).environment(\.locale, language.locale)
.environment(app).environment(state).environment(\.locale, language.locale)
let window = makeWindow(root)
defer {
window.orderOut(nil)
window.contentViewController = nil
window.close()
model.shutdown()
app.shutdownForTermination()
}
await settle(window)
#expect(state.showsCompactMetricsDetail)
+5 -3
View File
@@ -71,13 +71,15 @@ struct ResponsivePageLayoutTests {
@Test
func metricsPagesAndResizeKeepTheProcessTableAndBothScrollPositions() async throws {
let configuration = ScreenshotDemoConfiguration(scene: .metricsDetail, language: .english)
let model = configuration.makeMetricsModel(hosts: .demo())
let hosts = HostLibraryModel.demo()
let model = configuration.makeMetricsModel(hosts: hosts)
let app = AppModel(hosts: hosts, serverMetrics: model)
let server = try #require(model.servers.first)
let state = WindowModel()
state.selectedDestination = .metrics
state.metricsModel = model
state.metricsHostID = server.id
let hosting = NSHostingView(rootView: MetricsDetailView(server: server).environment(state))
let hosting = NSHostingView(rootView: MetricsDetailView(server: server).environment(app).environment(state))
let window = NSWindow(
contentRect: CGRect(x: 0, y: 0, width: 900, height: 600),
styleMask: .borderless, backing: .buffered, defer: false)
@@ -85,7 +87,7 @@ struct ResponsivePageLayoutTests {
window.contentView = hosting
defer {
window.close()
model.shutdown()
app.shutdownForTermination()
}
await layout(hosting)
let table = try #require(descendant(in: hosting, ofType: NSTableView.self))