github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/vstatement/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/statement" 6 "github.com/kyleu/dbaudit/app/util" 7 "github.com/kyleu/dbaudit/views/components" 8 "github.com/kyleu/dbaudit/views/components/edit" 9 "github.com/kyleu/dbaudit/views/layout" 10 ) %} 11 12 {% code type Edit struct { 13 layout.Basic 14 Model *statement.Statement 15 IsNew bool 16 } %} 17 18 {% func (p *Edit) Body(as *app.State, ps *cutil.PageState) %} 19 <div class="card"> 20 {%- if p.IsNew -%} 21 <div class="right"><a href="?prototype=random"><button>Random</button></a></div> 22 <h3>{%= components.SVGRefIcon(`database`, ps) %} New Statement</h3> 23 <form action="/statement/_new" class="mt" method="post"> 24 {%- else -%} 25 <div class="right"><a class="link-confirm" href="{%s p.Model.WebPath() %}/delete" data-message="Are you sure you wish to delete statement [{%s p.Model.String() %}]?"><button>Delete</button></a></div> 26 <h3>{%= components.SVGRefIcon(`database`, ps) %} Edit Statement [{%s p.Model.String() %}]</h3> 27 <form action="" method="post"> 28 {%- endif -%} 29 <table class="mt expanded"> 30 <tbody> 31 {% if p.IsNew %}{%= edit.UUIDTable("id", "", "ID", &p.Model.ID, 5, "UUID in format (00000000-0000-0000-0000-000000000000)") %}{% endif %} 32 {%= edit.IntTable("sessionID", "", "Session ID", p.Model.SessionID, 5, "Integer") %} 33 {%= edit.SelectTable("action", "", "Action", p.Model.Action.Key, statement.AllActions.Keys(), statement.AllActions.Strings(), 5, statement.AllActions.Help()) %} 34 {%= edit.BoolTable("succeeded", "Succeeded", p.Model.Succeeded, 5, "Value [true] or [false]") %} 35 {%= edit.StringTable("principal", "", "Principal", p.Model.Principal, 5, "String text") %} 36 {%= edit.StringTable("database", "", "Database", p.Model.Database, 5, "String text") %} 37 {%= edit.StringTable("filename", "", "Filename", p.Model.Filename, 5, "String text") %} 38 {%= edit.StringTable("host", "", "Host", p.Model.Host, 5, "String text") %} 39 {%= edit.IntTable("transactionID", "", "Transaction ID", p.Model.TransactionID, 5, "Integer") %} 40 {%= edit.StringTable("clientIP", "", "Client IP", p.Model.ClientIP, 5, "String text") %} 41 {%= edit.IntTable("duration", "", "Duration", p.Model.Duration, 5, "Integer") %} 42 {%= edit.UUIDTable("connectionID", "", "Connection ID", &p.Model.ConnectionID, 5, "UUID in format (00000000-0000-0000-0000-000000000000)") %} 43 {%= edit.IntTable("rowsAffected", "", "Rows Affected", p.Model.RowsAffected, 5, "Integer") %} 44 {%= edit.IntTable("rowsReturned", "", "Rows Returned", p.Model.RowsReturned, 5, "Integer") %} 45 {%= edit.TextareaTable("sql", "", "SQL", 8, p.Model.SQL, 5, "String text") %} 46 {%= edit.TextareaTable("types", "", "Types", 8, util.ToJSON(p.Model.Types.String()), 5, "JSON object") %} 47 {%= edit.TextareaTable("values", "", "Values", 8, util.ToJSON(p.Model.Values.String()), 5, "JSON object") %} 48 {%= edit.TimestampTable("occurred", "", "Occurred", &p.Model.Occurred, 5, "Date and time, in almost any format") %} 49 <tr><td colspan="2"><button type="submit">Save Changes</button></td></tr> 50 </tbody> 51 </table> 52 </form> 53 </div> 54 {% endfunc %}