Files
core/internal/api/ui_index.tmpl

80 lines
2.7 KiB
Cheetah

{{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>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" data-disable-auto-filters="true">
<thead>
<tr>
<th>Status</th>
<th>Name</th>
<th>Vendor Serial</th>
<th>Created</th>
</tr>
</thead>
<tbody>
{{range $item := .Assets}}
<tr class="clickable" onclick="navigateToRow('{{assetUIURL $item}}')">
<td><span class="badge {{assetStatusClass (index $.AssetStatusByID $item.ID)}}">{{assetStatusText (index $.AssetStatusByID $item.ID)}}</span></td>
<td>{{$item.Name}}</td>
<td>{{$item.VendorSerial}}</td>
<td title="{{formatTimeFull $item.CreatedAt}}">{{formatTime $item.CreatedAt}}</td>
</tr>
{{end}}
</tbody>
</table>
{{template "pagination" .AssetsPager}}
{{else}}
<div class="meta">No assets yet.</div>
{{end}}
<div class="meta"><a href="/ui/asset">View all asset</a></div>
</section>
<section class="card">
<h2>Latest Components</h2>
{{if .Components}}
<table class="table" data-disable-auto-filters="true">
<thead>
<tr>
<th>Status</th>
<th>Vendor Serial</th>
<th>First Seen</th>
<th>Created</th>
</tr>
</thead>
<tbody>
{{range $item := .Components}}
<tr class="clickable" onclick="navigateToRow('{{componentUIURL $item}}')">
<td><span class="badge {{componentStatusClass (index $.ComponentStatusByID $item.ID)}}">{{componentStatusText (index $.ComponentStatusByID $item.ID)}}</span></td>
<td>{{componentLabelByID $item.ID $.ComponentLabelByID}}</td>
<td title="{{formatTimePtrFull $item.FirstSeenAt}}">{{formatTimePtr $item.FirstSeenAt}}</td>
<td title="{{formatTimeFull $item.CreatedAt}}">{{formatTime $item.CreatedAt}}</td>
</tr>
{{end}}
</tbody>
</table>
{{template "pagination" .ComponentsPager}}
{{else}}
<div class="meta">No components yet.</div>
{{end}}
<div class="meta"><a href="/ui/component">View all component</a></div>
</section>
</main>
</body>
</html>
{{end}}