Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ase docker #49

Open
wants to merge 327 commits into
base: main
Choose a base branch
from
Open
Changes from 8 commits
Commits
Show all changes
327 commits
Select commit Hold shift + click to select a range
fa5866a
new changes with api
hebronh Nov 30, 2023
2748e60
Merge branch 'issue50' into 49-design-dashboard
hebronh Nov 30, 2023
301580d
list_report2
Nov 30, 2023
082aa54
Fixing merge conflicts
sr259 Nov 30, 2023
c27c19a
new cards
hebronh Dec 1, 2023
7550b06
Made some changes to report dashboard
sr259 Dec 1, 2023
e60f4ab
better formatted cards
hebronh Dec 1, 2023
b12bf7a
all cards containing fuzzy testing in green
hebronh Dec 1, 2023
4c9bc87
card components with buttons
hebronh Dec 1, 2023
bc719f6
Made the temporary version where each part of the file is actually ju…
sr259 Dec 1, 2023
44a6edf
updated intervals and button cards
hebronh Dec 1, 2023
ccc5ff8
updated button alignment
yashaswini-slu Dec 2, 2023
8b20e98
Merge pull request #47 from oss-slu/24-ui-gps-details
yashaswini-slu Dec 2, 2023
cc21d90
removed simulation server from root again
hebronh Dec 2, 2023
c201661
base64
Dec 2, 2023
c5ee685
added status to home page
yashaswini-slu Dec 2, 2023
bd419d9
added api call
yashaswini-slu Dec 2, 2023
158ad21
grabbing kalebs code
sr259 Dec 3, 2023
14e8652
Failed attempt at parsing data, in uncommented code
sr259 Dec 3, 2023
6080234
Merge branch 'main' of https://github.com/oss-slu/DroneWorld into iss…
sr259 Dec 3, 2023
54bc079
made ti so it worked like previously
sr259 Dec 3, 2023
9ca43cb
Final changes to make it work like previously
sr259 Dec 3, 2023
4ef935c
updated dashboard
hebronh Dec 3, 2023
e2d639e
new changes
hebronh Dec 3, 2023
44b3e3d
Uncommented code
sr259 Dec 3, 2023
b82432b
Made changes so it is only called once
sr259 Dec 3, 2023
23ea4a6
update on design
yashaswini-slu Dec 4, 2023
936bbd8
Merge pull request #53 from oss-slu/issue40APIIntegrationforSimulatio…
yashaswini-slu Dec 4, 2023
a3e59a9
updated
hebronh Dec 4, 2023
c515757
Fixing merge conflict
sr259 Dec 4, 2023
908bbf2
Made it so the buttons on the new dashboard go to the old one. The ol…
sr259 Dec 4, 2023
0c279ce
updates
hebronh Dec 4, 2023
ac6cb86
dsStoreRemoved
Dec 4, 2023
c39cdfd
updated title
hebronh Dec 4, 2023
753efbc
remove store
Dec 4, 2023
72d1018
updated cards, removed DS
hebronh Dec 4, 2023
0bb656a
final changes
hebronh Dec 4, 2023
8a7903a
updated ui
hebronh Dec 4, 2023
40c1f13
Merge pull request #55 from oss-slu/issue50
yashaswini-slu Dec 4, 2023
5149cda
Merge branch 'main' into issue48
yashaswini-slu Dec 4, 2023
9c9b896
updated code
hebronh Dec 4, 2023
b8a2088
Resolved merge conflicts from origin/issue52DisplayMainReport
hebronh Dec 4, 2023
6676e81
updated changes
hebronh Dec 4, 2023
618a017
Made it so the button goes to the new dashboard and not the old one
sr259 Dec 4, 2023
488cf2a
Deleted caches
sr259 Dec 4, 2023
2e6ab31
Merge branch 'issue48' into issue52DisplayMainReport
sr259 Dec 4, 2023
999fdc2
Made button that allows user to go to the dashboard if it is not conn…
sr259 Dec 7, 2023
a071cc1
update on the gps issue
yashaswini-slu Dec 7, 2023
4ef775e
Merge pull request #56 from oss-slu/issue52DisplayMainReport
yashaswini-slu Dec 8, 2023
7ca8496
fixed binary issue
hebronh Dec 8, 2023
44bbc9f
updates
hebronh Dec 8, 2023
c584466
removed binary files
hebronh Dec 8, 2023
dd42510
changes
hebronh Dec 8, 2023
4419225
changes
hebronh Dec 8, 2023
e173331
fixed
hebronh Dec 8, 2023
96074b5
all binaries removed
hebronh Dec 8, 2023
6551c93
issing imports fixed
hebronh Dec 8, 2023
4235e38
merged
hebronh Dec 8, 2023
86fa9c6
fixed deleted Dashboard
hebronh Dec 8, 2023
9236dca
Merge pull request #57 from oss-slu/49-design-dashboard
yashaswini-slu Dec 8, 2023
d4990d0
Making final changes for the button
sr259 Dec 8, 2023
b5ed7eb
Fixing the phrase
sr259 Dec 8, 2023
0dd52b4
added message in GPS
yashaswini-slu Dec 8, 2023
33ca71a
removed binary file
yashaswini-slu Dec 8, 2023
6bf48c7
Fixed card visual order
sr259 Dec 8, 2023
3017fd5
Merge pull request #59 from oss-slu/issue48
yashaswini-slu Dec 9, 2023
977d719
Merge branch 'main' into 23-ui-magnetometer-details-1
yashaswini-slu Dec 26, 2023
64c1322
updated the design and bolcked data from API
yashaswini-slu Dec 31, 2023
236ce10
updated on the blocking
yashaswini-slu Jan 10, 2024
f56fdfb
Merge pull request #54 from oss-slu/23-ui-magnetometer-details-1
yashaswini-slu Jan 12, 2024
4d4b61b
Made progress towards api integration
sr259 Feb 4, 2024
f9bb83b
removing the binaries
sr259 Feb 4, 2024
bac1f9a
new changes
hebronh Feb 4, 2024
509121d
updated gps/barometer
hebronh Feb 4, 2024
a23cb94
updated gps/barometer
hebronh Feb 4, 2024
9acac04
Merge branch 'main' of https://github.com/oss-slu/DroneWorld
Feb 5, 2024
1f8c99e
i64
Feb 5, 2024
5eec74e
remove ds
Feb 5, 2024
43b6ff5
Removed all binaries
sr259 Feb 6, 2024
19a8892
Getting original Magnetometer.jsx file
sr259 Feb 6, 2024
37fe7ca
enabled magnetometer fields
yashaswini-slu Feb 6, 2024
4abc0a8
Removed print statements
sr259 Feb 7, 2024
0b4f301
fixed barometer,final
hebronh Feb 10, 2024
3b5a826
updated
hebronh Feb 11, 2024
37cef08
resolved the gps default value error
yashaswini-slu Feb 11, 2024
514885a
final barometer updates
hebronh Feb 11, 2024
69ea7a0
updated gps
hebronh Feb 11, 2024
75273d1
removed the magentometer front end bolcks
yashaswini-slu Feb 11, 2024
e5a7f6b
Merge pull request #66 from oss-slu/issue45APIIntegrationMagnetometer
yashaswini-slu Feb 11, 2024
cc5cc4e
Merge pull request #68 from oss-slu/issue64
yashaswini-slu Feb 12, 2024
f8d3b77
final changes
hebronh Feb 12, 2024
0330a03
new changes
hebronh Feb 4, 2024
17b08fc
updated gps/barometer
hebronh Feb 4, 2024
a3a1a7c
updated gps/barometer
hebronh Feb 4, 2024
66d7bad
fixed barometer,final
hebronh Feb 10, 2024
fc2bfe5
updated
hebronh Feb 11, 2024
fe1d263
resolved the gps default value error
yashaswini-slu Feb 11, 2024
bd87af4
final barometer updates
hebronh Feb 11, 2024
b9a8554
updated gps
hebronh Feb 11, 2024
3b9c985
final changes
hebronh Feb 12, 2024
1e0171f
Merge remote-tracking branch 'origin/60-issue-ui-stepper' into 60-iss…
hebronh Feb 12, 2024
c579124
Merge pull request #67 from oss-slu/60-issue-ui-stepper
yashaswini-slu Feb 12, 2024
6850ff2
beginning stages of acceptance ui changes
hebronh Feb 12, 2024
cbbb698
Initial progress for fuzzy testing in the test config portion. 3 chec…
sr259 Feb 13, 2024
5a078ae
Set the fuzzy testing to the test configuration
sr259 Feb 15, 2024
404a1f4
Merge branch 'main' of https://github.com/oss-slu/DroneWorld into iss…
sr259 Feb 15, 2024
91490a6
teamcity template changes
hebronh Feb 16, 2024
575cd17
Working version, needs description
sr259 Feb 16, 2024
fcd8465
ui
hebronh Feb 19, 2024
aca855e
ui
hebronh Feb 19, 2024
b15c5be
progress in ui design
hebronh Feb 19, 2024
06a85d3
update on the wind type bug
yashaswini-slu Feb 22, 2024
7aa6156
Merge pull request #73 from oss-slu/windTypeBugFix
BohanZhang1 Feb 22, 2024
53cd69c
newBranch
Feb 26, 2024
715d435
log fix
Feb 26, 2024
b4c5543
updated the design of help text
yashaswini-slu Feb 26, 2024
167abff
unblocked the gps details in UI
yashaswini-slu Feb 26, 2024
fc90c66
Merge branch 'main' into issue61FuzzyTestToTestConfiguration
sr259 Feb 26, 2024
0d94426
removed x emoticon in pass case
hebronh Feb 26, 2024
0defcff
Fixed the conflict after some issues
sr259 Feb 26, 2024
9c760b9
Merge pull request #72 from oss-slu/issue61FuzzyTestToTestConfiguration
yashaswini-slu Feb 26, 2024
c61a527
moved
hebronh Feb 26, 2024
370a2d2
removed old code
Feb 26, 2024
f9ba29f
Revert "removed old code"
Feb 26, 2024
a8ec60d
final changes for report dashboard
hebronh Feb 27, 2024
0c4539d
table changes
hebronh Feb 27, 2024
1d4e657
Merge pull request #75 from oss-slu/pr71update
yashaswini-slu Feb 28, 2024
3578fe9
final changes
hebronh Feb 28, 2024
9f4f2ce
update on the table design
yashaswini-slu Feb 29, 2024
80e6e07
Merge pull request #70 from oss-slu/65-acceptednotacceptedui
yashaswini-slu Feb 29, 2024
f1fc722
change
hebronh Mar 1, 2024
840ce75
redirectingbuttons
hebronh Mar 2, 2024
94ac1f2
Initial documentation for windows
sr259 Mar 4, 2024
d1a7cf9
landing page edits
hebronh Mar 11, 2024
b54118f
Merge branch 'main' of https://github.com/oss-slu/DroneWorld into iss…
sr259 Mar 14, 2024
b9527ea
Adding windows and mac installation, as well as changing readme to ac…
sr259 Mar 14, 2024
465df9f
Fixed issue as well as added more details
sr259 Mar 17, 2024
b868a9e
adding readme
sr259 Mar 17, 2024
f9764ea
adding windows installation
sr259 Mar 17, 2024
cedb785
Rename WindowsInstallation.md to windowsinstallation.md
sr259 Mar 17, 2024
81e6ad2
changes
hebronh Mar 18, 2024
9464f0a
apiCall
Mar 18, 2024
3d88e29
final changes
hebronh Mar 18, 2024
482cd19
removed --force in instructions
sr259 Mar 18, 2024
10ac0e4
Merge branch 'issue76WindowsDocumentation' of https://github.com/oss-…
sr259 Mar 18, 2024
74a19fb
removed --force in instructions, removed Python and React from instru…
sr259 Mar 18, 2024
471d1e8
About Us is now a link
hebronh Mar 18, 2024
7bbf980
updated simulation button
hebronh Mar 18, 2024
14e66aa
Merge pull request #79 from oss-slu/issue76WindowsDocumentation
yashaswini-slu Mar 18, 2024
cc11782
Merge pull request #78 from oss-slu/62-uilandingpage
yashaswini-slu Mar 18, 2024
630af0d
Merge branch 'main' of https://github.com/oss-slu/DroneWorld into iss…
sr259 Mar 18, 2024
c61af99
apiCallUpdate
Mar 18, 2024
7add58f
Fixed bug where settings were being sent to as strings, made gps sett…
sr259 Mar 19, 2024
5d28438
Fixed parsing bug
sr259 Mar 24, 2024
98a9f9f
starting link
hebronh Mar 25, 2024
c842284
base64 and Monitor view
Mar 25, 2024
76ea6d0
removed the api under development message
yashaswini-slu Mar 25, 2024
dcc9685
update on the routing links
yashaswini-slu Mar 26, 2024
bf98803
app route added
Apr 1, 2024
d0e57eb
500
Apr 1, 2024
9073cff
updates
hebronh Apr 7, 2024
43bf162
Merge pull request #83 from oss-slu/issue82BarometerMagnetometerBug
yashaswini-slu Apr 7, 2024
2e11736
Merge pull request #74 from oss-slu/issue43update
yashaswini-slu Apr 7, 2024
6927f77
updated changes
hebronh Apr 8, 2024
4e2c9a9
updated pull request changes
hebronh Apr 9, 2024
f68c04d
About Us Card
Apr 9, 2024
832f13d
About Us
Apr 10, 2024
98b4d98
Merge pull request #86 from oss-slu/issue63fix
yashaswini-slu Apr 11, 2024
7034871
Starting button to open files
sr259 Apr 15, 2024
5fc3509
reverting back to original, making a new branch
sr259 Apr 15, 2024
548ec38
adding a button to allow users to see the main report
sr259 Apr 15, 2024
c0e77b9
Merge branch 'main' into issue43api
Apr 15, 2024
90f9e62
fx
Apr 17, 2024
c4c7842
changes
hebronh Apr 18, 2024
3ffcd99
Turbulent Wind
Apr 19, 2024
cc3cd4f
Turbulent Wind
Apr 19, 2024
c4c4a3b
Windshear
Apr 19, 2024
24abd35
Windshear
Apr 19, 2024
54ffb89
Merge pull request #90 from oss-slu/issue89
BohanZhang1 Apr 19, 2024
d6e439e
list_folder_contents()
Apr 22, 2024
ef992af
Merge branch 'main' of https://github.com/oss-slu/DroneWorld into iss…
sr259 Apr 22, 2024
e60547f
list_folder_contents()
Apr 22, 2024
4c757c7
list_folder_contents()
Apr 22, 2024
b87a0f4
added git ignore files for pycache
yashaswini-slu Apr 22, 2024
4f969b8
Merge branch 'main' of https://github.com/oss-slu/DroneWorld into iss…
sr259 Apr 23, 2024
200c826
Current progress on handling json instead of files
sr259 Apr 26, 2024
e2fe87c
Fuzzy dashboard does not accept json as is, some configuring needs to…
sr259 Apr 28, 2024
033b386
final
hebronh Apr 28, 2024
deda3e8
Draft fix
Apr 29, 2024
11f5c27
Parser with png/html
Apr 29, 2024
9c7567d
Merge branch 'main' into issue43api
Apr 29, 2024
8f8bcfb
Adding button to call the backend, need the api method merged into ma…
sr259 Apr 30, 2024
82fcbc5
Additional changes
sr259 Apr 30, 2024
f8ad0a9
made api call from kalebs implementation
sr259 Apr 30, 2024
2d32fe0
Added post method to api call
sr259 Apr 30, 2024
304eb9d
Working api call with image contents
sr259 Apr 30, 2024
e82ce43
Uncommented regular list-reports
Apr 30, 2024
88d2feb
new get info content
May 1, 2024
617f972
Maybe Z fix
May 1, 2024
b8d323e
tech fix
May 1, 2024
7e0af59
removed elif
May 2, 2024
399982c
fix
May 2, 2024
3a15d12
Undo testing change
May 2, 2024
3c667bc
added detail dashborad navigation
yashaswini-slu May 2, 2024
73f6aab
Fuzzy parse
May 2, 2024
19c6c0a
Removed hard coded value
May 2, 2024
a8b3892
Made changes to the report dashboard as well as added the key to the …
sr259 May 2, 2024
23c64de
got a warning about putting an api key so i reverted it back into the…
sr259 May 2, 2024
7a7583f
changes
hebronh May 3, 2024
b0798a8
Fuzzy Fix
May 3, 2024
6e33117
done
hebronh May 3, 2024
b89bead
removed extra About US
hebronh May 3, 2024
1024345
merging with hebrons branch
sr259 May 3, 2024
da7dbf1
merging kalebs branch
sr259 May 3, 2024
5d86817
json fix
May 3, 2024
701c84f
JSON fix
May 3, 2024
154f651
removed Welcome to DroneWorld
hebronh May 4, 2024
c6f818b
update on report dashboard
yashaswini-slu May 5, 2024
0fd3bc6
update on parameters
yashaswini-slu May 5, 2024
a05e4bf
issue43api merge
yashaswini-slu May 5, 2024
e37726a
update on voilation message
yashaswini-slu May 5, 2024
21752da
removed line
May 5, 2024
42d9a88
Removed z comment
May 5, 2024
4c9308f
Removed z comment
May 5, 2024
72191c8
Merge pull request #92 from oss-slu/issue91
yashaswini-slu May 5, 2024
ec677bc
removed extra text
yashaswini-slu May 6, 2024
bc1dbaf
listreport
May 6, 2024
5dd64fe
Merge branch '81-link-dashboard-to-landing-page' of https://github.co…
sr259 May 6, 2024
4ecf7fe
Made button a link
sr259 May 6, 2024
0bbb701
added navbar to all components
yashaswini-slu May 6, 2024
63652b0
Merge branch 'main' into issue43api
May 6, 2024
654f1b3
listreport
May 6, 2024
f582878
merging
sr259 May 6, 2024
f5a94e1
fixed merge
sr259 May 6, 2024
5c2cc1b
update on useEffect for the dashboard
yashaswini-slu May 6, 2024
e8b0ca3
Merge branch 'issue52DisplayMainReport' of https://github.com/oss-slu…
yashaswini-slu May 6, 2024
44a6e94
updated
hebronh May 6, 2024
cbdb138
Merge branch 'issue43api' into issue52DisplayMainReport
yashaswini-slu May 6, 2024
74484b7
updated with main
hebronh May 6, 2024
e854263
Merge pull request #80 from oss-slu/issue43api
yashaswini-slu May 6, 2024
207b174
update on the back button in fuzzyDashboard
yashaswini-slu May 6, 2024
b897957
update on style
yashaswini-slu May 6, 2024
62cd971
Merge pull request #84 from oss-slu/81-link-dashboard-to-landing-page
yashaswini-slu May 6, 2024
91c9307
merging
sr259 May 6, 2024
86243b1
update on create simulation error
yashaswini-slu May 6, 2024
7cc28bd
Merge branch 'main' into issue52DisplayMainReport
yashaswini-slu May 6, 2024
79238b1
Merge pull request #87 from oss-slu/issue52DisplayMainReport
yashaswini-slu May 6, 2024
b515cba
Added functionality to enable/disable CFD in environment configuratio…
BohanZhang1 Jun 24, 2024
a9457b2
ide file
BohanZhang1 Jun 24, 2024
c10709f
Add: docker hub DRV + WiS support
BohanZhang1 Jun 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -397,7 +397,7 @@ def __create_global_monitor_threads(self, monitor_list):
start_threads.append(threading.Thread(target=monitor_instance.start))
stop_threads.append(threading.Thread(target=monitor_instance.stop))
return start_threads, stop_threads

