Database UI

/views/vdatabase/Results.html (1.0 KB)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{% import (
"{{{ .Package }}}/app"
"{{{ .Package }}}/app/controller/cutil"
"{{{ .Package }}}/app/lib/database"
"{{{ .Package }}}/app/lib/filter"
"{{{ .Package }}}/app/util"
"{{{ .Package }}}/views/components"
"{{{ .Package }}}/views/layout"
) %}

{% code type Results struct {
layout.Basic
Svc *database.Service
Schema string
Table string
Results []util.ValueMap
Params *filter.Params
Timing int
Error error
} %}

{% func (p *Results) Body(as *app.State, ps *cutil.PageState) %}
<div class="card">
<div class="right">{%s util.MicrosToMillis(p.Timing) %} elapsed</div>
<h3>{%= components.SVGRefIcon(`database`, ps) %}Table [{% if p.Schema != "default" %}{%s p.Schema %}:{% endif %}{%s p.Table %}]</h3>
<div><em>{%d len(p.Results) %} rows returned</em></div>
{%- if p.Error != nil -%}
<div class="mt error">{%s p.Error.Error() %}</div>
{%- endif -%}
<div class="mt overflow">{%= components.DisplayMaps(p.Results, p.Params, true, ps) %}</div>
</div>
{% endfunc %}