add emoji status to UI, do not show empty env and auth

This commit is contained in:
Alexander Baryshnikov 2020-11-08 19:12:48 +08:00
parent 2f943c6242
commit 32c59d77b9
5 changed files with 34 additions and 23 deletions

View File

@ -1,6 +1,6 @@
# Nano-Run
![nano-run](https://user-images.githubusercontent.com/6597086/97143787-4f70db80-179e-11eb-9b9c-7e16bfff845e.png)
![sample-nano-run](https://user-images.githubusercontent.com/6597086/98463432-303e6900-21f6-11eb-9632-806b1c99813b.gif)
Lightweight async request runner.

File diff suppressed because one or more lines are too long

View File

@ -287,6 +287,9 @@ func (ui *uiRouter) listUnits(gctx *gin.Context) {
for _, info := range ui.units {
units = append(units, info.Unit)
}
sort.Slice(units, func(i, j int) bool {
return units[i].Name() < units[j].Name()
})
reply.baseResponse = base(gctx)
reply.Units = units
gctx.HTML(http.StatusOK, "units-list.html", reply)

View File

@ -35,11 +35,18 @@
<div class="card">
<div class="card-body">
<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>
<p>
{{with .Unit}}
{{if .Private}}<span title="not exposed over API">🏠</span>
{{else if .Secured}}<span title="with authorization">🛡️</span>
{{end}}
{{if gt (len .Cron) 0}}
<span title="with scheduler"></span>
{{end}}
{{end}}
</p>
<h6 class="card-subtitle mb-2 text-muted">Configuration</h6>
<div class="card-text">
<dl class="row">
@ -107,9 +114,9 @@
{{end}}
</dl>
</div>
<h6 class="card-subtitle mb-2 text-muted">Environment</h6>
<div class="card-text">
{{with .Unit.Environment}}
{{with .Unit.Environment}}
<h6 class="card-subtitle mb-2 text-muted">Environment</h6>
<div class="card-text">
<div class="table-responsive">
<table class="table table-borderless table-striped">
<thead>
@ -130,16 +137,12 @@
</tbody>
</table>
</div>
{{else}}
no custom variables defined
{{end}}
</div>
<br/>
<h6 class="card-subtitle mb-2 text-muted">Authorization</h6>
<div class="card-text">
{{if not $.Unit.Secured}}
no authorization defined
{{else}}
</div>
<br/>
{{end}}
{{if $.Unit.Secured}}
<h6 class="card-subtitle mb-2 text-muted">Authorization</h6>
<div class="card-text">
{{with .Unit.Authorization}}
<dl class="row">
{{if .JWT.Enable}}
@ -169,8 +172,8 @@
{{end}}
</dl>
{{end}}
{{end}}
</div>
</div>
{{end}}
</div>
</div>
</div>

View File

@ -50,8 +50,13 @@
{{range .Units}}
<tr>
<td>
{{if .Private}}<span title="not exposed over API">🏠</span>
{{else if .Secured}}<span title="with authorization">🛡️</span>
{{with .}}
{{if .Private}}<span title="not exposed over API">🏠</span>
{{else if .Secured}}<span title="with authorization">🛡️</span>
{{end}}
{{if gt (len .Cron) 0}}
<span title="with scheduler"></span>
{{end}}
{{end}}
</td>
<td>