cockroach: github.com/cockroachdb/cockroach/pkg/ui Index | Files | Directories

package ui

import "github.com/cockroachdb/cockroach/pkg/ui"

Package ui embeds the assets for the web UI into the Cockroach binary.

By default, it serves a stub web UI. Linking with distoss or distccl will replace the stubs with the OSS UI or the CCL UI, respectively. The exported symbols in this package are thus function pointers instead of functions so that they can be mutated by init hooks.

Index

Package Files

ui.go

Variables

var Asset func(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

var AssetDir func(name string) ([]string, error)

AssetDir returns the file names below a certain directory in the embedded filesystem.

For example, if the embedded filesystem contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

AssetDir("") returns []string{"data"} AssetDir("data") returns []string{"foo.txt", "img"} AssetDir("data/img") returns []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") return errors

var AssetInfo func(name string) (os.FileInfo, error)

AssetInfo loads and returns metadata for the asset with the given name. It returns an error if the asset could not be found or could not be loaded.

func Handler Uses

func Handler(cfg Config) http.Handler

Handler returns an http.Handler that serves the UI, including index.html, which has some login-related variables templated into it, as well as static assets.

type Config Uses

type Config struct {
    ExperimentalUseLogin bool
    LoginEnabled         bool
    NodeID               *base.NodeIDContainer
    GetUser              func(ctx context.Context) *string
}

Config contains the configuration parameters for Handler.

Directories

PathSynopsis
distcclPackage distccl embeds the assets for the CCL version of the web UI into the Cockroach binary.
distossPackage distoss embeds the assets for the OSS version of the web UI into the Cockroach binary.

Package ui imports 11 packages (graph) and is imported by 4 packages. Updated 2019-09-19. Refresh now. Tools for package owners.