-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-api.html
More file actions
72 lines (66 loc) · 2.51 KB
/
Copy pathtest-api.html
File metadata and controls
72 lines (66 loc) · 2.51 KB
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
<!DOCTYPE html>
<html>
<head>
<title>API Test</title>
<style>
body { font-family: Arial; padding: 20px; }
.test { margin: 10px 0; padding: 10px; border: 1px solid #ccc; }
.success { background: #d4edda; }
.error { background: #f8d7da; }
button { padding: 10px 20px; margin: 5px; cursor: pointer; }
</style>
</head>
<body>
<h1>Backend API Test</h1>
<button onclick="testHealth()">Test Health Endpoint</button>
<button onclick="testStatistics()">Test Statistics Endpoint</button>
<button onclick="testPartitions()">Test Partitions Endpoint</button>
<div id="results"></div>
<script>
function addResult(title, success, data) {
const div = document.createElement('div');
div.className = 'test ' + (success ? 'success' : 'error');
div.innerHTML = `
<h3>${title}</h3>
<pre>${JSON.stringify(data, null, 2)}</pre>
`;
document.getElementById('results').appendChild(div);
}
async function testHealth() {
try {
const response = await fetch('http://localhost:8080/api/disk/health');
const data = await response.text();
addResult('Health Check', response.ok, { status: response.status, data });
} catch (error) {
addResult('Health Check', false, { error: error.message });
}
}
async function testStatistics() {
try {
const response = await fetch('http://localhost:8080/api/disk/statistics');
const data = await response.json();
addResult('Statistics', response.ok, data);
} catch (error) {
addResult('Statistics', false, { error: error.message });
}
}
async function testPartitions() {
try {
const response = await fetch('http://localhost:8080/api/partition/health');
const data = await response.json();
addResult('Partitions Health', response.ok, data);
} catch (error) {
addResult('Partitions Health', false, { error: error.message });
}
}
// Auto test on load
window.onload = () => {
setTimeout(() => {
testHealth();
setTimeout(() => testStatistics(), 500);
setTimeout(() => testPartitions(), 1000);
}, 500);
};
</script>
</body>
</html>