Skip to content

Commit

Permalink
Add rover selection functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
japsuu committed Oct 18, 2024
1 parent 9f8d7c9 commit 0fe300f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 2 additions & 3 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ <h1>GNSS Status</h1>
</select>
</div>

<div>
<div id="selectedRoverContainer">
<label for="selectedRoverDropdown">Selected Rover</label>
<select id="selectedRoverDropdown">
</select>
<select id="selectedRoverDropdown"></select>
</div>

<div class="chart-container">
Expand Down
14 changes: 12 additions & 2 deletions web/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ const manualYRangeInput = document.getElementById('manualYRangeInput');
const showOnlyRtkFixCheckbox = document.getElementById('showOnlyRtkFixCheckbox');
const showThresholdInput = document.getElementById('showThresholdInput');
const displayModeDropdown = document.getElementById('displayModeDropdown');
const selectedRoverContainer = document.getElementById('selectedRoverContainer');
const selectedRoverDropdown = document.getElementById('selectedRoverDropdown');
const downloadButton = document.getElementById('downloadButton');
const datePicker = document.getElementById('datePicker');
Expand Down Expand Up @@ -224,6 +225,9 @@ async function refreshData() {
return;
}

selectedRoverContainer.classList.add('hidden');
selectedRoverDropdown.innerHTML = '<option>No rovers available</option>';

const data = await fetchData(dataStart);

if (data.availableRovers.length === 0) {
Expand All @@ -236,6 +240,8 @@ async function refreshData() {
return;
}

selectedRoverContainer.classList.remove('hidden');

// Update the available rovers
availableRovers = data.availableRovers;

Expand Down Expand Up @@ -336,8 +342,7 @@ autoScaleXCheckbox.addEventListener('change', () => {
});

autoScaleYCheckbox.addEventListener('change', () => {
const autoScale = autoScaleYCheckbox.checked;
autoScaleY = autoScale;
autoScaleY = autoScaleYCheckbox.checked;

updateGraphRanges()
});
Expand Down Expand Up @@ -366,6 +371,11 @@ displayModeDropdown.addEventListener('change', async () => {
await forceRefreshData();
});

selectedRoverDropdown.addEventListener('change', () => {
selectedRover = selectedRoverDropdown.value;
refreshInterface();
});

downloadButton.addEventListener('click', async () => {
const selectedDate = new Date(datePicker.value);
const dayStartLocal = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), selectedDate.getDate(), 0, 0, 0, 0);
Expand Down

0 comments on commit 0fe300f

Please sign in to comment.