@staticmethod
def __get_class_instance(class_name, module_name):
module = importlib.import_module("PythonClient.multirotor." + module_name + "." + class_name)
11 changes: 9 additions & 2 deletions backend/PythonClient/server/simulation_server.py
Original file line number Diff line number Diff line change
@@ -2,10 +2,14 @@
import os.path
import threading
import time
import sys

from flask import Flask, request, abort, send_file, render_template, Response
from flask_cors import CORS

##UNCOMMENT LINE IF TESTING ON LOCAL MACHINE
##sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))

from PythonClient.multirotor.control.simulation_task_manager import SimulationTaskManager

app = Flask(__name__, template_folder="./templates")
@@ -38,8 +42,11 @@ def add_task():

@app.route('/currentRunning', methods=['GET'])
def get_current_running():
return task_dispatcher.get_current_task_batch()

current_task_batch = task_dispatcher.get_current_task_batch()
if current_task_batch == "None":
return f"{'None'}, {task_dispatcher.mission_queue.qsize()}"
else:
return f"{'Running'}, {task_dispatcher.mission_queue.qsize()}"

@app.route('/report')
@app.route('/report/<path:dir_name>')
124 changes: 59 additions & 65 deletions frontend/src/components/EnvironmentConfiguration.jsx
Original file line number Diff line number Diff line change
@@ -295,39 +295,32 @@ export default function EnvironmentConfiguration (env) {
}
}
//new added
useEffect(() => {
const interval = setInterval(() => {
fetch('/currentRunning')
.then(res => res.json())
.then(data => setBackendInfo(data));
}, 2000);

return () => clearInterval(interval);
}, []);

