/
index.html
81 lines (81 loc) · 2.64 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html>
<head>
<title>File Upload</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
padding: 20px;
text-align: center;
}
form {
background-color: white;
padding: 20px;
border-radius: 8px;
display: inline-block;
margin-top: 20px;
}
select, input[type="file"] {
margin-top: 10px;
margin-bottom: 10px;
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #45a049;
}
label {
margin-top: 10px;
}
#response {
margin-top: 20px;
color: #333;
}
</style>
<script>
function submitForm(event) {
event.preventDefault();
var formData = new FormData(document.getElementById('uploadForm'));
fetch('/', {
method: 'POST',
body: formData
}).then(response => response.json())
.then(data => {
document.getElementById('response').innerHTML =
'Status: ' + (data.status_code === 200 ? 'Success' : 'Fail') +
'<br>Response: ' + data.text;
}).catch(error => {
document.getElementById('response').textContent = 'Error: ' + error;
});
}
</script>
</head>
<body>
<h2>Upload CSV File to Endpoint</h2>
<form id="uploadForm" onsubmit="submitForm(event)">
<label for="endpoint">Choose an endpoint:</label>
<select name="endpoint" id="endpoint">
<option value="http://localhost:1880/fileupload">CSV File Upload</option>
<!-- Add other endpoints here Examples below: -->
<option value="http://localhost:1880/fileupload">Shift Schedule</option>
<option value="http://localhost:1880/fileupload">Product Specification</option>
<option value="http://localhost:1880/fileupload">Scheduled Downtime</option>
<option value="http://localhost:1880/fileupload">Product Lineup</option>
</select>
<input type="file" name="file" required>
<input type="submit" value="Upload">
</form>
<div id="response"></div>
</body>
</html>