package views import ( "fmt" "vctp/components/core" ) type VmTraceEntry struct { Snapshot string RawTime int64 Name string VmId string VmUuid string Vcenter string ResourcePool string VcpuCount int64 RamGB int64 ProvisionedDisk float64 CreationTime string DeletionTime string } type VmTraceChart struct { ConfigJSON string } type VmTraceMeta struct { ViewType string TypeLabel string HourlyLink string DailyLink string HourlyClass string DailyClass string } type VmTraceDiagnosticLine struct { Label string Value string } type VmTraceDiagnostics struct { Visible bool Lines []VmTraceDiagnosticLine } templ VmTracePage(query string, display_query string, vm_id string, vm_uuid string, vm_name string, creationLabel string, deletionLabel string, creationApprox bool, entries []VmTraceEntry, chart VmTraceChart, meta VmTraceMeta, diagnostics VmTraceDiagnostics) { @core.Header()
@core.PageHeader( "VM Trace", "Snapshot history"+display_query, "Timeline of vCPU, RAM, and resource pool changes across "+meta.TypeLabel+" snapshots.", []core.ActionLink{ { Label: "Dashboard", Href: "/", Class: "web2-button secondary", }, }, )
Clear
@core.SegmentedActions( []core.SegmentedLink{ { Label: "Hourly Detail", Href: meta.HourlyLink, Class: meta.HourlyClass, }, { Label: "Daily Aggregated", Href: meta.DailyLink, Class: meta.DailyClass, }, }, )
@core.SectionHead(meta.TypeLabel+" Timeline", fmt.Sprintf("%d samples", len(entries))) if chart.ConfigJSON != "" {
}

Creation Time

{ creationLabel }

if creationApprox {

Approximate (earliest snapshot)

}

Deletion Time

{ deletionLabel }

if diagnostics.Visible && len(diagnostics.Lines) > 0 {
Lifecycle diagnostics
for _, line := range diagnostics.Lines { }
{ line.Label } { line.Value }
}
for _, e := range entries { }
Snapshot VM Name VmId VmUuid Vcenter Resource Pool vCPUs RAM (GB) Disk
{ e.Snapshot } { e.Name } { e.VmId } { e.VmUuid } { e.Vcenter } { e.ResourcePool } { e.VcpuCount } { e.RamGB } { fmt.Sprintf("%.1f", e.ProvisionedDisk) }
@core.Footer() }