Skip to content

Commit

Permalink
Fix scan link
Browse files Browse the repository at this point in the history
  • Loading branch information
dwot committed Jan 8, 2025
1 parent 1741d92 commit c66fe05
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions web/templates/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@
<!-- Sensors dynamically loaded here -->
</div>

<!-- Sensors Section -->
<div class="my-5">

</div>

<!-- Plants Table Section -->
<!-- Plants Table Section -->
<div class="my-5">
<h3 class="text-secondary mb-4">{{ .lcl.plants_overview }}</h3>
<div class="table-responsive">
Expand Down Expand Up @@ -95,12 +90,14 @@ <h3 class="text-secondary mb-4">{{ .lcl.plants_overview }}</h3>
document.addEventListener("DOMContentLoaded", async () => {
const sensorsOverview = document.getElementById("sensorsOverview");

// Define titles for each group
const groupTitles = {
Other: {{ .lcl.title_group_other }},
ACIP: {{ .lcl.title_group_acip }},
Soil: {{ .lcl.title_group_soil }}
};

// Create spinner element
const spinner = document.createElement("div");
spinner.classList.add("spinner-border", "text-primary");
spinner.setAttribute("role", "status");
Expand Down Expand Up @@ -257,6 +254,18 @@ <h4 class="text-secondary mb-3">${zone}</h4>
zoneContainer.appendChild(cardRow);
sensorsOverview.appendChild(zoneContainer);
});

// Add click event to sensor rows
console.time("Add Click Events");
document.querySelectorAll(".sensor-row").forEach((row) => {
row.addEventListener("click", () => {
const sensorId = row.getAttribute("data-id");
if (sensorId) {
window.location.href = `/graph/${sensorId}`;
}
});
});

} catch (error) {
console.error("Error fetching data:", error);
}
Expand Down

0 comments on commit c66fe05

Please sign in to comment.