//new added
useEffect(() => {

console.log(`
<div class="status ${backendInfo.backendStatus}">
${backendInfo.backendStatus}
</div>

// CSS styles

`);
const style = document.createElement('style');

style.innerHTML = `
.status {
// CSS styles
}
`;

document.head.appendChild(style);

}, [backendInfo.backendStatus]);

// useEffect(() => {
// const interval = setInterval(() => {
// fetch('http://localhost:5000/currentRunning')
// .then((res) => {
// if (!res.ok) {
// throw new Error('No response from server/something went wrong');
// }
// return res.text();
// })
// .then((data) => {
// const [status, queueSize] = data.split(', ');
// console.log('Simulation Status,', status, 'Queue Size:', queueSize);
// if (status === "None") {
// setBackendInfo({ numQueuedTasks: 0, backendStatus: 'idle' });
// } else if (status === "Running") {
// setBackendInfo({ numQueuedTasks: parseInt(queueSize), backendStatus: 'running' });
// }
// })
// .catch((error) => {
// console.error('Error fetching data:', error);
// setBackendInfo({ numQueuedTasks: -1, backendStatus: 'error' });
// });
// }, 2000);

// return () => clearInterval(interval);
// }, []);


// return (
@@ -759,41 +752,42 @@ const handleSnackBarVisibility = (val) => {
</GoogleMap>
</LoadScript>
</div> :null}
<Typography variant="h6"> Status:</Typography>
<Box border={1} borderColor={statusStyle.color} p={2} borderRadius={2} width={300} mb={5} >
{/* Show spinner if status is running */}
<Typography>
Backend Status: <span style={statusStyle}>{backendInfo.backendStatus}</span>
</Typography>
</Box>
<div style={{position: 'relative'}}>
<div style={{position: 'absolute', left: 380, top: -80}}>
<Typography>
Queued Tasks: {backendInfo.numQueuedTasks}
</Typography>
</div>
</div>

