2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 11:27:17 +08:00

feat: 优化容器编排列表

This commit is contained in:
2026-01-16 23:42:02 +08:00
parent e205f51197
commit 980b3674b0
7 changed files with 51 additions and 15 deletions

View File

@@ -27,6 +27,20 @@ type Template struct {
type Templates []*Template
// FilterByCategory 按分类过滤模版
func (t Templates) FilterByCategory(category string) Templates {
filtered := make(Templates, 0)
for _, tpl := range t {
for _, cat := range tpl.Categories {
if cat == category {
filtered = append(filtered, tpl)
break
}
}
}
return filtered
}
// Templates 返回所有模版
func (r *API) Templates() (*Templates, error) {
resp, err := r.client.R().SetResult(&Response{}).Get("/templates")