Add UI console and spare forecast naming
This commit is contained in:
89
internal/api/ui_index.tmpl
Normal file
89
internal/api/ui_index.tmpl
Normal file
@@ -0,0 +1,89 @@
|
||||
{{define "index"}}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
{{template "head" .}}
|
||||
<body>
|
||||
{{template "topbar" .}}
|
||||
|
||||
<main class="container">
|
||||
<section class="card">
|
||||
<h2>Registry Snapshot</h2>
|
||||
<div class="stats">
|
||||
<div class="stat"><span>Customers</span><strong>{{.CustomerCount}}</strong></div>
|
||||
<div class="stat"><span>Projects</span><strong>{{.ProjectCount}}</strong></div>
|
||||
<div class="stat"><span>Assets</span><strong>{{.AssetCount}}</strong></div>
|
||||
<div class="stat"><span>Components</span><strong>{{.ComponentCount}}</strong></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Latest Assets</h2>
|
||||
{{if .Assets}}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Vendor Serial</th>
|
||||
<th>Project</th>
|
||||
<th>Location</th>
|
||||
<th>Created</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range $i, $item := .Assets}}
|
||||
{{if lt $i 5}}
|
||||
<tr>
|
||||
<td><a href="/ui/assets/{{$item.ID}}">{{$item.ID}}</a></td>
|
||||
<td>{{$item.Name}}</td>
|
||||
<td>{{$item.VendorSerial}}</td>
|
||||
<td>{{$item.ProjectID}}</td>
|
||||
<td>{{if $item.LocationID}}{{$item.LocationID}}{{else}}—{{end}}</td>
|
||||
<td>{{formatTime $item.CreatedAt}}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{else}}
|
||||
<div class="meta">No assets yet.</div>
|
||||
{{end}}
|
||||
<div class="meta"><a href="/ui/assets">View all assets</a></div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Latest Components</h2>
|
||||
{{if .Components}}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Vendor Serial</th>
|
||||
<th>Lot</th>
|
||||
<th>First Seen</th>
|
||||
<th>Created</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range $i, $item := .Components}}
|
||||
{{if lt $i 5}}
|
||||
<tr>
|
||||
<td><a href="/ui/components/{{$item.ID}}">{{$item.ID}}</a></td>
|
||||
<td>{{$item.VendorSerial}}</td>
|
||||
<td>{{if $item.LotID}}{{$item.LotID}}{{else}}—{{end}}</td>
|
||||
<td>{{formatTimePtr $item.FirstSeenAt}}</td>
|
||||
<td>{{formatTime $item.CreatedAt}}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{else}}
|
||||
<div class="meta">No components yet.</div>
|
||||
{{end}}
|
||||
<div class="meta"><a href="/ui/components">View all components</a></div>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user