Core

/views/vadmin/Session.html (1.8 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{% import (
"fmt"

"github.com/samber/lo"

"{{{ .Package }}}/app"
"{{{ .Package }}}/app/controller/cutil"
"{{{ .Package }}}/app/util"
"{{{ .Package }}}/views/components"
"{{{ .Package }}}/views/layout"
) %}

{% code type Session struct { layout.Basic } %}

{% func (p *Session) Body(as *app.State, ps *cutil.PageState) %}
<div class="card">
<h3>Session</h3>
<em>{%d len(ps.Session) %} values</em>
</div>
{%- if len(ps.Session) > 0 -%}
<div class="card">
<h3>Values</h3>
<div class="overflow full-width">
<table class="mt expanded">
<tbody>
{%- for _, k := range util.ArraySorted(lo.Keys(ps.Session)) -%}
{%- code v := ps.Session[k] -%}
<tr>
<th class="shrink">{%s k %}</th>
<td>{%s fmt.Sprint(v) %}</td>
</tr>
{%- endfor -%}
</tbody>
</table>
</div>
</div>
{%- else -%}
<div class="card">
<em>Empty session</em>
</div>
{%- endif -%}
<div class="card">
<h3>Profile</h3>
<div class="mt">{%= components.JSON(ps.Profile) %}</div>
</div>{{{ if .HasAccount }}}
{%- if len(ps.Accounts) > 0 -%}
<div class="card">
<h3>Accounts</h3>
<div class="overflow full-width">
<table class="mt">
<thead>
<tr>
<th>Provider</th>
<th>Email</th>
<th>Token</th>
<th>Picture</th>
</tr>
</thead>
<tbody>
{%- for _, acct := range ps.Accounts -%}
<tr>
<td>{%s acct.Provider %}</td>
<td>{%s acct.Email %}</td>
<td><div class="break-word">{%s acct.Token %}</div></td>
<td>{%s acct.Picture %}</td>
</tr>
{%- endfor -%}
</tbody>
</table>
</div>
</div>
{%- endif -%}{{{ end }}}
{% endfunc %}