diff options
author | Gibheer <gibheer+git@zero-knowledge.org> | 2022-12-15 11:16:56 +0100 |
---|---|---|
committer | Gibheer <gibheer+git@zero-knowledge.org> | 2022-12-15 11:16:56 +0100 |
commit | e29f38937cdf077a99b45c27e49f553d4dd8d0d7 (patch) | |
tree | 38509003a153a0100cb1a69a5d7a752ad2ff7616 /cmd/monfront/templates | |
parent | 49dac92034f352698429ee1d78d4bfb070006693 (diff) |
monfront - add basic interface to create some entities
Diffstat (limited to 'cmd/monfront/templates')
-rw-r--r-- | cmd/monfront/templates/create_index.html | 84 | ||||
-rw-r--r-- | cmd/monfront/templates/header.html | 1 | ||||
-rw-r--r-- | cmd/monfront/templates/rows_to_table.html | 19 |
3 files changed, 104 insertions, 0 deletions
diff --git a/cmd/monfront/templates/create_index.html b/cmd/monfront/templates/create_index.html new file mode 100644 index 0000000..1e4a67e --- /dev/null +++ b/cmd/monfront/templates/create_index.html @@ -0,0 +1,84 @@ +{{ template "header" . }} +<section id="content"> + <h1>create entries</h1> + <details> + <summary>checks</summary> + <form action="/create" method="POST"> + <p><label>name</label><input name="name" /></p> + <p><label>node</label> + <select name="node_id"> + {{ range $node := .Content.nodes.Rows }} + <option value="{{ (index . 0).String }}">{{ (index . 1).String }}</option> + {{ end }} + </select> + </p> + <p><label>command</label><select name="command_id"> + {{ range $node := .Content.commands.Rows }} + <option value="{{ (index . 0).String }}">{{ (index . 1).String }}</option> + {{ end }} + </select></p> + <p><label>checker</label><select name="checker_id"> + {{ range $node := .Content.checkers.Rows }} + <option value="{{ (index . 0).String }}">{{ (index . 1).String }}</option> + {{ end }} + </select></p> + <p><label>interval</label><input type="integer" name="interval" value="300" /></p> + <fieldset> + <legend>options</legend> + <!-- TODO implement setting options --> + </fieldset> + <p><label>message</label><textarea name="message"></textarea></p> + <p><button type="submit" name="type" value="check">create</button></p> + </form> + </details> + <details> + <summary>nodes</summary> + <details> + <summary>create new node</summary> + <form action="/create" method="POST"> + <p><label>name</label><input name="name" /></p> + <p><label>message</label><textarea name="message"></textarea></p> + <p><button type="submit" name="type" value="node">create</button></p> + </form> + </details> + {{ template "rows_to_table" .Content.nodes }} + </details> + <details> + <summary>commands</summary> + <details> + <summary>create new command</summary> + <form action="/create" method="POST"> + <p><label>name</label><input name="name" /></p> + <p><label>command</label><textarea name="command"></textarea></p> + <p><label>message</label><textarea name="message"></textarea></p> + <p><button type="submit" name="type" value="command">create</button></p> + </form> + </details> + {{ template "rows_to_table" .Content.commands }} + </details> + <details> + <summary>checkers</summary> + <details> + <summary>create new checker instance</summary> + <form action="/create" method="POST"> + <p><label>name</label><input name="name" /></p> + <p><label>description</label><textarea name="description"></textarea></p> + <p><button type="submit" name="type" value="checker">create</button></p> + </form> + </details> + {{ template "rows_to_table" .Content.checkers }} + </details> + <details> + <summary>notifier</summary> + <details> + <summary>create new notifier</summary> + <form action="/create" method="POST"> + <p><label>name</label><input name="name" /></p> + <p><label>settings</label><textarea name="settings">{}</textarea></p> + <p><button type="submit" name="type" value="notifier">create</button></p> + </form> + </details> + {{ template "rows_to_table" .Content.notifier }} + </details> +</section> +{{ template "footer" . }} diff --git a/cmd/monfront/templates/header.html b/cmd/monfront/templates/header.html index c31a43c..aa8fe4b 100644 --- a/cmd/monfront/templates/header.html +++ b/cmd/monfront/templates/header.html @@ -92,6 +92,7 @@ <li><a href="/">home</a></li> <li><a href="/checks?filter-state=1&filter-ack=false">checks</a></li> <li><a href="/groups">groups</a></li> + <li><a href="/create">create</a></li> </ul> </nav> {{ if .Error }}<div class="error">{{ .Error }}</div>{{ end }} diff --git a/cmd/monfront/templates/rows_to_table.html b/cmd/monfront/templates/rows_to_table.html new file mode 100644 index 0000000..04add21 --- /dev/null +++ b/cmd/monfront/templates/rows_to_table.html @@ -0,0 +1,19 @@ + <table> + <tr> + {{ range $col := .Columns }} + <th>{{ $col }}</th> + {{ end }} + <th></th> + </tr> + {{ range $row := .Rows }} + <tr> + {{ range $col := $row }} + <td>{{ if $col.Valid }}{{ $col.String }}{{ end }}</td> + {{ end }} + <td> + <button name="update" value="{{ (index $row 0).String }}">update</button> + <button name="delete" value="{{ (index $row 0).String }}">delete</button> + </td> + </tr> + {{ end }} + </table> |