mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 11:27:17 +08:00
feat: 优化容器编排列表
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user