nano-run/templates/unit-info.html

280 lines
13 KiB
HTML
Raw Normal View History

2020-09-28 15:12:57 +00:00
<html lang="en">
<head>
2020-10-01 13:09:40 +00:00
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
2020-09-28 15:12:57 +00:00
</head>
2020-09-28 13:46:37 +00:00
<body>
2020-10-01 13:09:40 +00:00
<div class="container">
<nav class="navbar navbar-expand-sm navbar-light bg-light">
<a class="navbar-brand" href="{{.Rel "/"}}">Nano-Run</a>
<div class="collapse navbar-collapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="{{.Rel "/unit/"}}">All units</a>
</li>
2020-11-07 15:04:40 +00:00
<li class="nav-item">
<a class="nav-link" href="{{.Rel "/cron/"}}">All schedules</a>
</li>
2020-10-01 13:09:40 +00:00
{{if .Authorized}}
<li class="nav-item">
<a class="nav-link" href="{{.Rel "/auth/logout"}}">Logout</a>
2020-09-28 15:12:57 +00:00
</li>
2020-10-01 13:09:40 +00:00
{{end}}
</ul>
</div>
<span class="navbar-text">{{.Login}}</span>
</nav>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{.Rel "/unit/"}}" title="all units">units</a></li>
<li class="breadcrumb-item active" title="unit">{{.Unit.Name}}</li>
</ol>
</nav>
<div class="row">
<div class="col">
<div class="card">
<div class="card-body">
2020-11-08 11:00:03 +00:00
<h5 class="card-title">
{{if .Unit.Private}}<span title="not exposed over API">🏠</span>
{{else if .Unit.Secured}}<span title="with authorization">🛡️</span>
{{end}}
{{.Unit.Name}}
</h5>
2020-10-01 13:09:40 +00:00
<h6 class="card-subtitle mb-2 text-muted">Configuration</h6>
<div class="card-text">
<dl class="row">
2020-11-08 11:00:03 +00:00
{{- if .Unit.Private}}
<dt class="col-sm-3">Private</dt>
<dd class="col-sm-9"><b>yes</b><i> - not exposed over API</i></dd>
{{- else}}
<dt class="col-sm-3">API endpoint</dt>
<dd class="col-sm-9">
<code>
<noscript>JS required to detect API url</noscript>
<script>document.write((new URL("../../../api/{{.Unit.Name}}/", window.location).href))</script>
</code>
</dd>
{{- end}}
2020-10-01 13:09:40 +00:00
<dt class="col-sm-3">Mode</dt>
<dd class="col-sm-9">{{.Unit.Mode}}</dd>
<dt class="col-sm-3">Concurrency</dt>
<dd class="col-sm-9">{{.Unit.Workers}}</dd>
<dt class="col-sm-3">Attempts</dt>
<dd class="col-sm-9">{{.Unit.Attempts}}</dd>
<dt class="col-sm-3">Interval</dt>
<dd class="col-sm-9">{{.Unit.Interval}}</dd>
2020-10-09 11:37:41 +00:00
{{if eq .Unit.Mode "bin"}}
<dt class="col-sm-3" title="Timeout after which process will be sent">Timeout</dt>
<dd class="col-sm-9">
{{with .Unit.Timeout}}
{{.}}
{{else}}
{{end}}
</dd>
<dt class="col-sm-3" title="Timeout after which SIGINT will be sent">Graceful timeout
</dt>
<dd class="col-sm-9">
{{with .Unit.GracefulTimeout}}
{{.}}
{{else}}
{{end}}
</dd>
{{end}}
2020-10-01 13:09:40 +00:00
<dt class="col-sm-3">Max request size</dt>
<dd class="col-sm-9">
{{with .Unit.MaxRequest}}
{{.}}
{{else}}
{{end}}
</dd>
<dt class="col-sm-3">Working directory</dt>
<dd class="col-sm-9">
{{with .Unit.WorkDir}}
<sup>static</sup>
<span style="overflow-x: auto; word-break: break-all">{{.}}</span>
{{else}}
<i>dynamic</i>
{{end}}
</dd>
{{if or (eq .Unit.Mode "bin") (eq .Unit.Mode "cgi")}}
<dt class="col-sm-3">Command</dt>
<dd class="col-sm-9">{{.Unit.Command}}</dd>
<dt class="col-sm-3">Shell</dt>
<dd class="col-sm-9">{{.Unit.Shell}}</dd>
{{end}}
</dl>
</div>
<h6 class="card-subtitle mb-2 text-muted">Environment</h6>
<div class="card-text">
{{with .Unit.Environment}}
<div class="table-responsive">
<table class="table table-borderless table-striped">
<thead>
<tr>
<th>Name</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{{range $k,$v := .}}
<tr>
<td>
<pre>{{$k}}</pre>
</td>
<td>{{$v}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
2020-09-28 15:12:57 +00:00
{{else}}
2020-10-01 13:09:40 +00:00
no custom variables defined
2020-09-28 15:12:57 +00:00
{{end}}
2020-10-01 13:09:40 +00:00
</div>
<br/>
<h6 class="card-subtitle mb-2 text-muted">Authorization</h6>
<div class="card-text">
{{if not $.Unit.Secured}}
no authorization defined
2020-09-28 15:12:57 +00:00
{{else}}
2020-10-01 13:09:40 +00:00
{{with .Unit.Authorization}}
<dl class="row">
{{if .JWT.Enable}}
<dt class="col-sm-3">JWT</dt>
<dd class="col-sm-9">in
<code>{{.JWT.GetHeader}}</code>
2020-10-01 13:09:40 +00:00
header
</dd>
{{end}}
{{if .QueryToken.Enable}}
<dt class="col-sm-3">Query token</dt>
<dd class="col-sm-9">in
<code>{{.QueryToken.GetParam}}</code>
2020-10-01 13:09:40 +00:00
param
</dd>
{{end}}
{{if .HeaderToken.Enable}}
<dt class="col-sm-3">Header token</dt>
<dd class="col-sm-9">in
<code>{{.HeaderToken.GetHeader}}</code>
2020-10-01 13:09:40 +00:00
header
</dd>
{{end}}
{{if .Basic.Enable}}
<dt class="col-sm-3">Basic</dt>
<dd class="col-sm-9">{{.Basic.Logins | join ", "}}</dd>
2020-10-01 13:09:40 +00:00
{{end}}
</dl>
{{end}}
2020-09-28 15:12:57 +00:00
{{end}}
2020-10-01 13:09:40 +00:00
</div>
</div>
</div>
</div>
</div>
2020-11-07 15:04:40 +00:00
{{with .CronEntries}}
2020-11-08 11:00:03 +00:00
<br/>
<div class="row">
<div class="col">
<form method="post">
<div class="card">
<div class="card-body">
<h5 class="card-title">Schedules</h5>
<div class="card-text">
<div class="table-responsive">
<table class="table table-borderless table-striped">
<thead>
2020-11-07 15:04:40 +00:00
<tr>
2020-11-08 11:00:03 +00:00
<th>Name</th>
<th>Spec</th>
2020-11-07 15:04:40 +00:00
</tr>
2020-11-08 11:00:03 +00:00
</thead>
<tbody>
{{range $index, $entry := .}}
<tr>
<td>
<a href="cron/{{$index}}">{{$entry.Spec.Label (print "#" $index)}}</a>
</td>
<td>
<code>{{$entry.Spec.Spec}}</code>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
2020-11-07 15:04:40 +00:00
</div>
2020-11-08 11:00:03 +00:00
</div>
2020-11-07 15:04:40 +00:00
</div>
2020-11-08 11:00:03 +00:00
</form>
</div>
2020-11-07 15:04:40 +00:00
</div>
{{end}}
2020-10-01 13:09:40 +00:00
<br/>
<div class="row">
<div class="col">
<form method="post">
<div class="card">
<div class="card-body">
<h5 class="card-title">Try</h5>
<div class="card-text">
<textarea class="form-control" name="body" placeholder="request payload"></textarea>
</div>
<br/>
<button class="btn btn-primary" type="submit">send</button>
</div>
</div>
</form>
</div>
</div>
<br/>
<div class="row">
<div class="col">
<div class="card">
<div class="card-body">
<h5 class="card-title">Last 50 requests</h5>
<div class="card-text">
<div class="table-responsive">
<table class="table table-borderless table-striped">
<thead>
<tr>
<th>ID</th>
<th>Time</th>
<th>Complete</th>
<th>Attempts</th>
</tr>
</thead>
<tbody>
{{range $.History 50}}
<tr>
<td>
<a href="request/{{.ID}}/">{{.ID}}</a>
</td>
<td>{{.Meta.CreatedAt.Format "02 Jan 06 15:04:05.000 MST"}}</td>
<td>
{{if .Meta.Complete}}
{{.Meta.CompleteAt.Format "02 Jan 06 15:04:05.000 MST"}}
{{else}}
in progress
{{end}}
</td>
<td>{{len .Meta.Attempts}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<link rel="stylesheet" href="{{.Rel "/static" "css" "bootstrap-material-design.min.css"}}">
2020-09-28 13:46:37 +00:00
</body>
</html>