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.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 } |
}
}
| Snapshot |
VM Name |
VmId |
VmUuid |
Vcenter |
Resource Pool |
vCPUs |
RAM (GB) |
Disk |
for _, e := range entries {
| { e.Snapshot } |
{ e.Name } |
{ e.VmId } |
{ e.VmUuid } |
{ e.Vcenter } |
{ e.ResourcePool } |
{ e.VcpuCount } |
{ e.RamGB } |
{ fmt.Sprintf("%.1f", e.ProvisionedDisk) } |
}
@core.Footer()
}