github.com/thanos-io/thanos@v0.32.5/pkg/ui/bucket.go (about) 1 // Copyright (c) The Thanos Authors. 2 // Licensed under the Apache License 2.0. 3 4 package ui 5 6 import ( 7 "github.com/go-kit/log" 8 "github.com/prometheus/common/route" 9 10 "github.com/thanos-io/thanos/pkg/component" 11 extpromhttp "github.com/thanos-io/thanos/pkg/extprom/http" 12 ) 13 14 // Bucket is a web UI representing state of buckets as a timeline. 15 type Bucket struct { 16 *BaseUI 17 18 externalPrefix, prefixHeader string 19 Err error 20 } 21 22 func NewBucketUI(logger log.Logger, externalPrefix, prefixHeader string, comp component.Component) *Bucket { 23 tmplVariables := map[string]string{ 24 "Component": comp.String(), 25 } 26 27 tmplFuncs := queryTmplFuncs() 28 29 return &Bucket{ 30 BaseUI: NewBaseUI(log.With(logger, "component", "bucketUI"), tmplFuncs, tmplVariables, externalPrefix, prefixHeader, comp), 31 externalPrefix: externalPrefix, 32 prefixHeader: prefixHeader, 33 } 34 } 35 36 // Register registers http routes for bucket UI. 37 func (b *Bucket) Register(r *route.Router, ins extpromhttp.InstrumentationMiddleware) { 38 registerReactApp(r, ins, b.BaseUI) 39 }