Documentation
¶
Index ¶
- Variables
- func NewRouter(opts Options) http.Handler
- func SPAHandler(fsys fs.FS, basePath string, telemetryEnabled bool, version string, ...) http.Handler
- type ActorRow
- type Capabilities
- type Options
- type Server
- type StoreInfo
- type StoreRegistry
- type SubscriptionRow
- type TargetResolver
- type WorkflowBackend
- type WorkflowRemover
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnsupportedStoreType = errors.New("unsupported state store type") ErrStoreValidation = errors.New("invalid store request") // ErrActiveStore rejects deleting the elected active store (mapped to 409). ErrActiveStore = errors.New("cannot remove the active workflow state store") )
ErrUnsupportedStoreType / ErrStoreValidation map validation failures to 400.
Functions ¶
func SPAHandler ¶
func SPAHandler(fsys fs.FS, basePath string, telemetryEnabled bool, version string, caps Capabilities) http.Handler
SPAHandler serves static assets from fsys and falls back to index.html for unknown paths so client-side (History-API) routing works. basePath is the optional subpath the app is mounted under ("" for root). telemetryEnabled is injected into the served index.html as window.__DASH_TELEMETRY_ENABLED__ so the front-end knows whether to load Datadog RUM. version is injected as window.__DASH_VERSION__ so RUM can tag events with the build version, and caps as window.__DASH_CAPABILITIES__ so the front-end can hide UI for routes the server has gated off.
Types ¶
type ActorRow ¶
type ActorRow struct {
AppID string `json:"appId"`
InstanceKey string `json:"instanceKey"`
Type string `json:"type"`
Count int `json:"count"`
Placement string `json:"placement,omitempty"`
}
ActorRow is a single actor-type entry returned by GET /api/actors.
type Capabilities ¶ added in v0.0.9
type Capabilities struct {
Lifecycle bool `json:"lifecycle"`
ControlPlane bool `json:"controlPlane"`
Logs bool `json:"logs"`
Workflows bool `json:"workflows"`
// Mode echoes the CLI --mode value ("" = complete scan) so the SPA can
// adapt static fallbacks (e.g. the Logs page's dapr_* targets) to the
// server's discovery filter.
Mode string `json:"mode"`
}
Capabilities gates optional feature surfaces per serving mode. The JSON form is injected into the SPA as window.__DASH_CAPABILITIES__; the same flags gate server-side route registration (the flags are advisory UX for the UI; absent routes are the real boundary).
func FullCapabilities ¶ added in v0.0.9
func FullCapabilities() Capabilities
FullCapabilities is the host-mode default: everything on.
type Options ¶
type Options struct {
BasePath string // "" or e.g. "/dashboard"
DistFS fs.FS // embedded SPA assets (contains index.html)
Version version.Info
Apps discovery.Service
// ContainerLogs streams container logs for compose-discovered apps.
// nil disables container log streaming (404 for those apps).
ContainerLogs func(ctx context.Context, containerID string) (<-chan string, error)
// Lifecycle starts/stops/restarts discovered apps; nil disables the
// POST /api/apps/{key}/{target}/{action} route.
Lifecycle lifecycle.Manager
Backend WorkflowBackend
Stores StoreRegistry
Resources resources.Service
News news.Service
ControlPlane controlplane.Manager
UpdateCheck updatecheck.Service
// TelemetryEnabled controls whether the served SPA loads Datadog RUM.
TelemetryEnabled bool
// AllowNonLoopback switches the request guard from the loopback
// allowlist to same-origin CSRF (aspire/container mode, where the
// dashboard is reached through a proxy on an arbitrary host).
AllowNonLoopback bool
// AllowedHosts, when non-empty in container posture, restricts the Host
// header to these hostnames (loopback names always allowed); empty means
// any Host passes. Populated from DEVDASHBOARD_ALLOWED_HOSTS.
AllowedHosts []string
// ListenPort is the server's listen port, used to normalize a portless
// Host header when comparing Origin against Host in container posture.
ListenPort int
// Capabilities gates optional feature routes and the SPA's capability
// flags; nil means FullCapabilities (host mode).
Capabilities *Capabilities
}
Options configures the HTTP router.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server owns the http.Server lifecycle.
type StoreInfo ¶
type StoreInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Source string `json:"source"` // "auto" | "manual"
Path string `json:"path"`
Active bool `json:"active"`
Connection string `json:"connection"` // secrets-free host/db summary for display
UpdatedAt time.Time `json:"updatedAt"` // last added/updated; drives panel recency order
}
StoreInfo describes one registry connection. ID is the stable, URL-safe key the API/selection address it by; Name is the human-facing label.
type StoreRegistry ¶
type StoreRegistry interface {
Stores() []StoreInfo
AddStore(name, typ string, metadata map[string]string) error
UpdateStore(id, name, typ string, metadata map[string]string) (string, error)
DeleteStore(id string) error
}
StoreRegistry exposes the persisted connection registry to the API: listing all entries and adding/updating/deleting manual connections.
type SubscriptionRow ¶
type SubscriptionRow struct {
AppID string `json:"appId"`
InstanceKey string `json:"instanceKey"`
PubsubName string `json:"pubsubName"`
Topic string `json:"topic"`
Rules []discovery.SubRule `json:"rules,omitempty"`
DeadLetterTopic string `json:"deadLetterTopic,omitempty"`
Type string `json:"type,omitempty"`
Reachable bool `json:"reachable"`
}
SubscriptionRow is a single subscription entry returned by GET /api/subscriptions.
type TargetResolver ¶
type TargetResolver interface {
Resolve(ctx context.Context, appID, instanceID string) (workflow.RemoveTarget, error)
}
TargetResolver resolves an (appID, instanceID) pair into a RemoveTarget. Implemented in cmd (Task 13) by combining discovery.Service + workflow.Service.
type WorkflowBackend ¶
type WorkflowBackend interface {
ServiceFor(store string) (svc workflow.Service, rem WorkflowRemover, targets TargetResolver, ok bool)
}
WorkflowBackend selects the workflow service/remover/resolver for a named state store. An empty name selects the active store; ok=false means the named store is unknown.
type WorkflowRemover ¶
type WorkflowRemover interface {
RemoveMany(ctx context.Context, targets []workflow.RemoveTarget, force bool) []workflow.RemoveResult
}
WorkflowRemover is the removal surface the API needs (impl: *workflow.Remover).