133 lines
3.9 KiB
HTML
133 lines
3.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Database Configuration Form</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
line-height: 1.6;
|
|
max-width: 600px;
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
}
|
|
|
|
input[type="text"] {
|
|
width: 100%;
|
|
padding: 8px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 4px;
|
|
box-sizing: border-box;
|
|
}
|
|
button {
|
|
background-color: #4caf50;
|
|
color: white;
|
|
padding: 10px 15px;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 16px;
|
|
}
|
|
button:hover {
|
|
background-color: #45a049;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Database Configuration</h1>
|
|
<form id="dbConfigForm">
|
|
<div class="form-group">
|
|
<label for="Bname">Base Name:</label>
|
|
<input
|
|
type="text"
|
|
id="Bname"
|
|
name="Bname"
|
|
required
|
|
aria-required="true"
|
|
/>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="pname">Path Name:</label>
|
|
<input type="text" id="pname" name="pname" required />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="org">Organization:</label>
|
|
<input type="text" id="org" name="org" required />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="Lang">Usable Language:</label>
|
|
<input type="text" id="Lang" name="Lang" required />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="type">Type of Database:</label>
|
|
<input type="text" id="type" name="type" required />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="DB">Database Name:</label>
|
|
<input type="text" id="DB" name="DB" required />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="name">Username:</label>
|
|
<input type="text" id="name" name="name" required />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="frame">Architecture:</label>
|
|
<input type="text" id="frame" name="frame" required />
|
|
</div>
|
|
|
|
<button type="submit">Submit Configuration</button>
|
|
</form>
|
|
<script>
|
|
document
|
|
.getElementById("dbConfigForm")
|
|
.addEventListener("submit", function (e) {
|
|
e.preventDefault(); // Prevent default form submit
|
|
|
|
const data = {
|
|
BaseName: document.getElementById("Bname").value,
|
|
pathName: document.getElementById("pname").value,
|
|
organization: document.getElementById("org").value,
|
|
useableLanguage: document.getElementById("Lang").value,
|
|
typeOfDB: document.getElementById("type").value,
|
|
DBName: document.getElementById("DB").value,
|
|
userName: document.getElementById("name").value,
|
|
architecture: document.getElementById("frame").value,
|
|
};
|
|
|
|
fetch("http://localhost:9696/createfolder", {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
body: JSON.stringify(data),
|
|
})
|
|
.then((response) => {
|
|
console.log("response: ", response);
|
|
if (!response.ok) {
|
|
throw new Error("Network response was not ok");
|
|
}
|
|
return response.json();
|
|
})
|
|
.then((data) => {
|
|
console.log("data: ", data);
|
|
alert("Folder created: " + data.path);
|
|
console.log(data);
|
|
})
|
|
.catch((error) => {
|
|
console.log("error: ", error);
|
|
console.error("Fetch error:", error);
|
|
alert("Failed to create folder.");
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|