Add UI console and spare forecast naming
This commit is contained in:
73
internal/api/ui_ingest.tmpl
Normal file
73
internal/api/ui_ingest.tmpl
Normal file
@@ -0,0 +1,73 @@
|
||||
{{define "ingest"}}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
{{template "head" .}}
|
||||
<body>
|
||||
{{template "topbar" .}}
|
||||
|
||||
<main class="container">
|
||||
<section class="card">
|
||||
<h2>Logbundle Ingest</h2>
|
||||
<form class="form" data-endpoint="/ingest/logbundle">
|
||||
<div class="field">
|
||||
<label for="logbundle">Payload (JSON)</label>
|
||||
<textarea class="input" id="logbundle" name="payload" rows="10">{{.LogbundlePayload}}</textarea>
|
||||
</div>
|
||||
<button class="button" type="submit">Send Logbundle</button>
|
||||
<pre class="meta" data-response></pre>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Ticket Sync</h2>
|
||||
<form class="form" data-endpoint="/connectors/tickets/sync">
|
||||
<div class="field">
|
||||
<label for="tickets">Payload (JSON)</label>
|
||||
<textarea class="input" id="tickets" name="payload" rows="10">{{.TicketPayload}}</textarea>
|
||||
</div>
|
||||
<button class="button" type="submit">Sync Tickets</button>
|
||||
<pre class="meta" data-response></pre>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Failure Ingest</h2>
|
||||
<form class="form" data-endpoint="/ingest/failures">
|
||||
<div class="field">
|
||||
<label for="failures">Payload (JSON)</label>
|
||||
<textarea class="input" id="failures" name="payload" rows="10">{{.FailurePayload}}</textarea>
|
||||
</div>
|
||||
<button class="button" type="submit">Send Failures</button>
|
||||
<pre class="meta" data-response></pre>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
const forms = document.querySelectorAll("form[data-endpoint]");
|
||||
forms.forEach((form) => {
|
||||
form.addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
const endpoint = form.getAttribute("data-endpoint");
|
||||
const textarea = form.querySelector("textarea[name='payload']");
|
||||
const output = form.querySelector("[data-response]");
|
||||
if (!endpoint || !textarea || !output) return;
|
||||
|
||||
output.textContent = "Sending...";
|
||||
try {
|
||||
const response = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: textarea.value,
|
||||
});
|
||||
const text = await response.text();
|
||||
output.textContent = `${response.status} ${response.statusText}\n${text}`;
|
||||
} catch (err) {
|
||||
output.textContent = `Request failed: ${err}`;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user