Documentation
¶
Overview ¶
Package dashboard owns the dashboard snapshot: the service that assembles it from the container, project, image, volume and vulnerability domains, and the HTTP surface that serves it.
Index ¶
- func RegisterDashboard(api huma.API, dashboardService *DashboardService, ...)
- type DashboardActionItemsOptions
- type DashboardHandler
- func (h *DashboardHandler) GetDashboard(ctx context.Context, input *GetDashboardInput) (*GetDashboardOutput, error)
- func (h *DashboardHandler) RunLocalStreamProducer(ctx context.Context, debugAllGood bool, ...)
- func (h *DashboardHandler) RunRemoteStreamPollers(ctx context.Context, ps *authz.PermissionSet, debugAllGood bool, ...)
- type DashboardService
- type Dependencies
- type GetDashboardInput
- type GetDashboardOutput
- type Module
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterDashboard ¶
func RegisterDashboard(api huma.API, dashboardService *DashboardService, environmentService *environment.EnvironmentService)
Types ¶
type DashboardActionItemsOptions ¶
type DashboardActionItemsOptions struct {
DebugAllGood bool
}
type DashboardHandler ¶
type DashboardHandler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(dashboardService *DashboardService, environmentService *environment.EnvironmentService) *DashboardHandler
NewHandler builds the dashboard HTTP handler. Cross-domain handlers (the multiplexed client stream) compose it rather than reaching into its fields.
func (*DashboardHandler) GetDashboard ¶
func (h *DashboardHandler) GetDashboard(ctx context.Context, input *GetDashboardInput) (*GetDashboardOutput, error)
func (*DashboardHandler) RunLocalStreamProducer ¶
func (h *DashboardHandler) RunLocalStreamProducer(ctx context.Context, debugAllGood bool, events chan<- dashboardtypes.StreamEvent)
func (*DashboardHandler) RunRemoteStreamPollers ¶
func (h *DashboardHandler) RunRemoteStreamPollers(ctx context.Context, ps *authz.PermissionSet, debugAllGood bool, events chan<- dashboardtypes.StreamEvent)
RunRemoteStreamPollers keeps one poller goroutine per enabled remote environment, re-listing periodically so environments added or removed while the stream is open are picked up without a reconnect.
type DashboardService ¶
type DashboardService struct {
// contains filtered or unexported fields
}
func NewDashboardService ¶
func NewDashboardService( db *database.DB, dockerService *docker.DockerClientService, containerService *container.ContainerService, projectService *project.ProjectService, imageService *image.ImageService, settingsService *settings.SettingsService, vulnerabilityService *vulnerability.VulnerabilityService, environmentService *environment.EnvironmentService, versionService *version.VersionService, volumeService *volume.VolumeService, ) *DashboardService
func (*DashboardService) GetSnapshot ¶
func (s *DashboardService) GetSnapshot(ctx context.Context, options DashboardActionItemsOptions, includeTables bool) (*dashboardtypes.Snapshot, error)
GetSnapshot returns the dashboard snapshot, shared across all concurrent consumers (HTTP first paint + every stream subscriber) through a short-TTL cache; the result is a shared pointer and must not be mutated. includeTables controls whether the first-page container/image tables are built: stream subscribers pass false since the all-environments dashboard only reads the aggregate counters, skipping the per-container DTO builds, sorting, and icon resolution entirely.
type Dependencies ¶
type Dependencies struct {
DB *database.DB
Docker *docker.DockerClientService
Container *container.ContainerService
Project *project.ProjectService
Image *image.ImageService
Settings *settings.SettingsService
Vulnerability *vulnerability.VulnerabilityService
Environment *environment.EnvironmentService
Version *version.VersionService
Volume *volume.VolumeService
}
Dependencies are the collaborators the dashboard domain needs.
type GetDashboardInput ¶
type GetDashboardOutput ¶
type GetDashboardOutput struct {
Body base.ApiResponse[dashboardtypes.Snapshot]
}
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module is the dashboard domain's wiring seam: it owns the service and the handler, and mounts the domain's routes.
func New ¶
func New(deps Dependencies) *Module
New builds the dashboard domain from its dependencies.
func (*Module) Handler ¶
func (m *Module) Handler() *DashboardHandler
Handler exposes the dashboard stream producer.
func (*Module) RegisterRoutes ¶
RegisterRoutes mounts the dashboard endpoints. A nil module still registers, so OpenAPI spec generation can discover the routes without a service graph.
func (*Module) Service ¶
func (m *Module) Service() *DashboardService
Service exposes the dashboard service to collaborators that compose its producers, such as the multiplexed client stream.