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

     1  // Code generated by qtc from "Edit.html". DO NOT EDIT.
     2  // See https://github.com/valyala/quicktemplate for details.
     3  
     4  // <!-- Content managed by Project Forge, see [projectforge.md] for details. -->
     5  
     6  //line views/vdb/Edit.html:2
     7  package vdb
     8  
     9  //line views/vdb/Edit.html:2
    10  import (
    11  	"github.com/kyleu/dbaudit/app"
    12  	"github.com/kyleu/dbaudit/app/controller/cutil"
    13  	"github.com/kyleu/dbaudit/app/db"
    14  	"github.com/kyleu/dbaudit/views/components"
    15  	"github.com/kyleu/dbaudit/views/components/edit"
    16  	"github.com/kyleu/dbaudit/views/layout"
    17  )
    18  
    19  //line views/vdb/Edit.html:11
    20  import (
    21  	qtio422016 "io"
    22  
    23  	qt422016 "github.com/valyala/quicktemplate"
    24  )
    25  
    26  //line views/vdb/Edit.html:11
    27  var (
    28  	_ = qtio422016.Copy
    29  	_ = qt422016.AcquireByteBuffer
    30  )
    31  
    32  //line views/vdb/Edit.html:11
    33  type Edit struct {
    34  	layout.Basic
    35  	Model *db.Connection
    36  	IsNew bool
    37  }
    38  
    39  //line views/vdb/Edit.html:17
    40  func (p *Edit) StreamBody(qw422016 *qt422016.Writer, as *app.State, ps *cutil.PageState) {
    41  //line views/vdb/Edit.html:17
    42  	qw422016.N().S(`
    43    <div class="card">
    44  `)
    45  //line views/vdb/Edit.html:19
    46  	if p.IsNew {
    47  //line views/vdb/Edit.html:19
    48  		qw422016.N().S(`    <div class="right"><a href="?prototype=random"><button>Random</button></a></div>
    49      <h3>`)
    50  //line views/vdb/Edit.html:21
    51  		components.StreamSVGRefIcon(qw422016, `database`, ps)
    52  //line views/vdb/Edit.html:21
    53  		qw422016.N().S(` New Connection</h3>
    54      <form action="/db/_new" class="mt" method="post">
    55  `)
    56  //line views/vdb/Edit.html:23
    57  	} else {
    58  //line views/vdb/Edit.html:23
    59  		qw422016.N().S(`    <div class="right"><a class="link-confirm" href="`)
    60  //line views/vdb/Edit.html:24
    61  		qw422016.E().S(p.Model.WebPath())
    62  //line views/vdb/Edit.html:24
    63  		qw422016.N().S(`/delete" data-message="Are you sure you wish to delete connection [`)
    64  //line views/vdb/Edit.html:24
    65  		qw422016.E().S(p.Model.String())
    66  //line views/vdb/Edit.html:24
    67  		qw422016.N().S(`]?"><button>Delete</button></a></div>
    68      <h3>`)
    69  //line views/vdb/Edit.html:25
    70  		components.StreamSVGRefIcon(qw422016, `database`, ps)
    71  //line views/vdb/Edit.html:25
    72  		qw422016.N().S(` Edit Connection [`)
    73  //line views/vdb/Edit.html:25
    74  		qw422016.E().S(p.Model.String())
    75  //line views/vdb/Edit.html:25
    76  		qw422016.N().S(`]</h3>
    77      <form action="" method="post">
    78  `)
    79  //line views/vdb/Edit.html:27
    80  	}
    81  //line views/vdb/Edit.html:27
    82  	qw422016.N().S(`      <table class="mt expanded">
    83          <tbody>
    84            `)
    85  //line views/vdb/Edit.html:30
    86  	if p.IsNew {
    87  //line views/vdb/Edit.html:30
    88  		edit.StreamUUIDTable(qw422016, "id", "", "ID", &p.Model.ID, 5, "UUID in format (00000000-0000-0000-0000-000000000000)")
    89  //line views/vdb/Edit.html:30
    90  	}
    91  //line views/vdb/Edit.html:30
    92  	qw422016.N().S(`
    93            `)
    94  //line views/vdb/Edit.html:31
    95  	edit.StreamStringTable(qw422016, "name", "", "Name", p.Model.Name, 5, "String text")
    96  //line views/vdb/Edit.html:31
    97  	qw422016.N().S(`
    98            `)
    99  //line views/vdb/Edit.html:32
   100  	edit.StreamStringTable(qw422016, "icon", "", "Icon", p.Model.Icon, 5, "String text")
   101  //line views/vdb/Edit.html:32
   102  	qw422016.N().S(`
   103            `)
   104  //line views/vdb/Edit.html:33
   105  	edit.StreamSelectTable(qw422016, "engine", "", "Engine", p.Model.Engine.Key, db.AllEngines.Keys(), db.AllEngines.Strings(), 5, db.AllEngines.Help())
   106  //line views/vdb/Edit.html:33
   107  	qw422016.N().S(`
   108            `)
   109  //line views/vdb/Edit.html:34
   110  	edit.StreamStringTable(qw422016, "server", "", "Server", p.Model.Server, 5, "String text")
   111  //line views/vdb/Edit.html:34
   112  	qw422016.N().S(`
   113            `)
   114  //line views/vdb/Edit.html:35
   115  	edit.StreamIntTable(qw422016, "port", "", "Port", p.Model.Port, 5, "Integer")
   116  //line views/vdb/Edit.html:35
   117  	qw422016.N().S(`
   118            `)
   119  //line views/vdb/Edit.html:36
   120  	edit.StreamStringTable(qw422016, "username", "", "Username", p.Model.Username, 5, "String text")
   121  //line views/vdb/Edit.html:36
   122  	qw422016.N().S(`
   123            `)
   124  //line views/vdb/Edit.html:37
   125  	edit.StreamStringTable(qw422016, "password", "", "Password", p.Model.Password, 5, "String text")
   126  //line views/vdb/Edit.html:37
   127  	qw422016.N().S(`
   128            `)
   129  //line views/vdb/Edit.html:38
   130  	edit.StreamStringTable(qw422016, "database", "", "Database", p.Model.Database, 5, "String text")
   131  //line views/vdb/Edit.html:38
   132  	qw422016.N().S(`
   133            `)
   134  //line views/vdb/Edit.html:39
   135  	edit.StreamStringTable(qw422016, "schema", "", "Schema", p.Model.Schema, 5, "String text")
   136  //line views/vdb/Edit.html:39
   137  	qw422016.N().S(`
   138            `)
   139  //line views/vdb/Edit.html:40
   140  	edit.StreamStringTable(qw422016, "connOverride", "", "Conn Override", p.Model.ConnOverride, 5, "String text")
   141  //line views/vdb/Edit.html:40
   142  	qw422016.N().S(`
   143            <tr><td colspan="2"><button type="submit">Save Changes</button></td></tr>
   144          </tbody>
   145        </table>
   146      </form>
   147    </div>
   148  `)
   149  //line views/vdb/Edit.html:46
   150  }
   151  
   152  //line views/vdb/Edit.html:46
   153  func (p *Edit) WriteBody(qq422016 qtio422016.Writer, as *app.State, ps *cutil.PageState) {
   154  //line views/vdb/Edit.html:46
   155  	qw422016 := qt422016.AcquireWriter(qq422016)
   156  //line views/vdb/Edit.html:46
   157  	p.StreamBody(qw422016, as, ps)
   158  //line views/vdb/Edit.html:46
   159  	qt422016.ReleaseWriter(qw422016)
   160  //line views/vdb/Edit.html:46
   161  }
   162  
   163  //line views/vdb/Edit.html:46
   164  func (p *Edit) Body(as *app.State, ps *cutil.PageState) string {
   165  //line views/vdb/Edit.html:46
   166  	qb422016 := qt422016.AcquireByteBuffer()
   167  //line views/vdb/Edit.html:46
   168  	p.WriteBody(qb422016, as, ps)
   169  //line views/vdb/Edit.html:46
   170  	qs422016 := string(qb422016.B)
   171  //line views/vdb/Edit.html:46
   172  	qt422016.ReleaseByteBuffer(qb422016)
   173  //line views/vdb/Edit.html:46
   174  	return qs422016
   175  //line views/vdb/Edit.html:46
   176  }