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.SectionHead("Available Exports", fmt.Sprintf("%d files", len(entries)))
| Snapshot |
Records |
Download |
for i, entry := range entries {
if entry.Group != "" && (i == 0 || entries[i-1].Group != entry.Group) {
| { entry.Group } |
}
|
{ entry.Label }
|
{ entry.Count } records
|
Download XLSX
|
}
@core.Footer()
}
templ VcenterList(links []VcenterLink) {
@core.Header()
@core.SectionHead("vCenters", fmt.Sprintf("%d total", len(links)))
| vCenter |
Totals |
for _, link := range links {
| { link.Name } |
View Totals
|
}
@core.Footer()
}
templ VcenterTotalsPage(vcenter string, entries []VcenterTotalsEntry, chart VcenterChartData, meta VcenterTotalsMeta) {
@core.Header()
@core.SectionHead(meta.TypeLabel+" Snapshots", fmt.Sprintf("%d records", len(entries)))
if chart.ConfigJSON != "" {
}
| Snapshot Time |
VMs |
vCPUs |
RAM (GB) |
for _, entry := range entries {
| { entry.Snapshot } |
{ entry.VmCount } |
{ entry.VcpuTotal } |
{ entry.RamTotalGB } |
}
@core.Footer()
}