github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/vadmin/Session.html (about)

     1  <!-- Content managed by Project Forge, see [projectforge.md] for details. -->
     2  {% import (
     3    "fmt"
     4  
     5    "github.com/samber/lo"
     6  
     7    "github.com/kyleu/dbaudit/app"
     8    "github.com/kyleu/dbaudit/app/controller/cutil"
     9    "github.com/kyleu/dbaudit/app/util"
    10    "github.com/kyleu/dbaudit/views/components"
    11    "github.com/kyleu/dbaudit/views/layout"
    12  ) %}
    13  
    14  {% code type Session struct { layout.Basic } %}
    15  
    16  {% func (p *Session) Body(as *app.State, ps *cutil.PageState) %}
    17    <div class="card">
    18      <h3>Session</h3>
    19      <em>{%d len(ps.Session) %} values</em>
    20    </div>
    21    {%- if len(ps.Session) > 0 -%}
    22    <div class="card">
    23      <h3>Values</h3>
    24      <div class="overflow full-width">
    25        <table class="mt expanded">
    26          <tbody>
    27            {%- for _, k := range util.ArraySorted(lo.Keys(ps.Session)) -%}
    28              {%- code v := ps.Session[k] -%}
    29              <tr>
    30                <th class="shrink">{%s k %}</th>
    31                <td>{%s fmt.Sprint(v) %}</td>
    32              </tr>
    33            {%- endfor -%}
    34          </tbody>
    35        </table>
    36      </div>
    37    </div>
    38    {%- else -%}
    39    <div class="card">
    40      <em>Empty session</em>
    41    </div>
    42    {%- endif -%}
    43    <div class="card">
    44      <h3>Profile</h3>
    45      <div class="mt">{%= components.JSON(ps.Profile) %}</div>
    46    </div>
    47    {%- if len(ps.Accounts) > 0 -%}
    48    <div class="card">
    49      <h3>Accounts</h3>
    50      <div class="overflow full-width">
    51        <table class="mt">
    52          <thead>
    53            <tr>
    54              <th>Provider</th>
    55              <th>Email</th>
    56              <th>Token</th>
    57              <th>Picture</th>
    58            </tr>
    59          </thead>
    60          <tbody>
    61          {%- for _, acct := range ps.Accounts -%}
    62          <tr>
    63            <td>{%s acct.Provider %}</td>
    64            <td>{%s acct.Email %}</td>
    65            <td><div class="break-word">{%s acct.Token %}</div></td>
    66            <td>{%s acct.Picture %}</td>
    67          </tr>
    68          {%- endfor -%}
    69          </tbody>
    70        </table>
    71      </div>
    72    </div>
    73    {%- endif -%}
    74  {% endfunc %}