package views import ( "fmt" "vctp/components/core" ) type SnapshotEntry struct { Label string Link string Count int64 Group string } type VcenterLink struct { Name string Link string } type VcenterTotalsEntry struct { Snapshot string RawTime int64 VmCount int64 VcpuTotal int64 RamTotalGB int64 } type VcenterTotalsMeta struct { ViewType string TypeLabel string HourlyLink string DailyLink string HourlyClass string DailyClass string } type VcenterChartData struct { ConfigJSON string } templ SnapshotHourlyList(entries []SnapshotEntry) { @SnapshotListPage("Hourly Inventory Snapshots", "inventory snapshots captured hourly", entries) } templ SnapshotDailyList(entries []SnapshotEntry) { @SnapshotListPage("Daily Inventory Snapshots", "daily summaries of hourly inventory snapshots", entries) } templ SnapshotMonthlyList(entries []SnapshotEntry) { @SnapshotListPage("Monthly Inventory Snapshots", "monthly summary aggregated from daily snapshots", entries) } templ SnapshotListPage(title string, subtitle string, entries []SnapshotEntry) { @core.Header()
@core.PageHeader( "Snapshot Library", title, subtitle, []core.ActionLink{ { Label: "Back to Dashboard", Href: "/", Class: "web2-button secondary", }, }, )
@core.SectionHead("Available Exports", fmt.Sprintf("%d files", len(entries)))
for i, entry := range entries { if entry.Group != "" && (i == 0 || entries[i-1].Group != entry.Group) { } }
Snapshot Records Download
{ entry.Group }
{ entry.Label }
{ entry.Count } records Download XLSX
@core.Footer() } templ VcenterList(links []VcenterLink) { @core.Header()
@core.PageHeader( "vCenter Inventory", "Monitored vCenters", "Select a vCenter to view snapshot totals over time.", []core.ActionLink{ { Label: "Back to Dashboard", Href: "/", Class: "web2-button secondary", }, }, )
@core.SectionHead("vCenters", fmt.Sprintf("%d total", len(links)))
for _, link := range links { }
vCenter Totals
{ link.Name } View Totals
@core.Footer() } templ VcenterTotalsPage(vcenter string, entries []VcenterTotalsEntry, chart VcenterChartData, meta VcenterTotalsMeta) { @core.Header()
@core.PageHeader( "vCenter Totals", "Totals for "+vcenter, meta.TypeLabel+" snapshots of VM count, vCPU, and RAM over time.", []core.ActionLink{ { Label: "All vCenters", Href: "/vcenters", Class: "web2-button secondary", }, { Label: "Dashboard", Href: "/", Class: "web2-button", }, }, ) @core.SegmentedActions( []core.SegmentedLink{ { Label: "Hourly Detail (45d)", Href: meta.HourlyLink, Class: meta.HourlyClass, }, { Label: "Daily Aggregated", Href: meta.DailyLink, Class: meta.DailyClass, }, }, )
@core.SectionHead(meta.TypeLabel+" Snapshots", fmt.Sprintf("%d records", len(entries))) if chart.ConfigJSON != "" {
}
for _, entry := range entries { }
Snapshot Time VMs vCPUs RAM (GB)
{ entry.Snapshot } { entry.VmCount } { entry.VcpuTotal } { entry.RamTotalGB }
@core.Footer() }