Implement distribution management API and UI forms; add distribution model and tests
This commit is contained in:
36
templates/ScenarioForm.html
Normal file
36
templates/ScenarioForm.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Scenario Management</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Create a New Scenario</h1>
|
||||
<form id="scenario-form">
|
||||
<label>Name: <input type="text" name="name" id="name" required /></label
|
||||
><br />
|
||||
<label
|
||||
>Description:
|
||||
<input type="text" name="description" id="description" /></label
|
||||
><br />
|
||||
<button type="submit">Create Scenario</button>
|
||||
</form>
|
||||
<div id="result"></div>
|
||||
<script>
|
||||
document
|
||||
.getElementById("scenario-form")
|
||||
.addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
const name = document.getElementById("name").value;
|
||||
const description = document.getElementById("description").value;
|
||||
const resp = await fetch("/api/scenarios/", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ name, description }),
|
||||
});
|
||||
const data = await resp.json();
|
||||
document.getElementById("result").innerText = JSON.stringify(data);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user