Add app details and icon cache (T-204)
Harness governance / validate (push) Has been cancelled
Phase 0 build gate / verify (push) Has been cancelled

This commit is contained in:
ila
2026-07-16 17:22:37 +08:00
parent db8d93e843
commit a52acbf926
13 changed files with 1224 additions and 58 deletions
+13
View File
@@ -23,6 +23,9 @@ type CatalogListItem struct {
Version string
Category string
Tags []string
IconRef string
Homepage string
Tutorial string
Status domain.AppStatus
Installed bool
Installable bool
@@ -141,6 +144,16 @@ func (model *CatalogListModel) SelectedID() string {
return model.selectedID
}
// SelectedItem returns the selected source item without changing filters.
func (model *CatalogListModel) SelectedItem() (CatalogListItem, bool) {
for _, item := range model.items {
if item.ID == model.selectedID {
return item, true
}
}
return CatalogListItem{}, false
}
// Valid reports whether view is supported by the MVP list.
func (view CatalogView) Valid() bool {
return view == CatalogViewAll ||
+4
View File
@@ -64,6 +64,10 @@ func TestCatalogListModelPreservesStableOrderAndSelection(t *testing.T) {
if model.SelectedID() != "app-a" {
t.Fatalf("SelectedID = %q", model.SelectedID())
}
selected, ok := model.SelectedItem()
if !ok || selected.ID != "app-a" {
t.Fatalf("SelectedItem() = %#v, %t", selected, ok)
}
model.SetItems([]CatalogListItem{{ID: "app-b", Name: "B", Category: "工具"}})
if model.SelectedID() != "" {