{/* <Typography variant="h6"> Status:</Typography>
<Box border={1} borderColor={statusStyle.color} p={2} borderRadius={2} width={300} mb={5} >
Show spinner if status is running
<Typography>
Backend Status: <span style={statusStyle}>{backendInfo.backendStatus}</span>
</Typography>
</Box>
<div style={{position: 'relative'}}>
<div style={{position: 'absolute', left: 380, top: -80}}>
<Typography>
Queued Tasks: {backendInfo.numQueuedTasks}
</Typography>
</div>
</div> */}
</Typography>
{/* </Container> */}
</Box>
<Typography
animate
variants={{
hidden: { opacity: 0 },
visible: { opacity: 1 }
}}
>
</Typography>
<Box mb={2}> </Box>
<Typography
variant="h6"
sx={{
opacity: 0,
transition: 'opacity 0.5s ease-in-out'
}}
>
</Box>
<Typography
animate
variants={{
hidden: { opacity: 0 },
visible: { opacity: 1 }
}}
>
</Typography>
<Box mb={2}> </Box>
<Typography
variant="h6"
sx={{
opacity: 0,
transition: 'opacity 0.5s ease-in-out'
}}
>
{backendInfo.backendStatus}
</Typography>
</Typography>
</div>
)
}
76 changes: 73 additions & 3 deletions frontend/src/pages/Home.jsx
Original file line number Diff line number Diff line change
@@ -7,8 +7,9 @@ import InputLabel from '@mui/material/InputLabel';
import MenuItem from '@mui/material/MenuItem';
import FormControl from '@mui/material/FormControl';
import Select from '@mui/material/Select';
import { useState } from 'react';
import { useState, useEffect } from 'react';
import Typography from '@mui/material/Typography';
import Grid from '@mui/material/Grid';

