debug: Expose list of components to frontend

This commit is contained in:
Tom Wiesing 2022-10-19 16:31:13 +02:00
parent e17ab90269
commit e5cd57cb7d
No known key found for this signature in database
14 changed files with 307 additions and 14 deletions

View file

@ -10,12 +10,15 @@ import (
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/instances"
"github.com/FAU-CDI/wisski-distillery/pkg/httpx"
"github.com/FAU-CDI/wisski-distillery/pkg/lazy"
"github.com/tkw1536/goprogram/stream"
)
type Info struct {
component.Base
Analytics *lazy.PoolAnalytics
Exporter *exporter.Exporter
Instances *instances.Instances
SnapshotsLog *logger.Logger
@ -41,6 +44,12 @@ func (info *Info) Handler(route string, context context.Context, io stream.IOStr
Template: indexTemplate,
})
// add a handler for the component page
mux.Handle(route+"components", httpx.HTMLHandler[componentsPageContext]{
Handler: info.componentsPageAPI,
Template: componentsTemplate,
})
// add a handler for the instance page
mux.Handle(route+"instance/", httpx.HTMLHandler[instancePageContext]{
Handler: info.instancePageAPI,