Init commit

This commit is contained in:
2025-11-02 13:11:42 -08:00
commit 650b481463
16 changed files with 983 additions and 0 deletions

87
files/dashboard/index.php Normal file
View File

@ -0,0 +1,87 @@
<?php
// Function to fetch SSD information from the API
function fetchSSDData() {
$url = 'http://172.17.0.1:5000/drives';
$options = [
'http' => [
'header' => "Content-type: application/json\r\n",
'method' => 'GET',
],
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) {
die('Error Fetching data');
}
return json_decode($result, true); // Decode JSON as an associative array
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>SSD Health Dashboard</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>SSD Health Dashboard</h1>
<?php
$i=0;
$ssdData = fetchSSDData(); // Fetch data from the API
echo '<div class="group-columns">';
foreach ($ssdData as $ssd):
if ($i % 2 == 0) {
echo '</div><div class="group-columns">';
}
echo <<<EOL
<div class="meter">
<table>
<tr><td align ="right">
Disk ID:
</td><td align ="left">
{$ssd['id']}
</td></tr><tr>
<tr><td align ="right">
Model String:
</td><td align ="left">
{$ssd['model']}
</td></tr><tr>
<tr><td align ="right">
Serial Number:
</td><td align ="left">
{$ssd['serial']}
</td></tr><tr>
<tr><td align ="right">
TB Written:
</td><td align ="left">
{$ssd['TBW']}
</td></tr><tr>
<tr><td align ="right">
Disk Capacity:
</td><td align ="left">
{$ssd['capacity']}
</td></tr><tr>
<tr><td align ="right">
Disk Flavor:
</td><td align ="left">
{$ssd['flavor']}
</td></tr><tr>
<tr><td align ="right">
SMART Result:
</td><td align ="left">
{$ssd['smart']}
</td></tr>
</table>
</div>
EOL;
$i++;
endforeach;
echo '</div>';
?>
</div>
</body>
</html>

View File

@ -0,0 +1,80 @@
/* styles.css */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #2c3e50; /* Dark background color */
color: #bdc3c7; /* Dimmer text color */
}
.hidden-info {
display: none;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #34495e; /* Darker background for container */
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); /* Slightly darker shadow */
margin-top: 20px;
}
h1, h2, h3, h4 {
color: #bdc3c7; /* Dimmer text color */
}
ul {
list-style-type: none;
padding: 0;
}
li {
margin-bottom: 10px;
color: #bdc3c7; /* Dimmer text color */
}
.group-columns {
display: flex;
}
.group-rows {
display: flex;
flex-wrap: wrap;
justify-content: flex-start; /* Left justification */
margin-top: 10px;
}
.group-column {
flex: 0 0 calc(33% - 10px); /* Adjust width of each column */
}
.column {
flex: 1;
padding: 0 10px; /* Adjust spacing between columns */
}
.subcolumn {
margin-left: 10px;
}
.grid {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: 5px;
}
.meter {
width: calc(90% - 5px);
max-width: calc(45% - 5px);
margin-bottom: 5px;
border: 1px solid #7f8c8d; /* Light border color */
border-radius: 5px;
padding: 5px;
text-align: center;
background-color: #2c3e50; /* Dark background for meter */
}