Enable CORS for dashboard

هذا الالتزام موجود في:
2026-07-28 18:29:19 +00:00
الأصل 5e49b44bca
التزام 8fcc265189
5 ملفات معدلة مع 184 إضافات و2 حذوفات

34
dashboard/index.html Normal file
عرض الملف

@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>Ghaymah SRE Dashboard</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Ghaymah SRE Dashboard</h1>
<div class="card">
<h2>Status</h2>
<p id="status">Checking...</p>
<h2>Response Time</h2>
<p id="response">-</p>
<h2>Total Requests</h2>
<p id="requests">-</p>
</div>
<script src="script.js"></script>
</body>
</html>

67
dashboard/script.js Normal file
عرض الملف

@@ -0,0 +1,67 @@
const API_URL =
"https://ghaymah-sre-api-20e343cababc.hosted.ghaymah.systems";
async function checkApplication(){
try {
let start = Date.now();
let healthResponse =
await fetch(API_URL + "/health");
let end = Date.now();
let responseTime =
end - start;
let statsResponse =
await fetch(API_URL + "/stats");
let stats =
await statsResponse.json();
document.getElementById("status").innerHTML =
healthResponse.ok ? "UP" : "DOWN";
document.getElementById("response").innerHTML =
responseTime + " ms";
document.getElementById("requests").innerHTML =
stats.requests;
}
catch(error){
document.getElementById("status").innerHTML =
"DOWN";
console.log(error);
}
}
checkApplication();
setInterval(
checkApplication,
30000
);

32
dashboard/style.css Normal file
عرض الملف

@@ -0,0 +1,32 @@
body {
font-family: Arial, sans-serif;
text-align: center;
background: #f4f4f4;
}
h1 {
margin-top: 40px;
}
.card {
background: white;
width: 350px;
margin: 40px auto;
padding: 25px;
border-radius: 10px;
}
p {
font-size: 22px;
}