Basic disk page implementation

+ Basic information about the disk
This commit is contained in:
2024-01-22 23:12:15 +02:00
parent f17d8b44a3
commit 145362b7ef
2 changed files with 35 additions and 36 deletions

View File

@@ -12,47 +12,31 @@
<div class="container-titlebar">
<div class="pad">
<h4>Available Disks</h4>
<h4>{{ .hdd.Model }} <span class="grooved">{{ .hdd.Size }}</span></h4>
</div>
</div>
<div class="container-body">
<div class="pad">
{{ if len .drives }}
<table id="disks-table">
<thead>
<tr>
<td>ID</td>
<td>Name</td>
<td>Model</td>
<td>Serial</td>
<td>Temperature</td>
</tr>
</thead>
<tbody id="disk-table-body">
{{ range .drives }}
{{ $temp := .GetTemperature }}
<tr>
<td>#{{ .ID }}</td>
<td> {{ .Name }}</td>
<td> {{ .Model }}</td>
<td> {{ .Serial }}</td>
{{ if gt $temp 50 }} <!-- Temperature greater than 50°C -->
<td style="color: red;">{{ $temp }}&deg;C</td>
{{ else if gt $temp 30 }} <!-- Temperature between 31°C and 50°C -->
<td style="color: orange;">{{ $temp }}&deg;C</td>
{{ else }} <!-- Temperature 30°C or below -->
<td style="color: lime;">{{ $temp }}&deg;C</td>
{{ end }}
</tr>
{{ end }}
</tbody>
</table>
{{ else }}
<p>No hard drives found.</p>
{{ end }}
<table id="disks-table">
<thead>
<tr>
<td>ID</td>
<td>Name</td>
<td>Model</td>
<td>Serial</td>
<td>Temperature</td>
</tr>
</thead>
<tbody id="disk-table-body">
<tr>
<td>#{{ .hdd.ID }}</td>
<td> {{ .hdd.Name }}</td>
<td> {{ .hdd.Model }}</td>
<td> {{ .hdd.Serial }}</td>
</tr>
</tbody>
</table>
</div>
</div>