aboutsummaryrefslogtreecommitdiff
path: root/cmd/monfront/templates
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/monfront/templates')
-rw-r--r--cmd/monfront/templates/create_index.html84
-rw-r--r--cmd/monfront/templates/header.html1
-rw-r--r--cmd/monfront/templates/rows_to_table.html19
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>