GraphQL

/views/vgraphql/List.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
33
34
35
36
37
38
39
40
41
{% import (
"{{{ .Package }}}/app"
"{{{ .Package }}}/app/controller/cutil"
"{{{ .Package }}}/views/components"
"{{{ .Package }}}/views/layout"
) %}

{% code type List struct {
layout.Basic
Keys []string
Counts []int
} %}

{% func (p *List) Body(as *app.State, ps *cutil.PageState) %}
{%- code titles := as.GraphQL.Titles() -%}
<div class="card">
<h3>{%= components.SVGRefIcon(`graph`, ps) %}GraphQL</h3>
{%- if len(p.Keys) == 0 -%}
<p><em>no schemata available</em></p>
{%- else -%}
<div class="overflow full-width">
<table class="mt">
<thead>
<tr>
<th>Name</th>
<th class="shrink">Exec Count</th>
</tr>
</thead>
<tbody>
{%- for idx, k := range p.Keys -%}
<tr>
<td><a href="/graphql/{%s k %}">{%s titles[k] %}</a></td>
<td>{%d p.Counts[idx] %}</td>
</tr>
{%- endfor -%}
</tbody>
</table>
</div>
{%- endif -%}
</div>
{% endfunc %}