Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
B
Backpack-gui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sarvin Taba
Backpack-gui
Commits
c4048772
Commit
c4048772
authored
Nov 14, 2021
by
Sarvin Taba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pause messges done
parent
1f92b00d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
30 deletions
+36
-30
api.zip
api.zip
+0
-0
App.css
src/App.css
+11
-0
App.js
src/App.js
+13
-25
DebugList.js
src/components/DebugList.js
+11
-4
Camera.js
src/components/UIElements/Camera.js
+1
-1
No files found.
api.zip
View file @
c4048772
No preview for this file type
src/App.css
View file @
c4048772
...
...
@@ -15,3 +15,14 @@
.text-left
{
text-align
:
left
!important
;
}
.relative
{
position
:
relative
;
}
.fixed-tr
{
position
:
absolute
;
z-index
:
10000000
;
top
:
5px
;
right
:
10px
;
}
\ No newline at end of file
src/App.js
View file @
c4048772
import
React
from
"
react
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
"
./App.css
"
;
import
Cameras
from
"
./components/Cameras
"
;
import
ImuGps
from
"
./components/ImuGps
"
;
import
{
Card
}
from
"
react-bootstrap
"
;
import
Axios
from
"
axios
"
;
import
{
useContext
,
useEffect
,
useState
}
from
"
react
"
;
import
DebugMessages
from
"
./components/DebugMessages
"
;
import
{
useEffect
}
from
"
react
"
;
import
DebugList
from
"
./components/DebugList
"
;
import
GeneralStatus
from
"
./components/GeneralStatus
"
;
import
socketClient
from
"
socket.io-client
"
import
{
AutoSizer
}
from
'
react-virtualized
'
;
import
{
FontAwesomeIcon
}
from
"
@fortawesome/react-fontawesome
"
;
import
{
faPause
,
faPlay
}
from
"
@fortawesome/free-solid-svg-icons
"
;
const
socket
=
socketClient
(
process
.
env
.
REACT_APP_SOCKET_URL
,{
transports
:[
'
websocket
'
]});
function
App
()
{
// const [CameraData, setCameraData] = useState({});
// const [newCameraData , setNewCameraData] = useState({});
const
[
pauseMessages
,
setPauseMessages
]
=
useState
(
false
);
useEffect
(()
=>
{
socket
.
on
(
"
connectionStart
"
,
(
res
)
=>
{
console
.
log
(
res
);
})
// socket.on("debugMessages", (res) => {
// console.log(res);
// })
socket
.
on
(
"
connect_error
"
,
(
err
)
=>
{
console
.
log
(
`connect_error due to
${
err
.
message
}
`
);
});
// Axios({
// method: "GET",
// withCredentials: true,
// url:
// process.env.REACT_APP_BACKEND_URL +
// "/cameraInfo"
// }).then(async (res) => {
// console.log("********************")
// setCameraData(res)
// });
},
[]);
const
onPauseMessages
=
()
=>
{
setPauseMessages
(
!
pauseMessages
)
}
return
(
<
div
className
=
"
App pt-3
"
>
<
h4
>
Backpack
GUI
<
/h4
>
...
...
@@ -52,10 +37,13 @@ function App() {
<
div
className
=
"
m-2 py-1 border border-dark rounded
"
>
<
GeneralStatus
socket
=
{
socket
}
/
>
<
/div
>
<
div
className
=
"
m-2 px-2 border border-dark rounded fill-height text-left
"
>
<
div
className
=
"
m-2 px-2 border border-dark rounded fill-height text-left relative
"
>
<
button
className
=
"
btn btn-light btn-sm fixed-tr
"
onClick
=
{
onPauseMessages
}
>
<
FontAwesomeIcon
icon
=
{
pauseMessages
?
faPlay
:
faPause
}
className
=
"
menu-icon
"
/>
<
/button
>
<
AutoSizer
>
{({
width
,
height
})
=>
(
<
DebugList
socket
=
{
socket
}
width
=
{
width
}
height
=
{
height
}
><
/DebugList
>
<
DebugList
socket
=
{
socket
}
pause
=
{
pauseMessages
}
width
=
{
width
}
height
=
{
height
}
><
/DebugList
>
)}
<
/AutoSizer
>
<
/div
>
...
...
src/components/DebugList.js
View file @
c4048772
import
React
from
"
react
"
;
import
{
List
,
}
from
"
react-virtualized
"
;
import
{
List
}
from
"
react-virtualized
"
;
class
DebugList
extends
React
.
Component
{
state
=
{
data
:
[],
...
...
@@ -15,14 +15,21 @@ class DebugList extends React.Component {
// let db=[]
// let db=[res,...debugMessages]
// let dbl=db.map((msg)=>{return msg['id']})
let
mydata
=
[
res
,
...
this
.
state
.
data
];
this
.
setState
({
data
:
mydata
});
if
(
!
this
.
props
.
pause
)
{
let
mydata
=
[
res
,
...
this
.
state
.
data
];
this
.
setState
({
data
:
mydata
});
}
});
}
rowRenderer
=
({
index
,
isScrolling
,
key
,
style
})
=>
{
return
(
<
li
className
=
{
"
list-group-item
"
+
this
.
state
.
data
[
index
].
type
}
key
=
{
`liMessages_
${
index
}
`
}
>
{
this
.
state
.
data
[
index
].
message
}
<
/li
>
<
li
className
=
{
"
list-group-item
"
+
this
.
state
.
data
[
index
].
type
}
key
=
{
`liMessages_
${
index
}
`
}
>
{
this
.
state
.
data
[
index
].
message
}
<
/li
>
);
};
...
...
src/components/UIElements/Camera.js
View file @
c4048772
...
...
@@ -9,7 +9,7 @@ import {
import
"
./Camera.css
"
;
const
Camera
=
(
props
)
=>
{
return
(
<
div
className
=
{
"
border border-dark p-1 rounded
"
+
(
props
.
data
.
connected
===
0
?
""
:
"
border-thick
"
)
}
>
<
div
className
=
{
"
border border-dark p-1 rounded
shadow-sm
"
+
(
props
.
data
.
connected
===
0
?
""
:
"
border-thick
"
)
}
>
<
div
className
=
{
props
.
data
.
bat
<
20
?
"
text-danger
"
:
""
}
>
<
div
className
=
"
col-3 float-left text-right
"
>
<
FontAwesomeIcon
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment