112 lines
2.8 KiB
HTML
112 lines
2.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>{{ .Title }}</title>
|
|
<link rel="stylesheet" href="/static/view.css">
|
|
</head>
|
|
<body>
|
|
<header class="page-header">
|
|
<div>
|
|
<h1>{{ .Title }}</h1>
|
|
<p>Read-only viewer for Reanimator JSON snapshots</p>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="page-main">
|
|
<section class="input-panel">
|
|
<form method="post" action="/render">
|
|
<label for="snapshot" class="input-label">Snapshot JSON</label>
|
|
<textarea id="snapshot" name="snapshot" spellcheck="false" placeholder='{"target_host":"...","hardware":{...}}'>{{ .InputJSON }}</textarea>
|
|
<div class="input-actions">
|
|
<button type="submit">Render Snapshot</button>
|
|
</div>
|
|
</form>
|
|
{{ if .Error }}
|
|
<div class="error-box">{{ .Error }}</div>
|
|
{{ end }}
|
|
</section>
|
|
|
|
{{ if .HasSnapshot }}
|
|
<section class="meta-panel">
|
|
<h2>Snapshot Metadata</h2>
|
|
<table class="kv-table">
|
|
<tbody>
|
|
{{ range .Meta }}
|
|
<tr>
|
|
<th>{{ .Key }}</th>
|
|
<td>{{ .Value }}</td>
|
|
</tr>
|
|
{{ end }}
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
|
|
<nav class="section-nav">
|
|
{{ range .Sections }}
|
|
<a href="#{{ .ID }}">{{ .Title }}</a>
|
|
{{ end }}
|
|
</nav>
|
|
|
|
{{ range .Sections }}
|
|
<section class="section-card" id="{{ .ID }}">
|
|
<h2>{{ .Title }}</h2>
|
|
|
|
{{ if eq .Kind "object" }}
|
|
<table class="kv-table">
|
|
<tbody>
|
|
{{ range .Rows }}
|
|
<tr>
|
|
<th>{{ .Key }}</th>
|
|
<td>
|
|
{{ range joinLines .Value }}
|
|
<div>{{ . }}</div>
|
|
{{ end }}
|
|
</td>
|
|
</tr>
|
|
{{ end }}
|
|
</tbody>
|
|
</table>
|
|
{{ end }}
|
|
|
|
{{ if eq .Kind "table" }}
|
|
{{ $section := . }}
|
|
<div class="table-wrap">
|
|
<table class="data-table">
|
|
<thead>
|
|
<tr>
|
|
{{ range .Columns }}
|
|
<th>{{ . }}</th>
|
|
{{ end }}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{ range .Items }}
|
|
<tr>
|
|
{{ $row := . }}
|
|
{{ range $section.Columns }}
|
|
<td>
|
|
{{ $value := index $row.Cells . }}
|
|
{{ if eq . "status" }}
|
|
<span class="status-badge {{ statusClass $value }}">{{ $value }}</span>
|
|
{{ else }}
|
|
{{ range joinLines $value }}
|
|
<div>{{ . }}</div>
|
|
{{ end }}
|
|
{{ end }}
|
|
</td>
|
|
{{ end }}
|
|
</tr>
|
|
{{ end }}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{{ end }}
|
|
</section>
|
|
{{ end }}
|
|
{{ end }}
|
|
</main>
|
|
</body>
|
|
</html>
|