Skip to content

Free Motion Capture for Everyone πŸ’€βœ¨

TypeScript

start pipeline panel

jonmatthis4b735fcf47ed
diff --git a/freemocap-ui/src/components/processing-pipeline-panel/PipelineConnectionStatus.tsx b/freemocap-ui/src/components/processing-pipeline-panel/PipelineConnectionStatus.tsx
new file mode 100644
index 00000000..81247af0
--- /dev/null
+++ b/freemocap-ui/src/components/processing-pipeline-panel/PipelineConnectionStatus.tsx
@@ -0,0 +1,87 @@
+import {Box, Typography} from "@mui/material";
+import CheckIcon from '@mui/icons-material/Check';
+import CloseIcon from '@mui/icons-material/Close';
+import {pauseUnpauseThunk} from "@/store/thunks/pause-unpause-thunk";
+import {useState} from "react";
+
+
+export const PipelineConnectionStatus = () => {
+ const [isConnected, setIsConnected] = useState(false);
+
+
+ const handleToggleConnection = async () => {
+ if (isConnected) {
+ console.log('Toggling Processing Pipeline: disconnecting');
+ await pauseUnpauseThunk();
+
+ } else {
+ console.log('Toggling WebSocket: connecting');
+ await pauseUnpauseThunk();
+ }
+ setIsConnected(!isConnected);
+ };
+
+ return (
+ // <Tooltip title={`WebSocket URL: ${wsUrl}`} placement="bottom-start" arrow>
+ <Box
+ sx={{
+ display: 'flex',
+ justifyContent: 'flex-end',
+ padding: '10px',
+ flexDirection: 'column',
+ pl: 4,
+ // color: '#dadada',
+ cursor: 'pointer',
+ border: '4px solid rgb(0, 125, 125)',
+ backgroundColor: isConnected ? '#005d94' : '#395067',
+ borderRadius: '8px',
+ ':hover': {
+ backgroundColor: 'rgba(255, 255, 255, 0.05)',
+ borderColor: 'rgb(0,225, 225)',
+ },
+ }}
+ onClick={handleToggleConnection}
+ >
+ <Typography
+ variant="body1"
+ component="div" // Override the default <p> to <div>
+ sx={{
+ display: 'flex',
+ alignItems: 'center',
+ gap: 1,
+ }}
+ >
+ <Box sx={{
+ border: '1px solid rgba(255, 255, 255, 0.3)',
+ width: '24px',
+ height: '24px',
+ marginRight: '8px',
+ cursor: 'pointer',
+ borderRadius: '4px',
+ transition: 'background-color 0.3s, border-color 0.3s',
+ backgroundColor: isConnected ? 'rgba(0, 255, 255, 0.1)' : 'rgba(255, 0, 0, 0.1)',
+ borderColor: isConnected ? 'rgba(0, 255, 255, 0.5)' : 'rgba(255, 0, 0, 0.5)',
+ boxShadow: '0 2px 4px rgba(0, 0, 0, 0.1)',
+ display: 'flex',
+ alignItems: 'center',
+ padding: '4px',
+ justifyContent: 'center',
+ '&:hover': {
+ backgroundColor: 'rgba(255, 255, 255, 0.05)',
+ borderColor: 'rgba(255, 255, 255, 0.2)',
+ },
+ }}>
+ {isConnected ? (
+ <CheckIcon sx={{ color: 'green' }} />
+ ) : (
+ <CloseIcon fontSize="small" sx={{ color: 'red' }} />
+ )}
+ </Box>
+ Pipeline: {isConnected ? 'connected' : 'disconnected'}
+ </Typography>
+ </Box>
+ // </Tooltip>
+ )
+ ;
+};
+export default PipelineConnectionStatus;
diff --git a/freemocap-ui/src/components/processing-pipeline-panel/ProcessingPipelinePanel.tsx b/freemocap-ui/src/components/processing-pipeline-panel/ProcessingPipelinePanel.tsx
index 66813ec3..93e1f4b5 100644
--- a/freemocap-ui/src/components/processing-pipeline-panel/ProcessingPipelinePanel.tsx
+++ b/freemocap-ui/src/components/processing-pipeline-panel/ProcessingPipelinePanel.tsx
@@ -1,86 +1,65 @@
-// skellycam-ui/src/components/available-cameras-panel/AvailableCamerasView.tsx
-import {Accordion, AccordionDetails, Box, Paper, Stack, Typography, useTheme,} from "@mui/material";
-import * as React from "react";
-import AccordionSummary from "@mui/material/AccordionSummary";
+import React from "react";
+import {Box, Button, Typography, useTheme} from "@mui/material";
+import {SimpleTreeView} from "@mui/x-tree-view/SimpleTreeView";
+import {TreeItem} from "@mui/x-tree-view/TreeItem";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
-import {CameraConfigPanel} from "@/components/available-cameras-panel/CameraConfigPanel";
-import {CameraListItem} from "@/components/available-cameras-panel/CameraListItem";
+import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import {useAppDispatch} from "@/store/AppStateStore";
-import {ConnectToCamerasButton} from "@/components/available-cameras-panel/ConnectToCamerasButton";
-import {CloseCamerasButton} from "@/components/available-cameras-panel/CloseCamerasButton";
-import {ApplyCameraConfigsButton} from "@/components/available-cameras-panel/ApplyCameraConfigsButton";
-import {PauseUnpauseButton} from "../PauseUnpauseButton";
+import {
+ StartStopRecordingButton
+} from "@/components/recording-info-panel/recording-subcomponents/StartStopRecordingButton";
+import {RecordingPathTreeItem} from "@/components/recording-info-panel/RecordingPathTreeItem";
import LanIcon from '@mui/icons-material/Lan';
+import {
+ FullRecordingPathPreview
+} from "@/components/recording-info-panel/recording-subcomponents/FullRecordingPathPreview";
+import PipelineConnectionStatus from "@/components/processing-pipeline-panel/PipelineConnectionStatus";
-export const ProcessingPipelinePanel = () => {
+export const ProcessingPipelinePanel: React.FC = () => {
const theme = useTheme();
const dispatch = useAppDispatch();
-
-
-
return (
- <Accordion
- defaultExpanded
+ <Box
sx={{
- borderRadius: 2,
- "&:before": {display: "none"},
- boxShadow: theme.shadows[3],
- justifyContent: "left",
+ color: "text.primary",
+ backgroundColor: theme.palette.primary.main,
+ borderRadius: 1,
+ mb: 2,
}}
>
- <Box
- sx={{
- display: "flex",
- alignItems: "center",
- backgroundColor: theme.palette.primary.main,
- borderTopLeftRadius: 8,
- borderBottomLeftRadius: 8,
+ <SimpleTreeView
+ slots={{
+ collapseIcon: ExpandMoreIcon,
+ expandIcon: ChevronRightIcon,
}}
+ sx={{flexGrow: 1}}
>
- <AccordionSummary
- expandIcon={
- <ExpandMoreIcon
- sx={{color: theme.palette.primary.contrastText}}
- />
- }
- sx={{
- flex: 1,
- color: theme.palette.primary.contrastText,
- "&:hover": {
- backgroundColor: theme.palette.primary.light,
- },
- }}
- >
- <Stack direction="row" alignItems="center" spacing={1}>
- <LanIcon sx={{ transform: 'scaleY(-1.3) scaleX(1.25)' }} />
- <Typography variant="subtitle1" fontWeight="medium">
- Processing Pipeline
- </Typography>
- </Stack>
- </AccordionSummary>
-
- </Box>
+ <TreeItem
+ itemId="calibration-pipeline-main"
+ label={
+ <Box
+ sx={{
+ display: "flex",
+ alignItems: "center",
+ width: "100%",
+ r: 2,
+ }}
+ >
+ <LanIcon sx={{transform: 'scaleY(-1.3) scaleX(1.25)'}}/>
- <AccordionDetails sx={{bgcolor: "background.default"}}>
- <Paper
- elevation={0}
- sx={{
- borderRadius: 2,
- overflow: "hidden",
- }}
+ <Typography sx={{pl: 1, flexGrow: 1}} variant="h6" component="div">
+ Data Processing
+ </Typography>
+ <PipelineConnectionStatus/>
+ </Box>
+ }
>
- <Box
- sx={{
- p: 2,
- }}
- >
- <Typography variant="body2" color="textSecondary">
- Processing pipeline steps will be listed here.
- </Typography>
+ <Box sx={{display: 'flex', alignItems: 'center', gap: 1}}>
+ tree stuff
</Box>
- </Paper>
- </AccordionDetails>
- </Accordion>
+ </TreeItem>
+ </SimpleTreeView>
+ </Box>
);
};
diff --git a/freemocap-ui/src/components/recording-info-panel/RecordingInfoPanel.tsx b/freemocap-ui/src/components/recording-info-panel/RecordingInfoPanel.tsx
index 1b4f44cd..80843143 100644
--- a/freemocap-ui/src/components/recording-info-panel/RecordingInfoPanel.tsx
+++ b/freemocap-ui/src/components/recording-info-panel/RecordingInfoPanel.tsx
@@ -12,7 +12,6 @@ import {
import {startRecording, stopRecording,} from "@/store/thunks/start-stop-recording-thunks";
import {setRecordingInfo} from "@/store/slices/recordingInfoSlice";
import {RecordingPathTreeItem} from "@/components/recording-info-panel/RecordingPathTreeItem";
-import {FullRecordingPathPreview} from "./recording-subcomponents/FullRecordingPathPreview";
export const RecordingInfoPanel: React.FC = () => {
const theme = useTheme();
diff --git a/freemocap-ui/src/config/appUrlService.ts b/freemocap-ui/src/config/appUrlService.ts
index 3621fa29..389d03e8 100644
--- a/freemocap-ui/src/config/appUrlService.ts
+++ b/freemocap-ui/src/config/appUrlService.ts
@@ -26,7 +26,7 @@ const getApiUrl = (path: string) => {
// Get WebSocket URL
const getWebSocketUrl = () => {
const { host, port } = defaultUrlConfig;
- return `ws://${host}:${port}/skellycam/websocket/connect`;
+ return `ws://${host}:${port}/websocket/connect`;
};
// Get all HTTP endpoint URLs
diff --git a/freemocap-ui/src/context/websocket-context/useWebSocket.ts b/freemocap-ui/src/context/websocket-context/useWebSocket.ts
index cbf59fce..a6584a89 100644
--- a/freemocap-ui/src/context/websocket-context/useWebSocket.ts
+++ b/freemocap-ui/src/context/websocket-context/useWebSocket.ts
@@ -7,7 +7,7 @@ import {
import {setBackendFramerate, setFrontendFramerate} from "@/store/slices/framerateTrackerSlice";
import {FramerateUpdateWebSocketMessage, WebSocketMessageSchema} from "@/context/websocket-context/websocket-types";
import {addLog} from "@/store/slices/logRecordsSlice";
-import {urlService} from "@/services/urlService";
+import {urlService} from "@/config/appUrlService";
export const useWebSocket = () => {
diff --git a/freemocap-ui/src/store/thunks/connect-pipeline-thunk.ts b/freemocap-ui/src/store/thunks/connect-pipeline-thunk.ts
new file mode 100644
index 00000000..e69de29b