@@ -64,23 +64,24 @@ const deleteThisCamera = (cameraUniqueName: string) => {
6464 });
6565};
6666
67- const cameraConnected = (uniquePath : string ): boolean => {
67+ const cameraConnected = (uniquePath : string | undefined ): boolean => {
68+ if (! uniquePath ) return false ;
6869 return (
69- useStateStore ().vsmState .allConnectedCameras .find ((it ) => cameraInfoFor (it ).uniquePath === uniquePath ) !== undefined
70+ useStateStore ().vsmState .allConnectedCameras .find ((it ) => cameraInfoFor (it )? .uniquePath === uniquePath ) !== undefined
7071 );
7172};
7273
7374const unmatchedCameras = computed (() => {
7475 const activeVmPaths = Object .values (useCameraSettingsStore ().cameras ).map (
75- (it ) => cameraInfoFor (it .matchedCameraInfo ).uniquePath
76+ (it ) => cameraInfoFor (it .matchedCameraInfo )? .uniquePath
7677 );
7778 const disabledVmPaths = useStateStore ().vsmState .disabledConfigs .map (
78- (it ) => cameraInfoFor (it .matchedCameraInfo ).uniquePath
79+ (it ) => cameraInfoFor (it .matchedCameraInfo )? .uniquePath
7980 );
8081
8182 return useStateStore ().vsmState .allConnectedCameras .filter (
8283 (it ) =>
83- ! activeVmPaths .includes (cameraInfoFor (it ).uniquePath ) && ! disabledVmPaths .includes (cameraInfoFor (it ).uniquePath )
84+ ! activeVmPaths .includes (cameraInfoFor (it )? .uniquePath ) && ! disabledVmPaths .includes (cameraInfoFor (it )? .uniquePath )
8485 );
8586});
8687
@@ -91,8 +92,8 @@ const activeVisionModules = computed(() =>
9192 // Display connected cameras first
9293 .sort (
9394 (first , second ) =>
94- (cameraConnected (cameraInfoFor (second .matchedCameraInfo ).uniquePath ) ? 1 : 0 ) -
95- (cameraConnected (cameraInfoFor (first .matchedCameraInfo ).uniquePath ) ? 1 : 0 )
95+ (cameraConnected (cameraInfoFor (second .matchedCameraInfo )? .uniquePath ) ? 1 : 0 ) -
96+ (cameraConnected (cameraInfoFor (first .matchedCameraInfo )? .uniquePath ) ? 1 : 0 )
9697 )
9798);
9899
@@ -108,7 +109,7 @@ const setCameraView = (camera: PVCameraInfo | null, isConnected: boolean | null)
108109/**
109110 * Get the connection-type-specific camera info from the given PVCameraInfo object.
110111 */
111- const cameraInfoFor = (camera : PVCameraInfo | null ): PVUsbCameraInfo | PVCSICameraInfo | PVFileCameraInfo | any => {
112+ const cameraInfoFor = (camera : PVCameraInfo | null ): PVUsbCameraInfo | PVCSICameraInfo | PVFileCameraInfo | null => {
112113 if (! camera ) return null ;
113114 if (camera .PVUsbCameraInfo ) {
114115 return camera .PVUsbCameraInfo ;
@@ -119,7 +120,7 @@ const cameraInfoFor = (camera: PVCameraInfo | null): PVUsbCameraInfo | PVCSICame
119120 if (camera .PVFileCameraInfo ) {
120121 return camera .PVFileCameraInfo ;
121122 }
122- return {} ;
123+ return null ;
123124};
124125
125126/**
@@ -135,7 +136,7 @@ const getMatchedDevice = (info: PVCameraInfo | undefined): PVCameraInfo => {
135136 }
136137 return (
137138 useStateStore ().vsmState .allConnectedCameras .find (
138- (it ) => cameraInfoFor (it ).uniquePath === cameraInfoFor (info ).uniquePath
139+ (it ) => cameraInfoFor (it )? .uniquePath === cameraInfoFor (info )? .uniquePath
139140 ) || {
140141 PVFileCameraInfo : undefined ,
141142 PVCSICameraInfo : undefined ,
@@ -158,12 +159,12 @@ const getMatchedDevice = (info: PVCameraInfo | undefined): PVCameraInfo => {
158159 class =" pr-0"
159160 >
160161 <v-card color =" surface" class =" rounded-12" >
161- <v-card-title >{{ cameraInfoFor(module.matchedCameraInfo).name }}</v-card-title >
162- <v-card-subtitle v-if =" !cameraConnected(cameraInfoFor(module.matchedCameraInfo).uniquePath)"
162+ <v-card-title >{{ cameraInfoFor(module.matchedCameraInfo)? .name }}</v-card-title >
163+ <v-card-subtitle v-if =" !cameraConnected(cameraInfoFor(module.matchedCameraInfo)? .uniquePath)"
163164 >Status: <span class =" inactive-status" >Disconnected</span ></v-card-subtitle
164165 >
165166 <v-card-subtitle
166- v-else-if =" cameraConnected(cameraInfoFor(module.matchedCameraInfo).uniquePath) && !module.mismatch"
167+ v-else-if =" cameraConnected(cameraInfoFor(module.matchedCameraInfo)? .uniquePath) && !module.mismatch"
167168 >Status: <span class =" active-status" >Active</span ></v-card-subtitle
168169 >
169170 <v-card-subtitle v-else >Status: <span class =" mismatch-status" >Mismatch</span ></v-card-subtitle >
@@ -172,7 +173,7 @@ const getMatchedDevice = (info: PVCameraInfo | undefined): PVCameraInfo => {
172173 <tbody >
173174 <tr
174175 v-if ="
175- cameraConnected(cameraInfoFor(module.matchedCameraInfo).uniquePath) &&
176+ cameraConnected(cameraInfoFor(module.matchedCameraInfo)? .uniquePath) &&
176177 useStateStore().backendResults[module.uniqueName]
177178 "
178179 >
@@ -214,7 +215,7 @@ const getMatchedDevice = (info: PVCameraInfo | undefined): PVCameraInfo => {
214215 </tbody >
215216 </v-table >
216217 <div
217- v-if =" cameraConnected(cameraInfoFor(module.matchedCameraInfo).uniquePath)"
218+ v-if =" cameraConnected(cameraInfoFor(module.matchedCameraInfo)? .uniquePath)"
218219 :id =" `stream-container-${index}`"
219220 class =" d-flex flex-column justify-center align-center mt-3"
220221 style =" height : 250px "
@@ -236,7 +237,7 @@ const getMatchedDevice = (info: PVCameraInfo | undefined): PVCameraInfo => {
236237 @click ="
237238 setCameraView(
238239 module.matchedCameraInfo,
239- cameraConnected(cameraInfoFor(module.matchedCameraInfo).uniquePath)
240+ cameraConnected(cameraInfoFor(module.matchedCameraInfo)? .uniquePath)
240241 )
241242 "
242243 >
@@ -315,7 +316,7 @@ const getMatchedDevice = (info: PVCameraInfo | undefined): PVCameraInfo => {
315316 </tr >
316317 <tr >
317318 <td >Connected</td >
318- <td >{{ cameraConnected(cameraInfoFor(module.matchedCameraInfo).uniquePath) }}</td >
319+ <td >{{ cameraConnected(cameraInfoFor(module.matchedCameraInfo)? .uniquePath) }}</td >
319320 </tr >
320321 </tbody >
321322 </v-table >
@@ -330,7 +331,7 @@ const getMatchedDevice = (info: PVCameraInfo | undefined): PVCameraInfo => {
330331 @click ="
331332 setCameraView(
332333 module.matchedCameraInfo,
333- cameraConnected(cameraInfoFor(module.matchedCameraInfo).uniquePath)
334+ cameraConnected(cameraInfoFor(module.matchedCameraInfo)? .uniquePath)
334335 )
335336 "
336337 >
@@ -381,7 +382,7 @@ const getMatchedDevice = (info: PVCameraInfo | undefined): PVCameraInfo => {
381382 <span v-else-if =" camera.PVCSICameraInfo" >CSI Camera:</span >
382383 <span v-else-if =" camera.PVFileCameraInfo" >File Camera:</span >
383384 <span v-else >Unknown Camera:</span >
384-   ; <span >{{ cameraInfoFor(camera)?.name ?? cameraInfoFor(camera)?.baseName }}</span >
385+   ; <span >{{ cameraInfoFor(camera)?.name }}</span >
385386 </v-card-title >
386387 <v-card-subtitle >Status: Unassigned</v-card-subtitle >
387388 <v-card-text class =" pt-3" >
@@ -436,7 +437,7 @@ const getMatchedDevice = (info: PVCameraInfo | undefined): PVCameraInfo => {
436437 <v-dialog v-model =" viewingDetails" max-width =" 800" >
437438 <v-card v-if =" viewingCamera[0] !== null" flat color =" surface" >
438439 <v-card-title class =" d-flex justify-space-between" >
439- <span >{{ cameraInfoFor(viewingCamera[0])?.name ?? cameraInfoFor(viewingCamera[0])?.baseName }}</span >
440+ <span >{{ cameraInfoFor(viewingCamera[0])?.name }}</span >
440441 <v-btn variant =" text" @click =" setCameraView(null, null)" >
441442 <v-icon size =" x-large" >mdi-close</v-icon >
442443 </v-btn >
@@ -447,7 +448,7 @@ const getMatchedDevice = (info: PVCameraInfo | undefined): PVCameraInfo => {
447448 <v-card-text
448449 v-else-if ="
449450 activeVisionModules.find(
450- (it) => cameraInfoFor(it.matchedCameraInfo).uniquePath === cameraInfoFor(viewingCamera[0]).uniquePath
451+ (it) => cameraInfoFor(it.matchedCameraInfo)? .uniquePath === cameraInfoFor(viewingCamera[0])? .uniquePath
451452 )?.mismatch
452453 "
453454 >
0 commit comments