-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
207 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"timestamp": "2024-05-20T05:46:01.705067", "dcu": {"eva1": {"batt": false, "oxy": true, "comm": false, "fan": true, "pump": false, "co2": false}, "eva2": {"batt": false, "oxy": false, "comm": true, "fan": false, "pump": false, "co2": false}}, "uia": {"eva1_power": false, "eva1_oxy": false, "eva1_water_supply": false, "eva1_water_waste": false, "eva2_power": false, "eva2_oxy": false, "eva2_water_supply": false, "eva2_water_waste": false, "oxy_vent": false, "depress": false}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-95.08141793795379, 29.564580908696907], [-95.0814563954045, 29.56467675123534], [-95.0814797733473, 29.56480640650252], [-95.08157335667411, 29.564815758720055], [-95.08157234926806, 29.56492419510491], [-95.08157315565839, 29.564959141875754]]}, "properties": {"name": "Rover Path"}}]} | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {"Name": "hey"}, "geometry": {"coordinates": [-95.08133613847313, 29.56504641409886], "type": "Point"}, "id": 102}]} | ||
{"type": "FeatureCollection", "features": []} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import "./constant.css"; | ||
import "./dcuuia.css"; | ||
|
||
const DCUUIA = () => { | ||
const [data, setData] = useState(null); | ||
const [hasError, setHasError] = useState(false); | ||
|
||
useEffect(() => { | ||
const fetchData = () => { | ||
fetch('http://localhost:8000/dcu_uia') | ||
.then(response => response.json()) | ||
.then(data => { | ||
setData(data); | ||
setHasError(false); | ||
}) | ||
.catch(error => { | ||
console.error('Error fetching DCU/UIA data:', error); | ||
setHasError(true); | ||
}); | ||
}; | ||
|
||
fetchData(); | ||
const interval = setInterval(fetchData, 10000); // Adjust the interval as needed | ||
return () => clearInterval(interval); | ||
}, []); | ||
|
||
if (hasError) { | ||
return <div>Error fetching DCU/UIA data</div>; | ||
} | ||
|
||
if (!data) { | ||
return <div>Loading...</div>; | ||
} | ||
|
||
const renderStatus = (status) => ( | ||
<span id={status ? 'status-indicator-green' : 'status-indicator-red'}> | ||
{status ? 'Online' : 'Offline'} | ||
</span> | ||
); | ||
|
||
return ( | ||
<div id="dcu-uia-container"> | ||
<div id="status-section"> | ||
<h3>DCU Status</h3> | ||
<div id="status-grid"> | ||
<div id="status-item">EVA1 Battery: {renderStatus(data.dcu.eva1.batt)}</div> | ||
<div id="status-item">EVA1 Oxygen: {renderStatus(data.dcu.eva1.oxy)}</div> | ||
<div id="status-item">EVA1 Comm: {renderStatus(data.dcu.eva1.comm)}</div> | ||
<div id="status-item">EVA1 Fan: {renderStatus(data.dcu.eva1.fan)}</div> | ||
<div id="status-item">EVA1 Pump: {renderStatus(data.dcu.eva1.pump)}</div> | ||
<div id="status-item">EVA1 CO2: {renderStatus(data.dcu.eva1.co2)}</div> | ||
<div id="status-item">EVA2 Battery: {renderStatus(data.dcu.eva2.batt)}</div> | ||
<div id="status-item">EVA2 Oxygen: {renderStatus(data.dcu.eva2.oxy)}</div> | ||
<div id="status-item">EVA2 Comm: {renderStatus(data.dcu.eva2.comm)}</div> | ||
<div id="status-item">EVA2 Fan: {renderStatus(data.dcu.eva2.fan)}</div> | ||
<div id="status-item">EVA2 Pump: {renderStatus(data.dcu.eva2.pump)}</div> | ||
<div id="status-item">EVA2 CO2: {renderStatus(data.dcu.eva2.co2)}</div> | ||
</div> | ||
</div> | ||
<div id="status-section"> | ||
<h3>UIA Status</h3> | ||
<div id="status-grid"> | ||
<div id="status-item">EVA1 Power: {renderStatus(data.uia.eva1_power)}</div> | ||
<div id="status-item">EVA1 Oxygen: {renderStatus(data.uia.eva1_oxy)}</div> | ||
<div id="status-item">EVA1 Water Supply: {renderStatus(data.uia.eva1_water_supply)}</div> | ||
<div id="status-item">EVA1 Water Waste: {renderStatus(data.uia.eva1_water_waste)}</div> | ||
<div id="status-item">EVA2 Power: {renderStatus(data.uia.eva2_power)}</div> | ||
<div id="status-item">EVA2 Oxygen: {renderStatus(data.uia.eva2_oxy)}</div> | ||
<div id="status-item">EVA2 Water Supply: {renderStatus(data.uia.eva2_water_supply)}</div> | ||
<div id="status-item">EVA2 Water Waste: {renderStatus(data.uia.eva2_water_waste)}</div> | ||
<div id="status-item">Oxygen Vent: {renderStatus(data.uia.oxy_vent)}</div> | ||
<div id="status-item">Depress: {renderStatus(data.uia.depress)}</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DCUUIA; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#dcu-uia-container { | ||
padding: 20px; | ||
background-color: #f5f5f5; | ||
border-radius: 12px; /* Softer rounded edges */ | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
height: 100%; | ||
} | ||
|
||
h2 { | ||
text-align: center; | ||
margin-bottom: 20px; | ||
font-size: 1.25rem; /* Slightly smaller font */ | ||
} | ||
|
||
#status-section { | ||
margin-bottom: 20px; | ||
padding: 0; | ||
} | ||
|
||
#status-section h3 { | ||
margin-bottom: 5px; /* Adjusted for smaller spacing */ | ||
margin-top: 0; | ||
color: #333; | ||
font-size: 1rem; /* Slightly smaller font */ | ||
} | ||
|
||
#status-grid { | ||
display: grid; | ||
grid-template-columns: 1fr 1fr 1fr; | ||
gap: 5px; | ||
} | ||
|
||
#status-item { | ||
display: flex; | ||
height: 35px; /* Slightly shorter height */ | ||
flex-direction: row; | ||
justify-content: space-between; | ||
align-items: center; | ||
padding: 5px; /* Slightly smaller padding */ | ||
background-color: #fff; | ||
border: 1px solid #ddd; | ||
border-radius: 8px; /* Softer rounded edges */ | ||
font-size: 0.9rem; /* Slightly smaller font */ | ||
} | ||
|
||
#status-indicator { | ||
height: 20px; | ||
width: 50px; | ||
padding: 3px 10px; | ||
border-radius: 8px; /* Softer rounded edges */ | ||
color: white; | ||
border: 1px solid #ddd; | ||
font-weight: bold; | ||
font-size: 0.9rem; /* Slightly smaller font */ | ||
} | ||
|
||
#status-indicator-green { | ||
background-color: #4caf50; | ||
padding: 5px; | ||
border-radius: 8px; /* Softer rounded edges */ | ||
} | ||
|
||
#status-indicator-red { | ||
background-color: #f44336; | ||
padding: 5px; | ||
border-radius: 8px; /* Softer rounded edges */ | ||
} | ||
|
Oops, something went wrong.