github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/vparse/SQLServer.html.go (about)

     1  // Code generated by qtc from "SQLServer.html". DO NOT EDIT.
     2  // See https://github.com/valyala/quicktemplate for details.
     3  
     4  //line views/vparse/SQLServer.html:1
     5  package vparse
     6  
     7  //line views/vparse/SQLServer.html:1
     8  import (
     9  	"github.com/kyleu/dbaudit/app"
    10  	"github.com/kyleu/dbaudit/app/controller/cutil"
    11  	"github.com/kyleu/dbaudit/app/parse"
    12  	"github.com/kyleu/dbaudit/app/util"
    13  	"github.com/kyleu/dbaudit/views/components"
    14  	"github.com/kyleu/dbaudit/views/components/edit"
    15  	"github.com/kyleu/dbaudit/views/layout"
    16  )
    17  
    18  //line views/vparse/SQLServer.html:11
    19  import (
    20  	qtio422016 "io"
    21  
    22  	qt422016 "github.com/valyala/quicktemplate"
    23  )
    24  
    25  //line views/vparse/SQLServer.html:11
    26  var (
    27  	_ = qtio422016.Copy
    28  	_ = qt422016.AcquireByteBuffer
    29  )
    30  
    31  //line views/vparse/SQLServer.html:11
    32  type SQLServer struct {
    33  	layout.Basic
    34  	Path   string
    35  	Task   string
    36  	Limit  int
    37  	Result *parse.Result
    38  }
    39  
    40  //line views/vparse/SQLServer.html:19
    41  func (p *SQLServer) StreamBody(qw422016 *qt422016.Writer, as *app.State, ps *cutil.PageState) {
    42  //line views/vparse/SQLServer.html:19
    43  	qw422016.N().S(`
    44    <div class="card">
    45      <h3>`)
    46  //line views/vparse/SQLServer.html:21
    47  	components.StreamSVGRefIcon(qw422016, `app`, ps)
    48  //line views/vparse/SQLServer.html:21
    49  	qw422016.N().S(`SQL Server Analysis</h3>
    50      <form action="" method="post">
    51        <table class="mt expanded min-200">
    52          <tbody>
    53            `)
    54  //line views/vparse/SQLServer.html:25
    55  	edit.StreamStringTable(qw422016, "path", "", "File Path", p.Path, 5, "Location of SQL Audit files")
    56  //line views/vparse/SQLServer.html:25
    57  	qw422016.N().S(`
    58            `)
    59  //line views/vparse/SQLServer.html:26
    60  	edit.StreamSelectTable(qw422016, "task", "", "Task", p.Task, []string{"testbed", "count", "top10"}, nil, 5, "Task to run")
    61  //line views/vparse/SQLServer.html:26
    62  	qw422016.N().S(`
    63            `)
    64  //line views/vparse/SQLServer.html:27
    65  	edit.StreamIntTable(qw422016, "limit", "", "Event Limit", p.Limit, 5, "Limit for returned events")
    66  //line views/vparse/SQLServer.html:27
    67  	qw422016.N().S(`
    68            <tr><td colspan="2"><button type="submit">Analyze</button></td></tr>
    69          </tbody>
    70        </table>
    71      </form>
    72    </div>
    73  `)
    74  //line views/vparse/SQLServer.html:33
    75  	if p.Result != nil {
    76  //line views/vparse/SQLServer.html:33
    77  		qw422016.N().S(`  <div class="card">
    78      <h3>`)
    79  //line views/vparse/SQLServer.html:35
    80  		components.StreamSVGRefIcon(qw422016, `cog`, ps)
    81  //line views/vparse/SQLServer.html:35
    82  		qw422016.E().S(util.StringPlural(len(p.Result.Events), "Event"))
    83  //line views/vparse/SQLServer.html:35
    84  		qw422016.N().S(`</h3>
    85      <div class="mt overflow full-width">
    86        <table class="expanded">
    87          <thead>
    88            <tr>
    89              <th>ID</th>
    90              <th>Action</th>
    91              <th>Statement</th>
    92              <th>Arguments</th>
    93              <th>Rows</th>
    94              <th>Duration</th>
    95              <th>Occurred</th>
    96            </tr>
    97          </thead>
    98          <tbody>
    99  `)
   100  //line views/vparse/SQLServer.html:50
   101  		for _, st := range p.Result.Statements {
   102  //line views/vparse/SQLServer.html:50
   103  			qw422016.N().S(`          <tr>
   104              <td>
   105                <a href="#modal-event-`)
   106  //line views/vparse/SQLServer.html:53
   107  			qw422016.E().S(st.ID.String())
   108  //line views/vparse/SQLServer.html:53
   109  			qw422016.N().S(`">`)
   110  //line views/vparse/SQLServer.html:53
   111  			qw422016.E().S(st.ID.String())
   112  //line views/vparse/SQLServer.html:53
   113  			qw422016.N().S(`</a>
   114                <div id="modal-event-`)
   115  //line views/vparse/SQLServer.html:54
   116  			qw422016.E().S(st.ID.String())
   117  //line views/vparse/SQLServer.html:54
   118  			qw422016.N().S(`" class="modal" style="display: none;">
   119                  <a class="backdrop" href="#"></a>
   120                  <div class="modal-content">
   121                    <div class="modal-header">
   122                      <a href="#" class="modal-close">×</a>
   123                      <h2>Event [`)
   124  //line views/vparse/SQLServer.html:59
   125  			qw422016.E().S(st.ID.String())
   126  //line views/vparse/SQLServer.html:59
   127  			qw422016.N().S(`]</h2>
   128                    </div>
   129                    <div class="modal-body">
   130                      <ul class="accordion">
   131                        <li>
   132                          <input id="accordion-event-`)
   133  //line views/vparse/SQLServer.html:64
   134  			qw422016.E().S(st.ID.String())
   135  //line views/vparse/SQLServer.html:64
   136  			qw422016.N().S(`-raw" type="checkbox" hidden="hidden" />
   137                          <label for="accordion-event-`)
   138  //line views/vparse/SQLServer.html:65
   139  			qw422016.E().S(st.ID.String())
   140  //line views/vparse/SQLServer.html:65
   141  			qw422016.N().S(`-raw">`)
   142  //line views/vparse/SQLServer.html:65
   143  			components.StreamExpandCollapse(qw422016, 3, ps)
   144  //line views/vparse/SQLServer.html:65
   145  			qw422016.N().S(`Full Event</label>
   146                          <div class="bd"><div><div>
   147                            `)
   148  //line views/vparse/SQLServer.html:67
   149  			components.StreamJSON(qw422016, st)
   150  //line views/vparse/SQLServer.html:67
   151  			qw422016.N().S(`
   152                          </div></div></div>
   153                        </li>
   154                        <li>
   155                          <input id="accordion-event-`)
   156  //line views/vparse/SQLServer.html:71
   157  			qw422016.E().S(st.ID.String())
   158  //line views/vparse/SQLServer.html:71
   159  			qw422016.N().S(`-sql" type="checkbox" hidden="hidden" />
   160                          <label for="accordion-event-`)
   161  //line views/vparse/SQLServer.html:72
   162  			qw422016.E().S(st.ID.String())
   163  //line views/vparse/SQLServer.html:72
   164  			qw422016.N().S(`-sql">`)
   165  //line views/vparse/SQLServer.html:72
   166  			components.StreamExpandCollapse(qw422016, 3, ps)
   167  //line views/vparse/SQLServer.html:72
   168  			qw422016.N().S(`SQL Statement</label>
   169                          <div class="bd"><div><div>
   170                            <pre style="white-space: pre-wrap;">`)
   171  //line views/vparse/SQLServer.html:74
   172  			qw422016.E().S(st.SQL)
   173  //line views/vparse/SQLServer.html:74
   174  			qw422016.N().S(`</pre>
   175                          </div></div></div>
   176                        </li>
   177                        <li>
   178                          <input id="accordion-event-`)
   179  //line views/vparse/SQLServer.html:78
   180  			qw422016.E().S(st.ID.String())
   181  //line views/vparse/SQLServer.html:78
   182  			qw422016.N().S(`-args" type="checkbox" hidden="hidden" />
   183                          <label for="accordion-event-`)
   184  //line views/vparse/SQLServer.html:79
   185  			qw422016.E().S(st.ID.String())
   186  //line views/vparse/SQLServer.html:79
   187  			qw422016.N().S(`-args">`)
   188  //line views/vparse/SQLServer.html:79
   189  			components.StreamExpandCollapse(qw422016, 3, ps)
   190  //line views/vparse/SQLServer.html:79
   191  			qw422016.N().S(`Arguments</label>
   192                          <div class="bd"><div><div>
   193                            `)
   194  //line views/vparse/SQLServer.html:81
   195  			components.StreamJSON(qw422016, st.Values)
   196  //line views/vparse/SQLServer.html:81
   197  			qw422016.N().S(`
   198                          </div></div></div>
   199                        </li>
   200                      </ul>
   201                    </div>
   202                  </div>
   203                </div>
   204              </td>
   205              <td>`)
   206  //line views/vparse/SQLServer.html:89
   207  			qw422016.E().S(st.Action.String())
   208  //line views/vparse/SQLServer.html:89
   209  			qw422016.N().S(`</td>
   210              <td>`)
   211  //line views/vparse/SQLServer.html:90
   212  			qw422016.E().S(util.ByteSizeSI(int64(len(st.SQL))))
   213  //line views/vparse/SQLServer.html:90
   214  			qw422016.N().S(`</td>
   215              <td>`)
   216  //line views/vparse/SQLServer.html:91
   217  			qw422016.N().D(len(st.Values))
   218  //line views/vparse/SQLServer.html:91
   219  			qw422016.N().S(`</td>
   220              <td>`)
   221  //line views/vparse/SQLServer.html:92
   222  			qw422016.N().D(st.RowsAffected)
   223  //line views/vparse/SQLServer.html:92
   224  			qw422016.N().S(`</td>
   225              <td>`)
   226  //line views/vparse/SQLServer.html:93
   227  			qw422016.E().S(util.MicrosToMillis(st.Duration * 1000))
   228  //line views/vparse/SQLServer.html:93
   229  			qw422016.N().S(`</td>
   230              <td>`)
   231  //line views/vparse/SQLServer.html:94
   232  			qw422016.E().S(util.TimeToFullMS(&st.Occurred))
   233  //line views/vparse/SQLServer.html:94
   234  			qw422016.N().S(`</td>
   235            </tr>
   236  `)
   237  //line views/vparse/SQLServer.html:96
   238  		}
   239  //line views/vparse/SQLServer.html:96
   240  		qw422016.N().S(`        </tbody>
   241        </table>
   242      </div>
   243    </div>
   244  `)
   245  //line views/vparse/SQLServer.html:101
   246  	}
   247  //line views/vparse/SQLServer.html:102
   248  }
   249  
   250  //line views/vparse/SQLServer.html:102
   251  func (p *SQLServer) WriteBody(qq422016 qtio422016.Writer, as *app.State, ps *cutil.PageState) {
   252  //line views/vparse/SQLServer.html:102
   253  	qw422016 := qt422016.AcquireWriter(qq422016)
   254  //line views/vparse/SQLServer.html:102
   255  	p.StreamBody(qw422016, as, ps)
   256  //line views/vparse/SQLServer.html:102
   257  	qt422016.ReleaseWriter(qw422016)
   258  //line views/vparse/SQLServer.html:102
   259  }
   260  
   261  //line views/vparse/SQLServer.html:102
   262  func (p *SQLServer) Body(as *app.State, ps *cutil.PageState) string {
   263  //line views/vparse/SQLServer.html:102
   264  	qb422016 := qt422016.AcquireByteBuffer()
   265  //line views/vparse/SQLServer.html:102
   266  	p.WriteBody(qb422016, as, ps)
   267  //line views/vparse/SQLServer.html:102
   268  	qs422016 := string(qb422016.B)
   269  //line views/vparse/SQLServer.html:102
   270  	qt422016.ReleaseByteBuffer(qb422016)
   271  //line views/vparse/SQLServer.html:102
   272  	return qs422016
   273  //line views/vparse/SQLServer.html:102
   274  }