Files
ocdp-go/backend/internal/domain/entity/registry.go
Ivan087 29d0310f03 feat(frontend): add Helm chart browser, monitoring, chart-references and values templates pages
Add new frontend pages for the multi-tenant OCDP platform:

- Charts page (/charts): Browse Harbor OCI registries to list Helm chart repositories
  and versions, with deploy modal to launch charts on selected clusters
- Monitoring page (/monitoring): Display cluster metrics (CPU/Memory/GPU usage)
  and per-node details with resource utilization bars
- Chart References page (/chart-references): CRUD for chart metadata references
- Values Templates page (/templates): CRUD for Helm values templates with version
  history and rollback support
- Sidebar: Add Charts navigation, update Storage and Templates links
- api.ts: Add all API client functions (clusterApi, registryApi, instanceApi,
  monitoringApi, storageApi, chartReferenceApi, valuesTemplateApi,
  workspaceApi, userApi) with full TypeScript types

Note: deploy flow and values template rollback not yet end-to-end tested.
2026-04-15 16:59:31 +08:00

67 lines
1.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package entity
import (
"time"
)
// Registry OCI Registry 领域实体
type Registry struct {
ID string
WorkspaceID string // 所属 workspaceNULL 表示全局共享
OwnerID string // 创建者用户 ID
Name string
URL string
Description string
Username string
Password string
Insecure bool // 是否跳过 TLS 验证
IsShared bool // 是否为共享 Registryadmin 创建供多 workspace 使用)
CreatedAt time.Time
UpdatedAt time.Time
}
// NewRegistry 创建新 Registry
func NewRegistry(workspaceID, ownerID, name, url string) *Registry {
now := time.Now()
return &Registry{
WorkspaceID: workspaceID,
OwnerID: ownerID,
Name: name,
URL: url,
IsShared: false,
CreatedAt: now,
UpdatedAt: now,
}
}
// Update 更新 Registry 信息
func (r *Registry) Update(name, url, description string) {
if name != "" {
r.Name = name
}
if url != "" {
r.URL = url
}
r.Description = description
r.UpdatedAt = time.Now()
}
// SetCredentials 设置认证凭据
func (r *Registry) SetCredentials(username, password string) {
r.Username = username
r.Password = password
r.UpdatedAt = time.Now()
}
// Validate 验证 Registry 配置
func (r *Registry) Validate() error {
if r.Name == "" {
return ErrInvalidRegistryName
}
if r.URL == "" {
return ErrInvalidRegistryURL
}
return nil
}