github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/vdb/Edit.html (about) 1 <!-- Content managed by Project Forge, see [projectforge.md] for details. --> 2 {% import ( 3 "github.com/kyleu/dbaudit/app" 4 "github.com/kyleu/dbaudit/app/controller/cutil" 5 "github.com/kyleu/dbaudit/app/db" 6 "github.com/kyleu/dbaudit/views/components" 7 "github.com/kyleu/dbaudit/views/components/edit" 8 "github.com/kyleu/dbaudit/views/layout" 9 ) %} 10 11 {% code type Edit struct { 12 layout.Basic 13 Model *db.Connection 14 IsNew bool 15 } %} 16 17 {% func (p *Edit) Body(as *app.State, ps *cutil.PageState) %} 18 <div class="card"> 19 {%- if p.IsNew -%} 20 <div class="right"><a href="?prototype=random"><button>Random</button></a></div> 21 <h3>{%= components.SVGRefIcon(`database`, ps) %} New Connection</h3> 22 <form action="/db/_new" class="mt" method="post"> 23 {%- else -%} 24 <div class="right"><a class="link-confirm" href="{%s p.Model.WebPath() %}/delete" data-message="Are you sure you wish to delete connection [{%s p.Model.String() %}]?"><button>Delete</button></a></div> 25 <h3>{%= components.SVGRefIcon(`database`, ps) %} Edit Connection [{%s p.Model.String() %}]</h3> 26 <form action="" method="post"> 27 {%- endif -%} 28 <table class="mt expanded"> 29 <tbody> 30 {% if p.IsNew %}{%= edit.UUIDTable("id", "", "ID", &p.Model.ID, 5, "UUID in format (00000000-0000-0000-0000-000000000000)") %}{% endif %} 31 {%= edit.StringTable("name", "", "Name", p.Model.Name, 5, "String text") %} 32 {%= edit.StringTable("icon", "", "Icon", p.Model.Icon, 5, "String text") %} 33 {%= edit.SelectTable("engine", "", "Engine", p.Model.Engine.Key, db.AllEngines.Keys(), db.AllEngines.Strings(), 5, db.AllEngines.Help()) %} 34 {%= edit.StringTable("server", "", "Server", p.Model.Server, 5, "String text") %} 35 {%= edit.IntTable("port", "", "Port", p.Model.Port, 5, "Integer") %} 36 {%= edit.StringTable("username", "", "Username", p.Model.Username, 5, "String text") %} 37 {%= edit.StringTable("password", "", "Password", p.Model.Password, 5, "String text") %} 38 {%= edit.StringTable("database", "", "Database", p.Model.Database, 5, "String text") %} 39 {%= edit.StringTable("schema", "", "Schema", p.Model.Schema, 5, "String text") %} 40 {%= edit.StringTable("connOverride", "", "Conn Override", p.Model.ConnOverride, 5, "String text") %} 41 <tr><td colspan="2"><button type="submit">Save Changes</button></td></tr> 42 </tbody> 43 </table> 44 </form> 45 </div> 46 {% endfunc %}