| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 1 | {{ define "schema-form" }} |
| 2 | {{ $readonly := .ReadOnly }} |
| 3 | {{ $networks := .AvailableNetworks }} |
| gio | f6ad298 | 2024-08-23 17:42:49 +0400 | [diff] [blame] | 4 | {{ $clusters := .AvailableClusters }} |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 5 | {{ $data := .Data }} |
| gio | 44f621b | 2024-04-29 09:44:38 +0400 | [diff] [blame] | 6 | {{ range $f := .Schema.Fields }} |
| 7 | {{ $name := $f.Name }} |
| 8 | {{ $schema := $f.Schema }} |
| Giorgi Lekveishvili | e009a5d | 2024-01-05 14:10:11 +0400 | [diff] [blame] | 9 | {{ if eq $schema.Kind 0 }} |
| gio | 44f621b | 2024-04-29 09:44:38 +0400 | [diff] [blame] | 10 | <label {{ if $schema.Advanced }}hidden{{ end }}> |
| 11 | <input type="checkbox" role="swtich" name="{{ $name }}" oninput="valueChanged({{ $name }}, this.checked)" {{ if $readonly }}disabled{{ end }} {{ if index $data $name }}checked{{ end }} /> |
| 12 | {{ $schema.Name }} |
| Giorgi Lekveishvili | e009a5d | 2024-01-05 14:10:11 +0400 | [diff] [blame] | 13 | </label> |
| Giorgi Lekveishvili | b59b7c2 | 2024-04-03 22:17:50 +0400 | [diff] [blame] | 14 | {{ else if eq $schema.Kind 7 }} |
| gio | 44f621b | 2024-04-29 09:44:38 +0400 | [diff] [blame] | 15 | <label {{ if $schema.Advanced }}hidden{{ end }}> |
| 16 | {{ $schema.Name }} |
| 17 | <input type="text" name="{{ $name }}" oninput="valueChanged({{ $name }}, parseInt(this.value))" {{ if $readonly }}disabled{{ end }} value="{{ index $data $name }}" /> |
| Giorgi Lekveishvili | b59b7c2 | 2024-04-03 22:17:50 +0400 | [diff] [blame] | 18 | </label> |
| Giorgi Lekveishvili | e009a5d | 2024-01-05 14:10:11 +0400 | [diff] [blame] | 19 | {{ else if eq $schema.Kind 1 }} |
| gio | 44f621b | 2024-04-29 09:44:38 +0400 | [diff] [blame] | 20 | <label {{ if $schema.Advanced }}hidden{{ end }}> |
| 21 | {{ $schema.Name }} |
| gio | 7fbd4ad | 2024-08-27 10:06:39 +0400 | [diff] [blame] | 22 | <input type="text" name="{{ $name }}" oninput="valueChanged({{ $name }}, this.value)" {{ if $readonly }}disabled{{ end }} value="{{ index $data $name }}" /> |
| 23 | </label> |
| Giorgi Lekveishvili | e009a5d | 2024-01-05 14:10:11 +0400 | [diff] [blame] | 24 | {{ else if eq $schema.Kind 4 }} |
| gio | 44f621b | 2024-04-29 09:44:38 +0400 | [diff] [blame] | 25 | <label {{ if $schema.Advanced }}hidden{{ end }}> |
| 26 | {{ $schema.Name }} |
| 27 | <input type="text" name="{{ $name }}" oninput="valueChanged({{ $name }}, this.value)" {{ if $readonly }}disabled{{ end }} value="{{ index $data $name }}" /> |
| 28 | </label> |
| gio | f6ad298 | 2024-08-23 17:42:49 +0400 | [diff] [blame] | 29 | {{ else if eq $schema.Kind 12 }} |
| 30 | <label {{ if $schema.Advanced }}hidden{{ end }}> |
| 31 | {{ $schema.Name }} |
| 32 | <details class="dropdown"> |
| 33 | {{ $selectedCluster := index $data $name }} |
| 34 | <summary id="{{ $name }}">{{ $selectedCluster }}</summary> |
| 35 | <ul> |
| 36 | {{ range $clusters }} |
| 37 | {{ $selected := eq $selectedCluster .Name }} |
| 38 | <li> |
| 39 | <label> |
| 40 | <input type="radio" name="{{ $name }}" oninput="clusterSelected('{{ $name }}', '{{ .Name }}', this.checked)" {{ if $selected }}checked{{ end }} /> |
| 41 | {{ .Name }} |
| 42 | </label> |
| 43 | </li> |
| 44 | {{ end }} |
| 45 | </ul> |
| 46 | </details> |
| 47 | </label> |
| Giorgi Lekveishvili | 7c42760 | 2024-01-04 00:13:55 +0400 | [diff] [blame] | 48 | {{ else if eq $schema.Kind 3 }} |
| gio | 44f621b | 2024-04-29 09:44:38 +0400 | [diff] [blame] | 49 | <label {{ if $schema.Advanced }}hidden{{ end }}> |
| 50 | {{ $schema.Name }} |
| gio | bb338e2 | 2024-07-18 18:09:22 +0400 | [diff] [blame] | 51 | <details class="dropdown"> |
| 52 | {{ $selectedNetwork := index $data $name }} |
| 53 | <summary id="{{ $name }}">{{ $selectedNetwork }}</summary> |
| 54 | <ul> |
| 55 | {{ range $networks }} |
| 56 | {{ $selected := eq $selectedNetwork .Name }} |
| 57 | <li> |
| 58 | <label> |
| gio | f6ad298 | 2024-08-23 17:42:49 +0400 | [diff] [blame] | 59 | <input type="radio" name="{{ $name }}" oninput="networkSelected('{{ $name }}', '{{ .Name }}', '{{ .Name }} - {{ .Domain }}', this.checked)" {{ if $selected }}checked{{ end }} /> |
| 60 | {{ .Name }} - {{ .Domain }} |
| gio | bb338e2 | 2024-07-18 18:09:22 +0400 | [diff] [blame] | 61 | </label> |
| 62 | </li> |
| 63 | {{ end }} |
| 64 | </ul> |
| 65 | </details> |
| Giorgi Lekveishvili | a09fad7 | 2024-03-21 15:24:35 +0400 | [diff] [blame] | 66 | </label> |
| gio | 4ece99c | 2024-07-18 11:05:50 +0400 | [diff] [blame] | 67 | {{ else if eq $schema.Kind 10 }} |
| 68 | <label {{ if $schema.Advanced }}hidden{{ end }}> |
| 69 | {{ $schema.Name }} |
| 70 | <details class="dropdown"> |
| 71 | {{ $selectedNetworks := index $data $name }} |
| 72 | <summary id="{{ $name }}">{{ $selectedNetworks | join "," }}</summary> |
| 73 | <ul> |
| 74 | {{ range $networks }} |
| 75 | {{ $networkName := .Name }} |
| 76 | {{ $selected := false }} |
| 77 | {{ range $selectedNetworks }} |
| 78 | {{ if eq . $networkName }} |
| 79 | {{ $selected = true }} |
| 80 | {{ end }} |
| 81 | {{ end }} |
| 82 | <li> |
| 83 | <label> |
| 84 | <input type="checkbox" name="{{ $networkName }}" oninput="multiNetworkSelected('{{ $name }}', '{{ $networkName }}', this.checked)" {{ if $selected }}checked{{ end }} /> |
| gio | f6ad298 | 2024-08-23 17:42:49 +0400 | [diff] [blame] | 85 | {{ .Name }} - {{ .Domain }} |
| gio | 4ece99c | 2024-07-18 11:05:50 +0400 | [diff] [blame] | 86 | </label> |
| 87 | </li> |
| 88 | {{ end }} |
| 89 | </ul> |
| 90 | </details> |
| 91 | </label> |
| Giorgi Lekveishvili | a09fad7 | 2024-03-21 15:24:35 +0400 | [diff] [blame] | 92 | {{ else if eq $schema.Kind 5 }} |
| Giorgi Lekveishvili | a09fad7 | 2024-03-21 15:24:35 +0400 | [diff] [blame] | 93 | {{ $auth := index $data $name }} |
| 94 | {{ $authEnabled := false }} |
| 95 | {{ $authGroups := "" }} |
| 96 | {{ if and $auth (index $auth "enabled") }}{{ $authEnabled = true }}{{ end }} |
| 97 | {{ if and $auth (index $auth "groups") }}{{ $authGroups = index $auth "groups" }}{{ end }} |
| gio | 44f621b | 2024-04-29 09:44:38 +0400 | [diff] [blame] | 98 | <label {{ if $schema.Advanced }}hidden{{ end }}> |
| 99 | <input type="checkbox" role="swtich" name="authEnabled" oninput="valueChanged('{{- $name -}}.enabled', this.checked)" {{ if $readonly }}disabled{{ end }} {{ if $authEnabled }}checked{{ end }} /> |
| 100 | <span>Require authentication</span> |
| Giorgi Lekveishvili | a09fad7 | 2024-03-21 15:24:35 +0400 | [diff] [blame] | 101 | </label> |
| gio | 44f621b | 2024-04-29 09:44:38 +0400 | [diff] [blame] | 102 | <label for="authGroups"> |
| 103 | <span>Authentication groups</span> |
| 104 | <input type="text" name="authGroups" oninput="valueChanged('{{- $name -}}.groups', this.value)" {{ if $readonly }}disabled{{ end }} value="{{ $authGroups }}" /> |
| 105 | </label> |
| Giorgi Lekveishvili | b6a5806 | 2024-04-02 16:49:19 +0400 | [diff] [blame] | 106 | {{ else if eq $schema.Kind 6 }} |
| 107 | {{ $sshKey := index $data $name }} |
| 108 | {{ $public := "" }} |
| 109 | {{ $private := "" }} |
| 110 | {{ if $sshKey }}{{ $public = index $sshKey "public" }}{{ end }} |
| 111 | {{ if $sshKey }}{{ $private = index $sshKey "private" }}{{ end }} |
| gio | 44f621b | 2024-04-29 09:44:38 +0400 | [diff] [blame] | 112 | <label {{ if $schema.Advanced }}hidden{{ end }}> |
| 113 | <span>Public Key</span> |
| 114 | <textarea name="{{ $name }}-public" disabled>{{ $public }}</textarea> |
| Giorgi Lekveishvili | b6a5806 | 2024-04-02 16:49:19 +0400 | [diff] [blame] | 115 | </label> |
| gio | 44f621b | 2024-04-29 09:44:38 +0400 | [diff] [blame] | 116 | <label {{ if $schema.Advanced }}hidden{{ end }}> |
| 117 | <span>Private Key</span> |
| 118 | <textarea name="{{ $name }}-private" disabled>{{ $private }}</textarea> |
| Giorgi Lekveishvili | b6a5806 | 2024-04-02 16:49:19 +0400 | [diff] [blame] | 119 | </label> |
| Giorgi Lekveishvili | a09fad7 | 2024-03-21 15:24:35 +0400 | [diff] [blame] | 120 | {{ end }} |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 121 | {{ end }} |
| 122 | {{ end }} |
| 123 | |
| Davit Tabidze | 3ec24cf | 2024-05-22 14:06:02 +0400 | [diff] [blame] | 124 | {{ define "header" }} |
| Davit Tabidze | d1b742e | 2024-07-15 16:01:52 +0400 | [diff] [blame] | 125 | {{ .App.Icon }} |
| 126 | <h1>{{ .App.Name }}</h1> |
| Davit Tabidze | 3ec24cf | 2024-05-22 14:06:02 +0400 | [diff] [blame] | 127 | {{ end }} |
| gio | 18d5c68 | 2024-05-02 10:30:57 +0400 | [diff] [blame] | 128 | |
| Davit Tabidze | 3ec24cf | 2024-05-22 14:06:02 +0400 | [diff] [blame] | 129 | {{ define "extra_menu" }} |
| gio | 1cd6515 | 2024-08-16 08:18:49 +0400 | [diff] [blame] | 130 | <li><a href="/app/{{ .App.Slug }}" {{ if eq $.CurrentPage .App.Name }}class="primary"{{ end }}>{{ .App.Name }}</a></li> |
| 131 | {{ if (and (not $.Instance) $.Task) }} |
| 132 | <li><a href="/instance/{{ $.CurrentPage }}" class="primary">{{ $.CurrentPage }}</a></li> |
| 133 | {{ end }} |
| Davit Tabidze | 3ec24cf | 2024-05-22 14:06:02 +0400 | [diff] [blame] | 134 | {{ range .Instances }} |
| gio | 1cd6515 | 2024-08-16 08:18:49 +0400 | [diff] [blame] | 135 | <li><a href="/instance/{{ .Id }}" {{ if eq $.CurrentPage .Id }}class="primary"{{ end }}>{{ .Id }}</a></li> |
| gio | 778577f | 2024-04-29 09:44:38 +0400 | [diff] [blame] | 136 | {{ end }} |
| 137 | {{ end }} |
| 138 | |
| Davit Tabidze | 3ec24cf | 2024-05-22 14:06:02 +0400 | [diff] [blame] | 139 | {{ define "content"}} |
| 140 | {{ $schema := .App.Schema }} |
| 141 | {{ $networks := .AvailableNetworks }} |
| gio | f6ad298 | 2024-08-23 17:42:49 +0400 | [diff] [blame] | 142 | {{ $clusters := .AvailableClusters }} |
| Davit Tabidze | 3ec24cf | 2024-05-22 14:06:02 +0400 | [diff] [blame] | 143 | {{ $instance := .Instance }} |
| Davit Tabidze | 3ec24cf | 2024-05-22 14:06:02 +0400 | [diff] [blame] | 144 | |
| Davit Tabidze | 3ec24cf | 2024-05-22 14:06:02 +0400 | [diff] [blame] | 145 | <form id="config-form"> |
| 146 | {{ if $instance }} |
| gio | f6ad298 | 2024-08-23 17:42:49 +0400 | [diff] [blame] | 147 | {{ template "schema-form" (dict "Schema" $schema "AvailableNetworks" $networks "AvailableClusters" $clusters "ReadOnly" false "Data" ($instance.InputToValues $schema)) }} |
| Davit Tabidze | 3ec24cf | 2024-05-22 14:06:02 +0400 | [diff] [blame] | 148 | {{ else }} |
| gio | f6ad298 | 2024-08-23 17:42:49 +0400 | [diff] [blame] | 149 | {{ template "schema-form" (dict "Schema" $schema "AvailableNetworks" $networks "AvailableClusters" $clusters "ReadOnly" false "Data" (dict)) }} |
| Davit Tabidze | 3ec24cf | 2024-05-22 14:06:02 +0400 | [diff] [blame] | 150 | {{ end }} |
| 151 | {{ if $instance }} |
| 152 | <div class="grid"> |
| 153 | <button type="submit" id="submit" name="update">Update</button> |
| 154 | <button type="submit" id="uninstall" name="remove">Uninstall</button> |
| 155 | </div> |
| 156 | {{ else }} |
| 157 | <button type="submit" id="submit">{{ if $instance }}Update{{ else }}Install{{ end }}</button> |
| 158 | {{ end }} |
| 159 | </form> |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 160 | |
| 161 | <div id="toast-failure" class="toast hidden"> |
| 162 | <svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12s4.477 10 10 10Zm3-6L9 8m0 8l6-8"/></svg> {{ if $instance }}Update failed{{ else}}Install failed{{ end }} |
| 163 | </div> |
| 164 | |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 165 | <div id="toast-uninstall-failure" class="toast hidden"> |
| 166 | <svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12s4.477 10 10 10Zm3-6L9 8m0 8l6-8"/></svg> Failed to uninstall application |
| 167 | </div> |
| 168 | |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 169 | <script> |
| gio | 3cdee59 | 2024-04-17 10:15:56 +0400 | [diff] [blame] | 170 | let config = {{ if $instance }}JSON.parse({{ toJson ($instance.InputToValues $schema) }}){{ else }}{}{{ end }}; |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 171 | |
| Giorgi Lekveishvili | a09fad7 | 2024-03-21 15:24:35 +0400 | [diff] [blame] | 172 | function setValue(name, value, config) { |
| 173 | let items = name.split(".") |
| 174 | for (let i = 0; i < items.length - 1; i++) { |
| 175 | if (!(items[i] in config)) { |
| 176 | config[items[i]] = {} |
| 177 | } |
| 178 | config = config[items[i]]; |
| 179 | } |
| 180 | config[items[items.length - 1]] = value; |
| gio | 4ece99c | 2024-07-18 11:05:50 +0400 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | function getValue(name, value) { |
| 184 | let items = name.split(".") |
| 185 | for (let i = 0; i < items.length - 1; i++) { |
| 186 | if (!(items[i] in config)) { |
| 187 | config[items[i]] = {} |
| 188 | } |
| 189 | config = config[items[i]]; |
| 190 | } |
| 191 | return config[items[items.length - 1]]; |
| 192 | } |
| 193 | |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 194 | function valueChanged(name, value) { |
| Giorgi Lekveishvili | a09fad7 | 2024-03-21 15:24:35 +0400 | [diff] [blame] | 195 | setValue(name, value, config); |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 196 | } |
| 197 | |
| gio | f6ad298 | 2024-08-23 17:42:49 +0400 | [diff] [blame] | 198 | function clusterSelected(name, cluster, selected) { |
| 199 | console.log(selected); |
| 200 | setValue(name, cluster, config); |
| 201 | let summary = document.getElementById(name); |
| 202 | summary.innerHTML = cluster; |
| 203 | summary.parentNode.removeAttribute("open"); |
| 204 | } |
| 205 | |
| 206 | function networkSelected(name, network, label, selected) { |
| gio | bb338e2 | 2024-07-18 18:09:22 +0400 | [diff] [blame] | 207 | console.log(selected); |
| 208 | setValue(name, network, config); |
| 209 | let summary = document.getElementById(name); |
| gio | f6ad298 | 2024-08-23 17:42:49 +0400 | [diff] [blame] | 210 | summary.innerHTML = label; |
| gio | bb338e2 | 2024-07-18 18:09:22 +0400 | [diff] [blame] | 211 | summary.parentNode.removeAttribute("open"); |
| 212 | } |
| 213 | |
| gio | 4ece99c | 2024-07-18 11:05:50 +0400 | [diff] [blame] | 214 | function multiNetworkSelected(name, network, selected) { |
| 215 | let v = getValue(name, config); |
| 216 | if (v === undefined) { |
| 217 | v = []; |
| 218 | } |
| 219 | if (selected) { |
| 220 | v.push(network); |
| 221 | } else { |
| 222 | v = v.filter((n) => n != network); |
| 223 | } |
| 224 | setValue(name, v, config); |
| 225 | document.getElementById(name).innerHTML = v.join(","); |
| 226 | } |
| 227 | |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 228 | function disableForm() { |
| 229 | document.querySelectorAll("#config-form input").forEach((i) => i.setAttribute("disabled", "")); |
| 230 | document.querySelectorAll("#config-form select").forEach((i) => i.setAttribute("disabled", "")); |
| 231 | document.querySelectorAll("#config-form button").forEach((i) => i.setAttribute("disabled", "")); |
| 232 | } |
| 233 | |
| 234 | function enableForm() { |
| 235 | document.querySelectorAll("[aria-busy]").forEach((i) => i.removeAttribute("aria-busy")); |
| 236 | document.querySelectorAll("#config-form input").forEach((i) => i.removeAttribute("disabled")); |
| 237 | document.querySelectorAll("#config-form select").forEach((i) => i.removeAttribute("disabled")); |
| 238 | document.querySelectorAll("#config-form button").forEach((i) => i.removeAttribute("disabled")); |
| 239 | } |
| 240 | |
| 241 | function installStarted() { |
| 242 | const submit = document.getElementById("submit"); |
| 243 | submit.setAttribute("aria-busy", true); |
| 244 | submit.innerHTML = {{ if $instance }}"Updating ..."{{ else }}"Installing ..."{{ end }}; |
| 245 | disableForm(); |
| 246 | } |
| 247 | |
| 248 | function uninstallStarted() { |
| 249 | const submit = document.getElementById("uninstall"); |
| 250 | submit.setAttribute("aria-busy", true); |
| 251 | submit.innerHTML = "Uninstalling ..."; |
| 252 | disableForm(); |
| 253 | } |
| 254 | |
| 255 | function actionFinished(toast) { |
| 256 | enableForm(); |
| 257 | toast.classList.remove("hidden"); |
| 258 | setTimeout( |
| 259 | () => toast.classList.add("hidden"), |
| 260 | 2000, |
| 261 | ); |
| 262 | } |
| 263 | |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 264 | function installFailed() { |
| 265 | actionFinished(document.getElementById("toast-failure")); |
| 266 | } |
| 267 | |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 268 | function uninstallFailed() { |
| 269 | actionFinished(document.getElementById("toast-uninstall-failure")); |
| 270 | } |
| 271 | |
| gio | 44f621b | 2024-04-29 09:44:38 +0400 | [diff] [blame] | 272 | const submitAddr = {{ if $instance }}"/api/instance/{{ $instance.Id }}/update"{{ else }}"/api/app/{{ .App.Slug }}/install"{{ end }}; |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 273 | |
| 274 | async function install() { |
| 275 | installStarted(); |
| 276 | const resp = await fetch(submitAddr, { |
| gio | 778577f | 2024-04-29 09:44:38 +0400 | [diff] [blame] | 277 | method: "POST", |
| 278 | headers: { |
| 279 | "Content-Type": "application/json", |
| 280 | "Accept": "application/json", |
| 281 | }, |
| 282 | body: JSON.stringify(config), |
| 283 | }); |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 284 | if (resp.status === 200) { |
| gio | 778577f | 2024-04-29 09:44:38 +0400 | [diff] [blame] | 285 | window.location = await resp.text(); |
| 286 | } else { |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 287 | installFailed(); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | async function uninstall() { |
| 292 | {{ if $instance }} |
| 293 | uninstallStarted(); |
| 294 | const resp = await fetch("/api/instance/{{ $instance.Id }}/remove", { |
| 295 | method: "POST", |
| 296 | }); |
| 297 | if (resp.status === 200) { |
| gio | 778577f | 2024-04-29 09:44:38 +0400 | [diff] [blame] | 298 | window.location = await resp.text(); |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 299 | } else { |
| 300 | uninstallFailed(); |
| 301 | } |
| 302 | {{ end }} |
| 303 | } |
| 304 | |
| gio | f9f0bee | 2024-06-11 20:10:05 +0400 | [diff] [blame] | 305 | const configForm = document.getElementById("config-form"); |
| 306 | if (configForm) { |
| 307 | configForm.addEventListener("submit", (event) => { |
| 308 | event.preventDefault(); |
| 309 | if (event.submitter.id === "submit") { |
| 310 | install(); |
| 311 | } if (event.submitter.id === "uninstall") { |
| 312 | uninstall(); |
| 313 | } |
| 314 | }); |
| 315 | } |
| Giorgi Lekveishvili | 4257b90 | 2023-07-07 17:08:42 +0400 | [diff] [blame] | 316 | </script> |
| Davit Tabidze | 3ec24cf | 2024-05-22 14:06:02 +0400 | [diff] [blame] | 317 | |
| 318 | {{end}} |