Files
felhom-controller/controller/internal/web/i18n_cases_c_test.go
T

163 lines
9.4 KiB
Go

package web
// ── i18n slice 1, release C (v0.250.0) — storage, sharing, sign-in and guest pages, debug ───────────
//
// Captured from the UNCONVERTED templates (commit in REPORT.md). Data: multi-word or ASCII values only.
func i18nStoragePaths() []m {
return []m{
{"Path": "/mnt/usb1", "Label": "USB lemez egy", "Disconnected": true, "DisconnectedAt": "2026-09-14 03:12", "StoppedApps": []string{"immich", "kimai"}},
{"Path": "/mnt/old", "Label": "Régi lemez kettő", "Decommissioned": true, "MigratedToLabel": "HDD egy", "MigratedTo": "/mnt/hdd1", "DecommissionedAt": "2026-09-01 10:00"},
{"Path": "/mnt/hdd1", "Label": "HDD egy", "IsDefault": true, "Schedulable": true, "IsUSB": true, "IsMounted": false,
"DiskInfo": m{"UsedHuman": "950 GB", "TotalHuman": "1 TB", "UsedPercent": 95.0}, "FSInfo": m{"FSType": "ext4", "Device": "/dev/sdb1", "Model": "WD Red"},
"StoppedApps": []string{"immich"}, "AppDetails": []m{{"Stack": "immich", "Name": "Immich Photos", "SizeHuman": "12 GB"}},
"AppCount": 1, "HasOtherPaths": true, "IsEnrolled": true},
{"Path": "/mnt/hdd2", "Label": "HDD kettő", "IsDefault": false, "Schedulable": false, "IsUSB": false, "IsMounted": true,
"DiskInfo": m{"UsedHuman": "750 GB", "TotalHuman": "1 TB", "UsedPercent": 75.0}, "FSInfo": m{"FSType": "ext4", "Device": "/dev/sdc1"},
"AppCount": 0, "IsEnrolled": false},
{"Path": "/mnt/hdd3", "Label": "HDD három", "IsDefault": false, "Schedulable": true, "IsMounted": true,
"DiskInfo": m{"UsedHuman": "10 GB", "TotalHuman": "1 TB", "UsedPercent": 1.0}, "AppCount": 0, "IsEnrolled": true},
}
}
func i18nCasesC() []i18nCase {
return []i18nCase{
{"debug", "debug", func() map[string]interface{} {
d := i18nLayoutData("debug", "Debug")
d["DebugMode"] = true
return d
}},
{"storage_full", "storage", func() map[string]interface{} {
d := i18nLayoutData("storage", "Tárhely")
d["StorageError"], d["StorageSuccess"] = "Az útvonal nem írható most.", "A tárhely hozzáadva rendben."
d["StoragePaths"] = i18nStoragePaths()
return d
}},
{"storage_empty", "storage", func() map[string]interface{} {
return i18nLayoutData("storage", "Tárhely")
}},
// `09` §3 decision 36 — the kept-data list, one dated and one leftover row, and the empty page.
{"kept_data_full", "kept_data", func() map[string]interface{} {
d := i18nLayoutData("kept-data", "Megőrzött adatok")
d["KeptRows"] = []keptRow{
{DisplayName: "Nextcloud", App: "nextcloud", Path: "/mnt/felhom-drives/hdd_1/kept/nextcloud/2026-09-14_031200", Date: "2026-09-14 05:12", Size: "126.0 MB",
Backup: "unit 2026-09-14 04:44", CanLoad: true, LookURL: "https://files.example.hu/files/x/y",
DeleteText: "delete-text Nextcloud 126.0 MB", TypePrompt: "type-prompt Nextcloud"},
{DisplayName: "Paperless-ngx", App: "paperless-ngx", Path: "/mnt/felhom-drives/hdd_1/appdata/paperless", Date: "2026-09-13 10:00", Size: "71.0 MB",
Backup: "none", Installed: true, LookURL: "https://files.example.hu/files/x/z",
DeleteText: "x", TypePrompt: "y"},
}
d["KeptFlash"], d["KeptError"] = "flash-ok", "flash-error"
return d
}},
{"kept_data_empty", "kept_data", func() map[string]interface{} {
return i18nLayoutData("kept-data", "Megőrzött adatok")
}},
{"storage_network_full", "storage_network", func() map[string]interface{} {
d := i18nLayoutData("storage-network", "Hálózati tárhely")
base := func(name, health string, orphan bool) m {
return m{"Name": name, "Label": "NAS " + name, "Protocol": "nfs", "Server": "nas.example", "Export": "/export/" + name, "Path": "/mnt/net/" + name, "Health": health, "Orphan": orphan}
}
d["NetworkStoragePaths"] = []m{base("a", "ok", true), base("b", "ok", false), base("c", "idle", false), base("d", "stub", false), base("e", "unreachable", false), base("f", "weird", false)}
d["NetAddSupport"] = "yes"
return d
}},
{"storage_network_nosupport", "storage_network", func() map[string]interface{} {
d := i18nLayoutData("storage-network", "Hálózati tárhely")
d["NetAddSupport"] = "no"
return d
}},
{"storage_init", "storage_init", func() map[string]interface{} {
return i18nLayoutData("storage_init", "Új meghajtó inicializálása")
}},
{"storage_attach", "storage_attach", func() map[string]interface{} {
return i18nLayoutData("storage_attach", "Meglévő meghajtó csatolása")
}},
{"sharing_full", "sharing", func() map[string]interface{} {
d := i18nLayoutData("sharing", "Hálózati megosztás")
d["Flash"] = "A megosztás elmentve rendben."
d["SMBEnabled"], d["SMBRunning"], d["SMBUserSet"], d["SMBServerName"], d["SMBDirectAddress"] = true, true, false, "FELHOM", "192.168.1.10"
d["SMBShares"] = []m{
{"Name": "photos", "Path": "/mnt/hdd1/photos", "Available": false, "ReadOnly": true, "Offsite": true, "System": true},
{"Name": "docs", "Path": "/mnt/hdd1/docs", "Available": true, "ReadOnly": false, "Offsite": false, "System": false},
}
d["SharesTier2Status"], d["SharesTier2LastRun"], d["SharesTier2Warning"] = "ok", "2026-09-14 03:12", "egy figyelmeztetés itt"
d["SharesOffsiteStatus"], d["SharesOffsiteCount"], d["SharesOffsiteLastRun"] = "ok", 2, "2026-09-14 03:12"
d["StorageRoots"] = []m{{"Path": "/mnt/hdd1", "Label": "HDD egy"}}
return d
}},
{"sharing_notarget_blocked", "sharing", func() map[string]interface{} {
d := i18nLayoutData("sharing", "Hálózati megosztás")
d["SMBEnabled"], d["SMBRunning"], d["SMBUserSet"], d["SMBServerName"] = true, false, true, "FELHOM"
d["SMBShares"] = []m{{"Name": "docs", "Path": "/mnt/hdd1/docs", "Available": true}}
d["SharesTier2Status"], d["SharesTier2Error"] = "no_target", "nincs második meghajtó"
d["SharesOffsiteStatus"] = "blocked"
return d
}},
{"sharing_error_skipped", "sharing", func() map[string]interface{} {
d := i18nLayoutData("sharing", "Hálózati megosztás")
d["SMBEnabled"], d["SMBServerName"] = true, "FELHOM"
d["SMBShares"] = []m{{"Name": "docs", "Path": "/mnt/hdd1/docs", "Available": true}}
d["SharesTier2Status"], d["SharesTier2Error"] = "error", "rsync hiba történt"
d["SharesOffsiteStatus"] = "skipped"
return d
}},
{"sharing_other_none", "sharing", func() map[string]interface{} {
d := i18nLayoutData("sharing", "Hálózati megosztás")
d["SMBEnabled"], d["SMBServerName"] = true, "FELHOM"
d["SMBShares"] = []m{{"Name": "docs", "Path": "/mnt/hdd1/docs", "Available": true}}
d["SharesOffsiteStatus"] = "failed"
return d
}},
{"sharing_no_offsite_yet", "sharing", func() map[string]interface{} {
d := i18nLayoutData("sharing", "Hálózati megosztás")
d["SMBEnabled"], d["SMBServerName"] = true, "FELHOM"
d["SMBShares"] = []m{{"Name": "docs", "Path": "/mnt/hdd1/docs", "Available": true}}
d["SharesTier2Status"] = "ok"
return d
}},
{"sharing_off", "sharing", func() map[string]interface{} {
d := i18nLayoutData("sharing", "Hálózati megosztás")
d["SMBEnabled"], d["SMBServerName"] = false, "FELHOM"
return d
}},
{"login", "login", func() map[string]interface{} {
return m{"Version": "0.250.0", "CustomerName": "Teszt Ügyfél", "Flash": "Sikeres kijelentkezés most.", "Error": "Hibás jelszó lett megadva."}
}},
{"claim_setup_code", "claim", func() map[string]interface{} {
return m{"CustomerName": "Teszt Ügyfél", "Flash": "Az új kód elküldve most.", "Error": "A kód nem érvényes már.", "HasCode": true, "IsReset": false, "ClaimCSRF": "tok", "MinPassword": 12}
}},
{"claim_reset_code", "claim", func() map[string]interface{} {
return m{"CustomerName": "Teszt Ügyfél", "HasCode": true, "IsReset": true, "ClaimCSRF": "tok", "MinPassword": 12}
}},
{"claim_setup_nocode", "claim", func() map[string]interface{} {
return m{"CustomerName": "Teszt Ügyfél", "HasCode": false, "IsReset": false, "ClaimCSRF": "tok", "MinPassword": 12}
}},
{"claim_reset_nocode", "claim", func() map[string]interface{} {
return m{"CustomerName": "Teszt Ügyfél", "HasCode": false, "IsReset": true, "ClaimCSRF": "tok", "MinPassword": 12}
}},
{"launcher_shared_apps", "launcher_shared", func() map[string]interface{} {
return m{"Domain": "example.hu", "Apps": []m{
{"Clickable": true, "Href": "https://paste.example.hu", "Slug": "privatebin", "BrandColor": "", "DisplayName": "Private Bin"},
{"Clickable": false, "Slug": "kimai", "BrandColor": "", "DisplayName": "Kimai Time", "Label": "Jelenleg nem elérhető"},
}}
}},
{"launcher_shared_empty", "launcher_shared", func() map[string]interface{} {
return m{"Domain": "example.hu"}
}},
{"launcher_share_password", "launcher_share_password", func() map[string]interface{} {
return m{"Error": "Hibás jelszó lett megadva.", "Action": "/s/abc", "CSRF": "tok"}
}},
{"catchall_app", "catchall", func() map[string]interface{} {
return m{"AppName": "Private Bin", "AppSlug": "privatebin", "ControllerURL": "https://felhom.example.hu", "Status": "stopped",
"StatusText": "Az alkalmazás jelenleg le van állítva", "Host": "paste.example.hu"}
}},
{"setupgate", "setupgate", func() map[string]interface{} {
return m{"AppName": "Immich", "Host": "photos.example.hu", "LoginURL": "/login?next=%2F__gate%2Fstart%3Frd%3Dhttps%253A%252F%252Fphotos.example.hu%252F"}
}},
{"catchall_unknown", "catchall", func() map[string]interface{} {
return m{"ControllerURL": "https://felhom.example.hu", "Status": "unknown", "StatusText": "Ez a cím nem tartozik alkalmazáshoz", "Host": "x.example.hu"}
}},
}
}