summaryrefslogtreecommitdiff
path: root/templates/dns.html
diff options
context:
space:
mode:
authorsimponic <simponic@hatecomputers.club>2024-03-28 12:57:35 -0400
committersimponic <simponic@hatecomputers.club>2024-03-28 12:57:35 -0400
commitb2fc689bdcff28bf75c0128db19ba4730d726b4f (patch)
tree37c16d95183242516ba667aa5f441539d152c279 /templates/dns.html
parent75ba836d6072235fc7a71659f8630ab3c1b210ad (diff)
downloadhatecomputers.club-b2fc689bdcff28bf75c0128db19ba4730d726b4f.tar.gz
hatecomputers.club-b2fc689bdcff28bf75c0128db19ba4730d726b4f.zip
dns api (#1)
Co-authored-by: Elizabeth Hunt <elizabeth.hunt@simponic.xyz> Reviewed-on: https://git.hatecomputers.club/hatecomputers/hatecomputers.club/pulls/1
Diffstat (limited to 'templates/dns.html')
-rw-r--r--templates/dns.html52
1 files changed, 46 insertions, 6 deletions
diff --git a/templates/dns.html b/templates/dns.html
index 0a40cab..e317d05 100644
--- a/templates/dns.html
+++ b/templates/dns.html
@@ -5,10 +5,11 @@
<th>Name</th>
<th>Content</th>
<th>TTL</th>
+ <th>Delete</th>
</tr>
{{ if (eq (len .DNSRecords) 0) }}
<tr>
- <td colspan="4"><span class="blinky">No DNS records found</span></td>
+ <td colspan="5"><span class="blinky">No DNS records found</span></td>
</tr>
{{ end }}
{{ range $record := .DNSRecords }}
@@ -17,21 +18,60 @@
<td>{{ $record.Name }}</td>
<td>{{ $record.Content }}</td>
<td>{{ $record.TTL }}</td>
+ <td>
+ <form method="POST" action="/dns/delete">
+ <input type="hidden" name="id" value="{{ $record.ID }}" />
+ <input type="submit" value="Delete" />
+ </form>
+ </td>
</tr>
{{ end }}
</table>
<br>
- <form method="POST" action="/dns">
+ <form method="POST" action="/dns" class="form">
<h2>Add DNS Records</h2>
+ <p>note that the name <em>must</em> be a subdomain of <em>{{ .User.Username }}</em></p>
<hr>
<label for="type">Type</label>
- <input type="text" name="type" placeholder="CNAME" required />
+ <input type="text" name="type" placeholder="CNAME"
+ {{ if not .RecordForm }}
+ placeholder="CNAME"
+ {{ else }}
+ value="{{ .RecordForm.Type }}"
+ {{ end }}
+ required />
<label for="name">Name</label>
- <input type="text" name="name" placeholder="{{ .User.Username }}" required />
+ <input type="text" name="name"
+ {{ if not .RecordForm }}
+ placeholder="{{ .User.Username }} || endpoint.{{ .User.Username }}..."
+ {{ else }}
+ value="{{ .RecordForm.Name }}"
+ {{ end }}
+ required/>
<label for="content">Content</label>
- <input type="text" name="content" placeholder="{{ .User.Username }}.dev" required />
+ <input type="text" name="content"
+ {{ if not .RecordForm }}
+ placeholder="{{ .User.Username }}.dev"
+ {{ else }}
+ value="{{ .RecordForm.Content }}"
+ {{ end }}
+ required />
<label for="ttl">TTL</label>
- <input type="text" name="ttl" placeholder="43200" required />
+ <input type="text" name="ttl"
+ {{ if not .RecordForm }}
+ placeholder="43200"
+ {{ else }}
+ value="{{ .RecordForm.TTL }}"
+ {{ end }}
+ required />
<input type="submit" value="Add" />
</form>
+
+ {{ if .FormError }}
+ {{ if (len .FormError.Errors) }}
+ {{ range $error := .FormError.Errors }}
+ <div class="error">{{ $error }}</div>
+ {{ end }}
+ {{ end }}
+ {{ end }}
{{ end }}