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.
67 lines
1.4 KiB
Go
67 lines
1.4 KiB
Go
package entity
|
||
|
||
import (
|
||
"time"
|
||
)
|
||
|
||
// Registry OCI Registry 领域实体
|
||
type Registry struct {
|
||
ID string
|
||
WorkspaceID string // 所属 workspace,NULL 表示全局共享
|
||
OwnerID string // 创建者用户 ID
|
||
Name string
|
||
URL string
|
||
Description string
|
||
Username string
|
||
Password string
|
||
Insecure bool // 是否跳过 TLS 验证
|
||
IsShared bool // 是否为共享 Registry(admin 创建供多 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
|
||
}
|
||
|