ui

package module
v0.0.0-...-e66f6d6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

README

The ui directory contains static files and templates used in the web UI. For easier distribution they are statically compiled into the Prometheus binary using the vfsgen library (c.f. Makefile).

During development it is more convenient to always use the files on disk to directly see changes without recompiling. To make this work, remove the builtinassets build tag in the flags entry in .promu.yml, and then make build (or build Prometheus using go build ./cmd/prometheus).

This will serve all files from your local filesystem. This is for development purposes only.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Assets = func() http.FileSystem {
	wd, err := os.Getwd()
	if err != nil {
		panic(err)
	}
	var assetsPrefix string
	switch filepath.Base(wd) {
	case "prometheus":

		assetsPrefix = "./web/ui"
	case "web":

		assetsPrefix = "./ui"
	case "ui":

		assetsPrefix = "./"
	}

	static := filter.Keep(
		http.Dir(path.Join(assetsPrefix, "static")),
		func(path string, fi os.FileInfo) bool {
			return fi.IsDir() ||
				(!strings.HasSuffix(path, "map.js") &&
					!strings.HasSuffix(path, "/bootstrap.js") &&
					!strings.HasSuffix(path, "/bootstrap-theme.css") &&
					!strings.HasSuffix(path, "/bootstrap.css"))
		},
	)

	templates := filter.Keep(
		http.Dir(path.Join(assetsPrefix, "templates")),
		func(path string, fi os.FileInfo) bool {
			return fi.IsDir() || strings.HasSuffix(path, ".html")
		},
	)

	return union.New(map[string]http.FileSystem{
		"/templates": templates,
		"/static":    static,
	})
}()

Assets contains the project's assets.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL