Skip to content

Commit

Permalink
finalized for day 2
Browse files Browse the repository at this point in the history
  • Loading branch information
adenjonah committed May 22, 2024
1 parent 0595e6d commit a4639f6
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 265 deletions.
2 changes: 1 addition & 1 deletion server/json_databases/DCUUIA.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"timestamp": "2024-05-22T08:08:08.215779", "dcu": {"eva1": {"batt": false, "oxy": false, "comm": false, "fan": false, "pump": false, "co2": false}, "eva2": {"batt": false, "oxy": false, "comm": false, "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}}
{"timestamp": "2024-05-22T08:17:18.775209", "dcu": {"eva1": {"batt": false, "oxy": false, "comm": false, "fan": false, "pump": false, "co2": false}, "eva2": {"batt": false, "oxy": false, "comm": false, "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}}
48 changes: 1 addition & 47 deletions server/json_databases/geojson/user_pins.json
Original file line number Diff line number Diff line change
@@ -1,47 +1 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"Name": "Eva1 @ 5126"
},
"geometry": {
"coordinates": [
-95.08173200489527,
29.56480501479513
],
"type": "Point"
},
"id": 5126
},
{
"type": "Feature",
"properties": {
"Name": "Eva1 @ 5312"
},
"geometry": {
"coordinates": [
-95.08173200489527,
29.56480501479513
],
"type": "Point"
},
"id": 5312
},
{
"type": "Feature",
"properties": {
"Name": "Eva1 @ 5335"
},
"geometry": {
"coordinates": [
-95.08173200489527,
29.56480501479513
],
"type": "Point"
},
"id": 5335
}
]
}
{"type": "FeatureCollection", "features": []}
64 changes: 24 additions & 40 deletions server/json_databases/saved_rocks.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,35 @@
{
"saved rocks": [
{
"name": "pigeonite_basalt",
"id": 5,
"name": "default_rock",
"id": 0,
"data": {
"SiO2": 39.41,
"TiO2": 0.39,
"Al2O3": 1.94,
"FeO": 29.3,
"MnO": 0.71,
"MgO": 19.27,
"CaO": 3.8,
"K2O": 0.12,
"P2O3": 0.3,
"other": 4.76
"SiO2": 1,
"TiO2": 1,
"Al2O3": 1,
"FeO": 1,
"MnO": 1,
"MgO": 1,
"CaO": 1,
"K2O": 1,
"P2O3": 1,
"other": 91
}
},
{
"name": "ilmenite_basalt",
"id": 7,
"name": "default_rock",
"id": 0,
"data": {
"SiO2": 43.98,
"TiO2": 1.04,
"Al2O3": 5.75,
"FeO": 20.4,
"MnO": 0.51,
"MgO": 6.02,
"CaO": 8.89,
"K2O": 0.71,
"P2O3": 1.09,
"other": 11.61
}
},
{
"name": "ilmenite_basalt",
"id": 7,
"data": {
"SiO2": 43.98,
"TiO2": 1.04,
"Al2O3": 5.75,
"FeO": 20.4,
"MnO": 0.51,
"MgO": 6.02,
"CaO": 8.89,
"K2O": 0.71,
"P2O3": 1.09,
"other": 11.61
"SiO2": 1,
"TiO2": 1,
"Al2O3": 1,
"FeO": 1,
"MnO": 1,
"MgO": 1,
"CaO": 1,
"K2O": 1,
"P2O3": 1,
"other": 91
}
}
]
Expand Down
23 changes: 23 additions & 0 deletions server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,29 @@ async def save_spec():
return {"message": "Data saved successfully"}
else:
raise HTTPException(status_code=response.status_code, detail="Failed to retrieve data")

@app.post("/save_rover_spec")
async def save_spec():
async with httpx.AsyncClient() as client:
response = await client.get('http://localhost:8000/get_rover_spec_scan')

if response.status_code == 200:
data = response.json()

# Load existing data
with open(SAVED_ROCKS_FILE, 'r') as file:
saved_data = json.load(file)

# Append new data to the "saved rocks" array
saved_data["saved rocks"].append(data)

# Save updated data
with open(SAVED_ROCKS_FILE, 'w') as file:
json.dump(saved_data, file, indent=4)

return {"message": "Data saved successfully"}
else:
raise HTTPException(status_code=response.status_code, detail="Failed to retrieve data")


@app.get("/get_spec")
Expand Down
131 changes: 76 additions & 55 deletions src/pages-style/rover.css
Original file line number Diff line number Diff line change
@@ -1,92 +1,113 @@
.page-container {
display: grid;
#page-container {
display: flex;
flex-direction: row;
height: 90vh;
width: 100vw;
}


.header-rover {
text-align: center;
padding: 20px;
background-color: #f8f9fa;
font-size: 1.5rem;
font-weight: bold;
color: #333;
box-sizing: border-box;
}

.content-rover {
display: grid;
grid-template-columns: 60% 40%;
height: 100%;
#left-column, #right-column {
display: flex;
flex-direction: column;
width: 50%;
margin: 10px;
background-color: rgb(72, 72, 244);
border-radius: 20px;
padding: 20px;
box-sizing: border-box;
justify-content: space-around;
align-items: center;
}

.left-column-rover {
#rover-cam-container, #map-container {
width: 100%;
height: 45%;
display: flex;
border-right: 1px solid #ddd;
justify-content: center;
align-items: center;
background-color: lightblue;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
padding: 20px;
box-sizing: border-box;
}

.rover-cam-container,
.map-container {
#right-column {
width: 50%;
margin: 10px;
background-color: rgb(72, 72, 244);
border-radius: 20px;
padding: 20px;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: #eef;
overflow: hidden;
}

.map-container {
flex: 1;
#data-container {
width: 100%;
height: 65%;
display: flex;
justify-content: center;
align-items: center;
background-color: #f0f8ff;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 20px;
box-sizing: border-box;
overflow: auto;
}

.rover-cam-container {
table {
width: 100%;
border-collapse: collapse;
}

#rovMap {
width: 100%;
height: 100%;
thead {
background-color: #f2f2f2;
}

.right-column-rover {
display: flex;
flex-direction: column;
padding: 20px;
background-color: #f8f9fa;
overflow-y: auto;
th, td {
padding: 10px;
border: 1px solid #ddd;
}

.rover-video {
flex: 1;
margin-bottom: 20px;
tr:nth-child(even) {
background-color: #f9f9f9;
}

.table {
#button-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 30%;
width: 100%;
border-collapse: collapse;
margin: 20px 0;
font-size: 0.8rem; /* Decreased font size */
margin-top: 20px;
}

.table-row {
.action-button {
text-align: center;
width: 48%;
height: 30%;
background-color: lightblue;
color: white;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
border-radius: 5px;
cursor: pointer;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
transition: background-color 0.3s;
}

.table-cell,
.table-header {
flex: 1;
padding: 5px; /* Decreased padding */
border: 1px solid #ddd;
text-align: left;
.action-button:hover {
background-color: darkblue;
}

.table-header {
background-color: #f2f2f2;
font-weight: bold;
#right-column p {
margin-top: 10px;
color: white;
}

.table-row:nth-child(even) .table-cell {
background-color: #f9f9f9;
}
Loading

0 comments on commit a4639f6

Please sign in to comment.