Documentation
¶
Overview ¶
Package flowmap is the relay's live flow-map page: a view model fed by FlowLogService.WatchFlowMap updates, drawn with go-widgets' GraphView. The view model and the scene are plain Go, tested natively; package main in ./wasm wires them to the browser.
Index ¶
- Constants
- type Event
- type Scene
- func (s *Scene) AnimationStep(float64) bool
- func (s *Scene) Char(string) bool
- func (s *Scene) Click(x, y int) bool
- func (s *Scene) Context(int, int) bool
- func (s *Scene) Draw(buf []byte)
- func (s *Scene) Graph() *toolkit.GraphView
- func (s *Scene) KeyDown(k string) bool
- func (s *Scene) Move(int, int) bool
- func (s *Scene) Post(u *v1.FlowMapUpdate)
- func (s *Scene) Release(int, int) bool
- func (s *Scene) Resize(w, h int) (int, int)
- func (s *Scene) SetFilter(f string)
- func (s *Scene) Size() (int, int)
- type State
- type VM
Constants ¶
const MaxEvents = 200
MaxEvents bounds the event log the page keeps.
const PanelW = 360
PanelW is the width of the details panel on the right.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scene ¶
type Scene struct {
VM *VM
Theme *toolkit.Theme
// OnChange is called after the view model changed (the page publishes
// its state for tests and updates the status line).
OnChange func()
// contains filtered or unexported fields
}
Scene is the page: the graph on the left, the selection's details and the event log on the right. It implements webcanvas.App, Animator and Resizer.
func (*Scene) AnimationStep ¶
AnimationStep applies what arrived since the last frame. Only the newest map is drawn, but every update's events are kept.
func (*Scene) Move ¶
Move, Release, Context and Char do nothing on this page (the filter is an HTML input outside the canvas, so dead keys and IMEs work in it).
func (*Scene) Post ¶
func (s *Scene) Post(u *v1.FlowMapUpdate)
Post queues an update from any goroutine; AnimationStep applies it on the UI goroutine.
type State ¶
type State struct {
Seq uint64 `json:"seq"`
Status string `json:"status"`
Clusters []string `json:"clusters"`
Nodes []string `json:"nodes"`
Edges []string `json:"edges"`
Denied []string `json:"denied"`
Selected string `json:"selected"`
Filter string `json:"filter"`
Events []string `json:"events"`
}
State is what the page exposes to its tests: the view model, not pixels.
type VM ¶
type VM struct {
Graph *toolkit.GraphViewModel
Events []Event
// Status is the line under the title: connection and counts.
Status string
Seq uint64
// contains filtered or unexported fields
}
VM is the page's view model. Graph is what the GraphView draws; the other fields feed the details panel. Apply is called on the UI goroutine.
func (*VM) Apply ¶
func (vm *VM) Apply(u *v1.FlowMapUpdate)
Apply takes one update. Clusters and nodes are rebuilt only when their set changed (so the GraphView keeps its layout); edges are replaced every time.
Directories
¶
| Path | Synopsis |
|---|---|
|
Command wasm is the flow-map page's WebAssembly: it reads the page's configuration (class, ticket or session token, from the URL fragment, set by flowmap.js), streams FlowLogService.WatchFlowMap from the relay that served the page, and runs the scene on the canvas.
|
Command wasm is the flow-map page's WebAssembly: it reads the page's configuration (class, ticket or session token, from the URL fragment, set by flowmap.js), streams FlowLogService.WatchFlowMap from the relay that served the page, and runs the scene on the canvas. |