ui

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Template = template.New("").Funcs(template.FuncMap{
	"Ns":            func(i uint64) string { return time.Duration(i).String() },
	"FloatFormat32": func(i float32) string { return strconv.FormatFloat(float64(i), 'f', 4, 64) },
	"FloatFormat64": func(i float64) string { return strconv.FormatFloat(float64(i), 'f', 3, 64) },
	"Bytes":         func(i uint64) string { return string(toBytes(float64(i))) },
	"Bytes32":       func(i uint32) string { return string(toBytes(float64(i))) },
	"ToString":      func(v reflect.Value) string { return v.MethodByName("String").Call(nil)[0].String() },
	"Time":          func(t uint64) string { return time.Unix(0, int64(t)).String() },
	"Sub":           func(i, i2 uint64) uint64 { return i - i2 },
	"Div":           func(i uint64, i2 uint32) uint64 { return i / uint64(i2) },
	"TryGetTime": func(t1, t2 time.Time, d time.Duration) string {
		if !t1.IsZero() {
			return t1.String()
		} else if !t2.IsZero() && d != 0 {
			return t2.Add(-d).String()
		}
		return "Unknown"
	},
	"UnRingBuffer": func(v [256]uint64, i uint32) string {
		c := (i + 255) % 256
		w := append(append([]uint64{}, v[:c+1]...), v[c+1:]...)
		ret := ""
		for i, x := range w {
			if x == 0 {
				break
			}
			if i%50 == 0 {
				ret += "\n" + strings.Repeat(" ", 11)
			} else {
				ret += "  "
			}
			ret += time.Duration(x).String()
		}
		return ret
	},
},
)

Template the page template

Functions

func Run added in v1.1.0

func Run(r io.Reader, port int, openBrowser bool) error

Run runs the web ui

Types

type UI

type UI struct {
	// contains filtered or unexported fields
}

UI ui

func (*UI) Exit

func (u *UI) Exit() error

Exit returns when the server exits

func (*UI) Init added in v1.1.0

func (u *UI) Init(data *internal.CrashReport) error

Init initializes the ui

func (*UI) Run

func (u *UI) Run() (exit chan error, err error)

Run run the ui

func (*UI) Stop

func (u *UI) Stop() (err error)

Stop stop the server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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