renderables

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package renderables processes package vm structs and bundles them with the appropriate metadata, html templates, and scripts to create a fully functional web page.

Generally, Revere pages are created out of a top-level "viewmodel" Renderable interface that provides "sub-Renderables" out of the components it needs to display.

Rendering is done recursively from the top-level Renderable down to all of its sub-Renderables.

First, all sub-Renderables are recursively processed to create respective renderResults, which include the names of those Renderables (that the templates will use to access related data), the template files needed to build the skeleton HTML, javascript files, nested data objects to plug into the templates, and breadcrumbs.

Next, the sub-Renderables' renderResults are combined with those of the parent Renderable. This is done by first simply appending the child's templates, scripts, and breadcrumbs to those of the parent. The implementer specifies how the data will be added to the parent data - most Revere Renderables will use aggregatePipelineDataMap, which will add the child renderResult data as map entries into the parent renderResult, using child.name as the key. In case the template needs to access data in an array, sub-Renderable data can be aggregated using aggregatePipelineDataArray, which places all of the child data into a interface{} array in order of the corresponding positions in the sub-Renderables array, and added to the parent data object under the key "_Array".

Lastly the renderResult is returned (if the regular renderPropogate method is specified, which should be the default in most cases). In the cases of Probes, Resources, Targets, and Settings, go's template package will not allow dynamically-specified template files and requires an alternate solution. Calling renderPropagateImmediate on the renderPropagate step renders the entire Renderable into a template.HTML string, which is then added to the data object of the renderResult under the key "_Render". This way, a template can be dynamically specified, rendered into HTML, and inserted into the parent HTML template.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(w io.Writer, r Renderable) error

Render constructs an HTML document using a Renderable and writes it to the specified io.Writer.

func RenderPartial

func RenderPartial(r Renderable) (template.HTML, error)

RenderPartial constructs an HTML document using a Renderable, but returns the HTML as a string instead of writing it to an io.Writer.

Types

type ActiveIssues

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

func NewActiveIssues

func NewActiveIssues(ss []*vm.Subprobe, ls []*vm.Label, mls map[db.MonitorID][]*vm.MonitorLabel) *ActiveIssues

type LabelEdit

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

func NewLabelEdit

func NewLabelEdit(l *vm.Label, ms []*vm.Monitor) *LabelEdit

type LabelMonitorsEdit

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

func NewLabelMonitorsEdit

func NewLabelMonitorsEdit(lms []*vm.LabelMonitor, ms []*vm.Monitor) *LabelMonitorsEdit

type LabelMonitorsView

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

func NewLabelMonitorsView

func NewLabelMonitorsView(lms []*vm.LabelMonitor) *LabelMonitorsView

type LabelTriggerEdit

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

func NewLabelTriggerEdit

func NewLabelTriggerEdit(t *vm.LabelTrigger) *LabelTriggerEdit

type LabelTriggerView

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

func NewLabelTriggerView

func NewLabelTriggerView(t *vm.LabelTrigger) *LabelTriggerView

type LabelTriggersEdit

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

func NewLabelTriggersEdit

func NewLabelTriggersEdit(ts []*vm.LabelTrigger) *LabelTriggersEdit

type LabelTriggersView

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

func NewLabelTriggersView

func NewLabelTriggersView(ts []*vm.LabelTrigger) *LabelTriggersView

type LabelView

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

func NewLabelView

func NewLabelView(l *vm.Label, saveStatus []byte) *LabelView

type LabelsIndex

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

func NewLabelsIndex

func NewLabelsIndex(ss []*vm.Label) *LabelsIndex

type MonitorEdit

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

func NewMonitorEdit

func NewMonitorEdit(m *vm.Monitor, ls []*vm.Label) *MonitorEdit

type MonitorLabelsEdit

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

func NewMonitorLabelsEdit

func NewMonitorLabelsEdit(mls []*vm.MonitorLabel, ls []*vm.Label) *MonitorLabelsEdit

type MonitorLabelsView

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

func NewMonitorLabelsView

func NewMonitorLabelsView(mls []*vm.MonitorLabel) *MonitorLabelsView

type MonitorTriggerEdit

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

func NewMonitorTriggerEdit

func NewMonitorTriggerEdit(t *vm.MonitorTrigger) *MonitorTriggerEdit

type MonitorTriggerView

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

func NewMonitorTriggerView

func NewMonitorTriggerView(mt *vm.MonitorTrigger) *MonitorTriggerView

type MonitorTriggersEdit

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

func NewMonitorTriggersEdit

func NewMonitorTriggersEdit(mts []*vm.MonitorTrigger) *MonitorTriggersEdit

type MonitorTriggersView

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

func NewMonitorTriggersView

func NewMonitorTriggersView(mts []*vm.MonitorTrigger) *MonitorTriggersView

type MonitorView

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

func NewMonitorView

func NewMonitorView(m *vm.Monitor, saveStatus []byte) *MonitorView

type MonitorsIndex

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

func NewMonitorsIndex

func NewMonitorsIndex(ms []*vm.Monitor, ls []*vm.Label) *MonitorsIndex

type ProbeEdit

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

func NewProbeEdit

func NewProbeEdit(p probe.VM) *ProbeEdit

type ProbePreview

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

func NewProbePreview

func NewProbePreview(probe probe.VM) *ProbePreview

type ProbeView

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

func NewProbeView

func NewProbeView(p probe.VM) *ProbeView

type Renderable

type Renderable interface {
	// contains filtered or unexported methods
}

The Renderable interface allows implementations to specify all required files in order to generate a web page.

type ResourceView

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

func NewResourceView

func NewResourceView(ds *resource.VM) *ResourceView

type ResourcesIndex

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

func NewResourcesIndex

func NewResourcesIndex(dss []*resource.VM, saveStatus []byte) *ResourcesIndex

type SettingEdit

type SettingEdit struct {
	*setting.VM
}

func NewSettingEdit

func NewSettingEdit(s *setting.VM) *SettingEdit

type SettingsIndex

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

func NewSettingsIndex

func NewSettingsIndex(ss []*setting.VM, saveStatus []byte) *SettingsIndex

type SilenceEdit

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

func NewSilenceEdit

func NewSilenceEdit(s *vm.Silence, ms []*vm.Monitor) *SilenceEdit

type SilenceView

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

func NewSilenceView

func NewSilenceView(s *vm.Silence, saveStatus []byte) *SilenceView

type SilencesIndex

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

func NewSilencesIndex

func NewSilencesIndex(ss []*vm.Silence) *SilencesIndex

type SubprobeView

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

func NewSubprobeView

func NewSubprobeView(p probe.VM, s *vm.Subprobe, rs []*vm.Reading) *SubprobeView

type SubprobesIndex

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

func NewSubprobesIndex

func NewSubprobesIndex(ss []*vm.Subprobe, m *vm.Monitor) *SubprobesIndex

type TargetEdit

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

func NewTargetEdit

func NewTargetEdit(t target.VM) *TargetEdit

type TargetView

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

func NewTargetView

func NewTargetView(t target.VM) *TargetView

Jump to

Keyboard shortcuts

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