diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-05-05 18:09:11 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-05-05 18:09:11 +0200 |
commit | b36ba45aef6ce3a62079064a900915a9e222acde (patch) | |
tree | 600467fbed7d3bfae6050fdbff90130a8dbf8385 /templates/webhooks.html.ep | |
parent | 55581d1f257eeff7e509cb03f3eeed7e2da6f3a9 (diff) |
WiP webhook support
Diffstat (limited to 'templates/webhooks.html.ep')
-rw-r--r-- | templates/webhooks.html.ep | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/templates/webhooks.html.ep b/templates/webhooks.html.ep new file mode 100644 index 0000000..fec485d --- /dev/null +++ b/templates/webhooks.html.ep @@ -0,0 +1,62 @@ +% if (my $invalid = stash('invalid')) { + %= include '_invalid_input', invalid => $invalid +% } + +<h1>Web Hooks</h1> + +<!-- -H "Authorization: Bearer ${TOKEN}" --> +<div class="row"> + <div class="col s12"> + <p> + Die im Web Hook konfigurierte URL wird bei jedem Checkin und Checkout + des ausgewählten Zuges aufgerufen. Falls ein Token eingetragen + ist, wird er als Bearer Token verwendet. + </p> + <p> + Events werden als JSON POST übertragen. Das JSON-Dokument besteht aus + zwei Feldern: „reason“ gibt den Grund des API-Aufrufs an (checkin, + checkout, undo), „status“ den <a href="/api">aktuellen Status</a>. + </p> + </div> + %= form_for '/account/hooks' => (method => 'POST') => begin + %= csrf_field + <div class="col s12 center-align"> + <label> + %= check_box enabled => 1 + <span>Aktiv</span> + </label> + </div> + <div class="input-field col s12"> + <i class="material-icons prefix">link</i> + %= text_field 'url', id => 'url', class => 'validate', maxlength => 1000 + <label for="url">URL</label> + </div> + <div class="input-field col s12"> + <i class="material-icons prefix">lock</i> + %= text_field 'token', id => 'token', class => 'validate', maxlength => 250 + <label for="token">Token</label> + </div> + <div class="col s12"> + % if ($hook->{latest_run}->epoch) { + Zuletzt ausgeführt: <%= $hook->{latest_run} %><br/> + % if ($hook->{errored}) { + <i class="material-icons left">error</i> + Status: <%= $hook->{output} %> + % } + % else { + <i class="material-icons left">check</i> + Server-Antwort: <%= $hook->{output} %> + % } + % } + % else { + Noch nicht ausgeführt. + % } + </div> + <div class="col s12 center-align"> + <button class="btn waves-effect waves-light" type="submit" name="action" value="save"> + Speichern + <i class="material-icons right">send</i> + </button> + </div> + %= end +</div> |