| Giorgi Lekveishvili | 5c1b06e | 2024-03-28 15:19:44 +0400 | [diff] [blame] | 1 | {{ define "task" }} |
| 2 | {{ range . }} |
| Giorgi Lekveishvili | ab7ff6e | 2024-03-29 13:11:30 +0400 | [diff] [blame] | 3 | <li aria-busy="{{ eq .Status 1 }}"> |
| gio | 18d5c68 | 2024-05-02 10:30:57 +0400 | [diff] [blame] | 4 | {{ if eq .Status 3 }}<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="black" d="M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59z"/></svg>{{ end }}{{ .Title }}{{ if .Err }} - {{ .Err.Error }} {{ end }} |
| Giorgi Lekveishvili | 5c1b06e | 2024-03-28 15:19:44 +0400 | [diff] [blame] | 5 | {{ if .Subtasks }} |
| 6 | <ul> |
| 7 | {{ template "task" .Subtasks }} |
| 8 | </ul> |
| 9 | {{ end }} |
| 10 | </li> |
| 11 | {{ end }} |
| 12 | {{ end }} |
| 13 | |
| 14 | {{ define "main" }} |
| Giorgi Lekveishvili | ab7ff6e | 2024-03-29 13:11:30 +0400 | [diff] [blame] | 15 | <div class="grid contents-header"> |
| 16 | <div style="border-width: 1px; border-right-style: solid;"> |
| 17 | setup |
| 18 | </div> |
| 19 | <div> |
| 20 | information |
| 21 | </div> |
| Giorgi Lekveishvili | 5c1b06e | 2024-03-28 15:19:44 +0400 | [diff] [blame] | 22 | </div> |
| Giorgi Lekveishvili | ab7ff6e | 2024-03-29 13:11:30 +0400 | [diff] [blame] | 23 | <div id="contents" class="grid env-status"> |
| 24 | <div> |
| 25 | <ul class="progress"> |
| 26 | {{ template "task" .Root.Subtasks }} |
| 27 | </ul> |
| 28 | </div> |
| 29 | <div id="create-instance-form"> |
| 30 | {{ if .DNSRecords }} |
| 31 | <form action="" method="POST"> |
| 32 | <p>You will have to publish following DNS records via your domain registrar.</p> |
| gio | 18d5c68 | 2024-05-02 10:30:57 +0400 | [diff] [blame] | 33 | <textarea rows="7">{{ .DNSRecords }}</textarea> |
| Giorgi Lekveishvili | ab7ff6e | 2024-03-29 13:11:30 +0400 | [diff] [blame] | 34 | <label for="domain-registrar">Domain Registrar</label> |
| 35 | <select id="domain-registrar" required tabindex="1"> |
| 36 | <option value="" selected>Select registrar</option> |
| 37 | <option value="gandi">Gandi</option> |
| Giorgi Lekveishvili | ab7ff6e | 2024-03-29 13:11:30 +0400 | [diff] [blame] | 38 | </select> |
| 39 | <label for="api-token">API Token</label> |
| 40 | <input |
| 41 | type="text" |
| 42 | id="api-token" |
| 43 | name="api-token" |
| 44 | required |
| 45 | autofocus |
| 46 | tabindex="2" |
| 47 | /> |
| 48 | <button type="submit" tabindex="3">Update</button> |
| 49 | </form> |
| 50 | {{ else if .EnvInfo }} |
| 51 | <p>{{ .EnvInfo }}</p> |
| 52 | {{ end }} |
| 53 | </div> |
| 54 | </div> |
| 55 | <script type="text/javascript"> |
| 56 | async function refresh() { |
| 57 | const resp = await fetch(window.location.href); |
| 58 | if (resp.ok) { |
| 59 | var tmp = document.createElement("html"); |
| 60 | tmp.innerHTML = await resp.text(); |
| gio | 18d5c68 | 2024-05-02 10:30:57 +0400 | [diff] [blame] | 61 | if (document.getElementsByTagName("form").length === 0) { |
| 62 | document.getElementById("contents").innerHTML = tmp.getElementsByClassName("env-status")[0].innerHTML; |
| 63 | } else { |
| 64 | document.getElementsByClassName("progress")[0].innerHTML = tmp.getElementsByClassName("progress")[0].innerHTML; |
| 65 | } |
| Giorgi Lekveishvili | ab7ff6e | 2024-03-29 13:11:30 +0400 | [diff] [blame] | 66 | } |
| 67 | setTimeout(refresh, 5000); |
| 68 | } |
| 69 | |
| 70 | setTimeout(refresh, 5000); |
| 71 | </script> |
| Giorgi Lekveishvili | 5c1b06e | 2024-03-28 15:19:44 +0400 | [diff] [blame] | 72 | {{ end }} |