From d0c70a7da6f4060422a545cea2396f9df5f7d61f Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Thu, 2 Jul 2026 21:29:14 +0200 Subject: [PATCH] =?UTF-8?q?ux(storage):=20hide=20'Elt=C3=A1vol=C3=ADt?= =?UTF-8?q?=C3=A1s=20a=20list=C3=A1b=C3=B3l'=20on=20wizard-enrolled=20driv?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-removal only deletes the registry entry — it's the undo of a manual path add. On an enrolled drive (/mnt/felhom-drives/) it leaves a de-registered-but-still-bound limbo nobody wants; the real lifecycle there is Biztonságos leválasztás / Végleges leszerelés. New StoragePathView.IsEnrolled gates the button; manual paths keep it; the decommissioned-branch removal (final cleanup) is unchanged. Endpoint untouched. --- CHANGELOG.md | 11 +++++ controller/internal/web/handlers.go | 2 + .../internal/web/settings_split_test.go | 44 +++++++++++++++++++ .../internal/web/templates/storage.html | 6 ++- 4 files changed, 62 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b902c7..6af1256 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ ## Changelog +### v0.98.3 — hide "Eltávolítás a listából" on wizard-enrolled drives (2026-07-02) + +User feedback follow-up: list-removal (registry-entry delete; data + mount untouched) is only +meaningful as the undo of a MANUAL path add. On a wizard-enrolled drive (/mnt/felhom-drives/) the +resulting de-registered-but-still-agent-bound limbo is never what the customer wants — its real +lifecycle is Biztonságos leválasztás / Végleges leszerelés. New `StoragePathView.IsEnrolled` +(path-prefix check) gates the button; manually added paths keep it, and the decommissioned-branch +"Eltávolítás a rendszerből" (final cleanup) is unchanged. Endpoint untouched. +Test: enrolled card must not render the remove form, manual card must (TestListRemovalHiddenForEnrolledDrives). + + ### v0.98.2 — drive-card action clarity: dedupe + self-documenting labels (2026-07-02) User feedback: two "Leválasztás" buttons per drive, and four near-synonymous labels (Letiltás / diff --git a/controller/internal/web/handlers.go b/controller/internal/web/handlers.go index e7e2819..b83d814 100644 --- a/controller/internal/web/handlers.go +++ b/controller/internal/web/handlers.go @@ -109,6 +109,7 @@ type StoragePathView struct { StoppedApps []string // stacks auto-stopped due to disconnect (for restart UI) MigratedToLabel string // label of the drive data was migrated to HasOtherPaths bool // true if other connected non-decommissioned paths exist + IsEnrolled bool // enrolled via the wizard (stable /mnt/felhom-drives/ path) — lifecycle is disconnect/decommission, not list-removal } func (s *Server) baseData(page, title string) map[string]interface{} { @@ -964,6 +965,7 @@ func (s *Server) storagePageData() map[string]interface{} { StoragePath: sp, StoppedApps: sp.StoppedStacks, HasOtherPaths: connectedCount > 1, + IsEnrolled: strings.HasPrefix(sp.Path, "/mnt/felhom-drives/"), } if sp.Disconnected { // Skip I/O calls on disconnected drives — they'd hang or fail diff --git a/controller/internal/web/settings_split_test.go b/controller/internal/web/settings_split_test.go index 422e678..68db62c 100644 --- a/controller/internal/web/settings_split_test.go +++ b/controller/internal/web/settings_split_test.go @@ -293,3 +293,47 @@ func TestNoEmojiInTemplates(t *testing.T) { } } } + +// TestListRemovalHiddenForEnrolledDrives: "Eltávolítás a listából" is the undo of a MANUAL +// add only — a wizard-enrolled drive (/mnt/felhom-drives/) must not offer it (its lifecycle +// is disconnect/decommission), while a manually added path keeps it. +func TestListRemovalHiddenForEnrolledDrives(t *testing.T) { + s := testPageServer(t) + // two paths so neither is "the last one"; neither is default so the button condition can fire + if err := s.settings.AddStoragePath(settings.StoragePath{Path: "/mnt/felhom-drives/enrolled1", Label: "Enrolled", Schedulable: true, IsDefault: true}); err != nil { + t.Fatal(err) + } + if err := s.settings.AddStoragePath(settings.StoragePath{Path: "/mnt/manual_hdd", Label: "Manual", Schedulable: true}); err != nil { + t.Fatal(err) + } + + body := getPage(t, s, "/storage").Body.String() + + // the manual card renders the list-removal form, the enrolled card must not + manualForm := `value="/mnt/manual_hdd">` + enrolledForm := `value="/mnt/felhom-drives/enrolled1">` + removeAction := `action="/settings/storage/remove"` + if !strings.Contains(body, removeAction) { + t.Fatal("no list-removal form rendered at all — manual path should have one") + } + // slice per remove-form occurrence and check which path each carries + var enrolledHasRemove, manualHasRemove bool + for _, chunk := range strings.Split(body, removeAction)[1:] { + head := chunk + if len(head) > 400 { + head = head[:400] + } + if strings.Contains(head, enrolledForm) { + enrolledHasRemove = true + } + if strings.Contains(head, manualForm) { + manualHasRemove = true + } + } + if enrolledHasRemove { + t.Error("enrolled drive (/mnt/felhom-drives/) offers 'Eltávolítás a listából' — must be hidden") + } + if !manualHasRemove { + t.Error("manually added path lost its 'Eltávolítás a listából' button") + } +} diff --git a/controller/internal/web/templates/storage.html b/controller/internal/web/templates/storage.html index e99a1e5..fe88285 100644 --- a/controller/internal/web/templates/storage.html +++ b/controller/internal/web/templates/storage.html @@ -139,7 +139,11 @@ {{if .IsUSB}} {{end}} - {{if and (not .IsDefault) (eq .AppCount 0)}} + {{/* List-removal is the undo of a MANUAL add only. Wizard-enrolled drives + (/mnt/felhom-drives/) have a real lifecycle — Biztonságos leválasztás / + Végleges leszerelés — and a de-registered-but-still-bound state is never + what the customer wants, so the button is hidden for them. */}} + {{if and (not .IsDefault) (eq .AppCount 0) (not .IsEnrolled)}}
{{$.CSRFField}}