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

     1  {% import (
     2    "github.com/kyleu/dbaudit/app"
     3    "github.com/kyleu/dbaudit/app/controller/cutil"
     4    "github.com/kyleu/dbaudit/app/statement"
     5    "github.com/kyleu/dbaudit/views/components"
     6    "github.com/kyleu/dbaudit/views/layout"
     7  ) %}
     8  
     9  {% func RenderPlan(s *statement.Statement, as *app.State, ps *cutil.PageState) %}
    10    <div class="card">
    11      <h3>{%= components.SVGRefIcon(`star`, ps) %} Query Plan</h3>
    12      <div class="mt">
    13        <ul>
    14          <li><a href="{%s s.WebPath() %}/run">Run Statement</a></li>
    15        </ul>
    16      </div>
    17    </div>
    18  {% endfunc %}
    19  
    20  {% code type Result struct {
    21    layout.Basic
    22    Statement *statement.Statement
    23    Result any
    24  } %}
    25  
    26  {% func (p *Result) Body(as *app.State, ps *cutil.PageState) %}
    27    <div class="card">
    28      <div class="right">
    29        <a href="#modal-statement"><button type="button">JSON</button></a>
    30        <a href="{%s p.Statement.WebPath() %}"><button>{%= components.SVGRef("edit", 15, 15, "icon", ps) %}View</button></a>
    31      </div>
    32      <h3>{%= components.SVGRefIcon(`database`, ps) %} {%s p.Statement.TitleString() %}</h3>
    33      {%= components.JSON(p.Result) %}
    34      <pre>{%s p.Statement.PlainSQL() %}</pre>
    35    </div>
    36    {%= components.JSONModal("statement", "Statement JSON", p.Statement, 1) %}
    37  {% endfunc %}