feat: integrate Grafana dashboards into BOC DashboardPage

- Add Infrastructure Health section with CPU/Memory/Disk panels
- Add Service Status section with PM2/Docker panels
- Create GrafanaPanel component for iframe embedding
- Build passes successfully
This commit is contained in:
Bernt
2026-07-29 19:03:06 +00:00
parent af874040ca
commit e5623d2f84
77 changed files with 11338 additions and 779 deletions
+70
View File
@@ -0,0 +1,70 @@
package service
import (
"context"
"database/sql"
"fmt"
"boc/repository"
)
// LegalService handles business logic for legal operations
type LegalService struct {
repo *repository.LegalRepository
db *sql.DB
}
func NewLegalService(db *sql.DB) *LegalService {
return &LegalService{
repo: repository.NewLegalRepository(db),
db: db,
}
}
// ListContracts returns all contracts
func (s *LegalService) ListContracts(ctx context.Context) ([]repository.Contract, error) {
return s.repo.ListContracts(ctx)
}
// GetContract returns a single contract by ID
func (s *LegalService) GetContract(ctx context.Context, id string) (*repository.Contract, error) {
return s.repo.GetContract(ctx, id)
}
// CreateContract creates a new contract with validation
func (s *LegalService) CreateContract(ctx context.Context, c *repository.Contract) error {
if c.Title == "" {
return fmt.Errorf("contract title is required")
}
if c.Type == "" {
return fmt.Errorf("contract type is required")
}
if c.CustomerID == "" {
return fmt.Errorf("customer ID is required")
}
if c.Status == "" {
c.Status = "draft"
}
if c.Currency == "" {
c.Currency = "USD"
}
return s.repo.CreateContract(ctx, c)
}
// UpdateContract updates an existing contract
func (s *LegalService) UpdateContract(ctx context.Context, id string, c *repository.Contract) error {
if c.Title == "" {
return fmt.Errorf("contract title is required")
}
return s.repo.UpdateContract(ctx, id, c)
}
// ListTemplates returns all contract templates
func (s *LegalService) ListTemplates(ctx context.Context) ([]repository.ContractTemplate, error) {
return s.repo.ListTemplates(ctx)
}
// GetTemplate returns a single template by type
func (s *LegalService) GetTemplate(ctx context.Context, contractType string) (*repository.ContractTemplate, error) {
return s.repo.GetTemplate(ctx, contractType)
}