const StyledButton = styled(Button)`
align-items: center;
@@ -57,6 +58,24 @@ const Home = () => {
const [text, setText] = useState('Please select a requirement identifier');
const [title, setTitle] = useState('');
let requirement_id="";
const [backendInfo, setBackendInfo] = useState({
numQueuedTasks: 0,
backendStatus: 'idle'
});
const getStatusStyle = () => {
switch (backendInfo.backendStatus) {
case 'idle':
return { color: 'green' }; // Green color and a checkmark icon
case 'running':
return { color: 'blue'}; // Blue color and a rotating arrow icon
case 'error':
return { color: 'red' }; // Red color and a cross icon
default:
return { color: 'gray' }; // Gray color and an information
}
};
const statusStyle = getStatusStyle();

const handleReqIdChange = (event) => {
setSelectedValue(event.target.value);
// requirement_id=event.target.value;
@@ -72,7 +91,52 @@ const Home = () => {
setTitle("sUAS Mission in Windy Weather with Path Accuracy")
}
};

useEffect(() => {
const callOnOpen = () => {
fetch('http://localhost:5000/currentRunning')
.then((res) => {
if (!res.ok) {
throw new Error('No response from server/something went wrong');
}
return res.text();
})
.then((data) => {
const [status, queueSize] = data.split(', ');
console.log('Simulation Status,', status, 'Queue Size:', queueSize);
if (status === "None") {
setBackendInfo({ numQueuedTasks: 0, backendStatus: 'idle' });
} else if (status === "Running") {
setBackendInfo({ numQueuedTasks: parseInt(queueSize), backendStatus: 'running' });
}
})
.catch((error) => {
console.error('Error fetching data:', error);
setBackendInfo({ numQueuedTasks: -1, backendStatus: 'error' });
});
};
callOnOpen();
}, []);

return (
<React.Fragment>
<Typography style={{width: 1000}}>
<Grid spacing={5} direction="row" style={{ marginTop: '15px', paddingTop: '15px', paddingLeft: '290px'}}>
<Box border={1} borderColor={statusStyle.color} p={2} borderRadius={2} width={200} mb={5} >
<Typography>
Backend Status: <span style={statusStyle}>{backendInfo.backendStatus}</span>
</Typography>
</Box>
<div style={{position: 'relative'}}>
<div style={{position: 'absolute', left: 280, top: -80}}>
<Typography>
Queued Tasks: {backendInfo.numQueuedTasks}
</Typography>
</div>
</div>
</Grid>
</Typography>

<Box
sx={{
display: 'flex',
@@ -84,14 +148,13 @@ const Home = () => {
'& > :not(style)': {
m: 1,
width: 1000,
height: 350,
// height: 350,
},
}}
>
{
<React.Fragment>
<FormControl>

<InputLabel id="demo-simple-select-label">Requirement ID</InputLabel>
<Select
labelId="req-id"
@@ -110,6 +173,7 @@ const Home = () => {
</Typography>
</div>
{/* <h3>{text}</h3> */}

<div style={{ marginTop: '3em' }}>
<Typography variant="h5" component="h4">
{selectedvalue != '' ? <React.Fragment>Title: {title}</React.Fragment> : null}
@@ -125,10 +189,16 @@ const Home = () => {
</React.Fragment>

}
<div>
{/* <Typography variant="h6"> Status:</Typography> */}

</div>
<StyledLink to='/simulation' state={{req:selectedvalue.toString(), descs:text.toString(), title:title.toString()}}>
<StyledButton variant='contained' disabled={text=="Please select a requirement identifier"? true : false}>Start Scenario Configuration</StyledButton>
</StyledLink>
</Box>
</React.Fragment>

);
};