Files
felhom-controller/controller/internal/web/metabadge.go
T
admin ea0d3f1764 catalog: app lifecycle states - available/hidden/abandoned (v0.158.0)
The catalog knew only 'present' or 'gone', and 'gone' orphans every customer
already running the app. lifecycle: in .felhom.yml withdraws an app from new
installs without touching anyone running it.

Deploy gate is server-side and fail-closed, before any mutation, with the
ruled Hungarian refusal - hiding a button is not a gate. Unknown values fail
OPEN (available + one WARN), deliberately opposite, so a typo or a newer
catalog cannot pull a working app out of every customer's list.

Orphan detection never sees the field - a red-proof adds that filter and shows
the abandoned app immediately reading as an orphan.

Badge plumbing is generic (MetaBadge + meta_badge partial) so R-56's
difficulty labels drop in with no new markup.
2026-07-21 16:19:58 +02:00

36 lines
1.8 KiB
Go

package web
import "gitea.dooplex.hu/admin/felhom-controller/internal/stacks"
// MetaBadge is a catalog-metadata badge: a short pill on an app card or app page that says
// something about the APP ITSELF rather than about its running state. State badges (Fut, Leállítva,
// …) come from stateLabel/stateColor and are a different axis — an app can be "Fut" and
// "Nem karbantartott" at the same time, which is exactly the case this exists for.
//
// Deliberately generic: the lifecycle badge is the first user, and R-56's difficulty labels
// (kezdő / haladó / technikás) are meant to be a second `*MetaBadge`-returning funcmap entry plus a
// call to the same `meta_badge` partial — no new markup, no new CSS.
type MetaBadge struct {
Label string // the pill text (Hungarian)
Class string // a tag-* variant from style.css: tag-warn, tag-neutral, …
Title string // hover/assistive explanation; a badge that only says a word is a riddle
}
// lifecycleBadge returns the badge for an app's catalog lifecycle, or nil when there is nothing to
// say (the available case, which is almost every app — a badge on everything is a badge on nothing).
//
// `hidden` deliberately renders NOTHING on a deployed app: the customer is running it, it works, and
// "we stopped offering this to new customers" is not their problem. Only `abandoned` is a fact they
// need, because it changes what they can expect from the software over time.
func lifecycleBadge(m stacks.Metadata) *MetaBadge {
if m.EffectiveLifecycle() != stacks.LifecycleAbandoned {
return nil
}
return &MetaBadge{
Label: "Nem karbantartott",
Class: "tag-warn",
Title: "Az alkalmazás fejlesztője felhagyott a fejlesztéssel. " +
"A telepített verzió továbbra is használható, de frissítések és biztonsági javítások már nem érkeznek hozzá.",
}
}