From 323648e9b70222c27dce58a5516109cacf868937 Mon Sep 17 00:00:00 2001 From: soniacq Date: Fri, 3 Nov 2023 00:05:58 -0400 Subject: [PATCH] Display system status: Active, Pause, Resetting. --- frontend/src/config.ts | 2 ++ .../DebuggingDataView/DebuggingDataView.tsx | 15 +++++--- .../src/tabs/LiveDataView/LiveDataView.tsx | 13 ++++--- .../components/StreamDataView/LiveStream.tsx | 6 +++- .../StreamDataView/PerceptionOutputsView.tsx | 8 ++--- .../StreamDataView/ReasoningOutputsView.tsx | 34 +++++++++++++++++-- 6 files changed, 59 insertions(+), 19 deletions(-) diff --git a/frontend/src/config.ts b/frontend/src/config.ts index ab66bad..15b8cfc 100644 --- a/frontend/src/config.ts +++ b/frontend/src/config.ts @@ -13,6 +13,8 @@ export const EGOVLP_ACTION_STEPS_STREAM = 'egovlp:action:steps'; export const CLIP_ACTION_STEPS_STREAM = 'clip:action:steps'; export const DETIC_HANDS_STREAM = 'detic:hands'; export const MAIN_STREAM = 'main'; +export const PAUSE_REASONING = 'arui:pause'; +export const RESET_REASONING = 'arui:reset'; export const RECORDINGS_UPLOAD_PATh = "/recordings/upload/" diff --git a/frontend/src/tabs/DebuggingDataView/DebuggingDataView.tsx b/frontend/src/tabs/DebuggingDataView/DebuggingDataView.tsx index 91f7ca1..4e47f30 100644 --- a/frontend/src/tabs/DebuggingDataView/DebuggingDataView.tsx +++ b/frontend/src/tabs/DebuggingDataView/DebuggingDataView.tsx @@ -3,8 +3,8 @@ import { StreamView } from '../LiveDataView/components/StreamDataView/LiveStream import { DeticHandsChart } from '../LiveDataView/components/StreamDataView/LiveCharts'; import { ImageView } from '../LiveDataView/components/StreamDataView/ImageView'; import { ClipOutputsView, DeticOutputsView, DeticStateOutputsView, MemoryOutputsView } from '../LiveDataView/components/StreamDataView/PerceptionOutputsView'; -import { ReasoningOutputsView } from '../LiveDataView/components/StreamDataView/ReasoningOutputsView'; -import { DETIC_HANDS_STREAM, DETIC_IMAGE_STREAM, DETIC_MEMORY, EGOVLP_ACTION_STEPS_STREAM, MAIN_STREAM, REASONING_CHECK_STREAM } from '../../config'; +import { PauseView, ReasoningOutputsView, ResetView } from '../LiveDataView/components/StreamDataView/ReasoningOutputsView'; +import { DETIC_HANDS_STREAM, DETIC_IMAGE_STREAM, DETIC_MEMORY, EGOVLP_ACTION_STEPS_STREAM, MAIN_STREAM, PAUSE_REASONING, REASONING_CHECK_STREAM, RESET_REASONING } from '../../config'; function DebuggingDataView() { return ( @@ -23,7 +23,14 @@ function DebuggingDataView() { - + + + {data => ()} + + + {data => ()} + + {data => ()} @@ -31,7 +38,7 @@ function DebuggingDataView() { - {data => ()} + {data => ()} {/* */} diff --git a/frontend/src/tabs/LiveDataView/LiveDataView.tsx b/frontend/src/tabs/LiveDataView/LiveDataView.tsx index 528287d..a3a4020 100644 --- a/frontend/src/tabs/LiveDataView/LiveDataView.tsx +++ b/frontend/src/tabs/LiveDataView/LiveDataView.tsx @@ -71,21 +71,20 @@ function LiveVideo() { gridTemplateAreas: { lg: ` "c c c c c c" + "h M M M M i" "h M M M M r" - "g M M M M a" - "g M M M M a" + "g M M M M r" `, md: ` "c c c c c c" + "h M M M M i" "h M M M M r" - "g M M M M a" - "g M M M M a" + "g M M M M r" `, xs: ` "c c c c c c" - "h M M M M r" - "g M M M M a" - "g M M M M a" + "h M M M M i" + "g M M M M r" ` }, }}> diff --git a/frontend/src/tabs/LiveDataView/components/StreamDataView/LiveStream.tsx b/frontend/src/tabs/LiveDataView/components/StreamDataView/LiveStream.tsx index 1ac3af0..cd390fb 100644 --- a/frontend/src/tabs/LiveDataView/components/StreamDataView/LiveStream.tsx +++ b/frontend/src/tabs/LiveDataView/components/StreamDataView/LiveStream.tsx @@ -43,13 +43,17 @@ export const StreamInfo = ({ sid, time, displayStatus=true, data, readyState, ch {time && } { - displayStatus && 0 } sx={{display: 'block', '& .MuiBadge-badge': {height: '10px', minWidth: '10px'}}}> {children} + : + + {children} + } } diff --git a/frontend/src/tabs/LiveDataView/components/StreamDataView/PerceptionOutputsView.tsx b/frontend/src/tabs/LiveDataView/components/StreamDataView/PerceptionOutputsView.tsx index 93b1262..17d2322 100644 --- a/frontend/src/tabs/LiveDataView/components/StreamDataView/PerceptionOutputsView.tsx +++ b/frontend/src/tabs/LiveDataView/components/StreamDataView/PerceptionOutputsView.tsx @@ -39,9 +39,9 @@ export const DeticStateOutputsView = ({ data_, min=0 } ) => { var objectsState = data_ && data_.map((data: DeticOutputsViewProps, index) => { const entries = data && data['state'] && Object.entries(data['state'] ); const noAction = entries && entries.every(([t,s]) => s === 0) - return entries && ( + return entries && ( {data['label']} - {noAction && } + {noAction && } {entries && entries.sort(([ta, sa], [tb,sb]) => ( sb-sa )) .slice(0, noAction ? 2 : 3) .map(([text, similarity]) => ( @@ -78,7 +78,7 @@ export const DeticOutputsView = ({data}: {data: ObjLabel []}) => { }); var detectedObjects = Object.keys(listLabels).length>0 && Object.keys(listLabels).map((element:string, index: number) => { var label= element + ":" + listLabels[element]; - return + return }); return ( <> @@ -103,7 +103,7 @@ export const MemoryOutputsView = ({data}: {data: ObjLabel []}) => { }); var detectedObjects = Object.keys(listLabels).length>0 && Object.keys(listLabels).map((element:string, index: number) => { var label= element + ":" + listLabels[element]; - return + return }); return ( <> diff --git a/frontend/src/tabs/LiveDataView/components/StreamDataView/ReasoningOutputsView.tsx b/frontend/src/tabs/LiveDataView/components/StreamDataView/ReasoningOutputsView.tsx index d0d88ef..162e94c 100644 --- a/frontend/src/tabs/LiveDataView/components/StreamDataView/ReasoningOutputsView.tsx +++ b/frontend/src/tabs/LiveDataView/components/StreamDataView/ReasoningOutputsView.tsx @@ -1,4 +1,4 @@ -import {Box, Chip, Button } from '@mui/material'; +import {Box, Chip, Button, Alert, AlertTitle } from '@mui/material'; import { useRecordingControls } from '../../../../api/rest'; import DoneIcon from '@mui/icons-material/Done'; import RotateLeftIcon from '@mui/icons-material/RotateLeft'; @@ -10,6 +10,7 @@ import { DETIC_IMAGE_STREAM, REASONING_ENTITIES_STREAM } from '../../../../confi import ArrowBackIcon from '@mui/icons-material/ArrowBack'; import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; import WozStatusComp from '../../../IntervenorView/woz-status'; +import React, { useState, useEffect, useContext } from 'react'; interface Entity { ingredients: string [], @@ -39,6 +40,33 @@ interface InProgressTask { let entities: Entities [] = []; let inProgressTask_: InProgressTask[]=[]; let flag = true; +let systemStatus = "Active"; + +export const PauseView = ({ data }) => { + if(data=="start"){ + systemStatus = "PAUSE"; + } + if(data=="resume"){ + systemStatus = "Active"; + } + return System Status: {systemStatus}; +} + +export const ResetView = ({ data }) => { + let message = ""; + let showResetMessage = data=="reset"; + if(showResetMessage){ + message = "Resetting ..."; + } + useEffect(() => { + // when the component is mounted, the alert is displayed for 3 seconds + setTimeout(() => { + message = ""; + }, 3000); + }, [data]); + return showResetMessage ? {message} :<>; +} + export const ReasoningOutputsView = ({ data }) => { var activeTasks = data && data['active_tasks'] && data['active_tasks'].map((active_tasks, index) => { const {task_id, task_name, step_id, step_status, step_description, error_status, error_description} = active_tasks || {}; // reading the prediction that has the highest probability. @@ -48,7 +76,7 @@ export const ReasoningOutputsView = ({ data }) => { if (!inProgressTask_.find(e => e.id === task_id)) { inProgressTask_.push({id: task_id, name: task_name}); } - return active_tasks && ( + return active_tasks && ( Task ID: {task_id} Task Name: {task_name} Current Step: {current_step} @@ -60,7 +88,7 @@ export const ReasoningOutputsView = ({ data }) => { const inprogress_tasks = data && data["inprogress_task_ids"]; const listinprogress = inProgressTask_ && inProgressTask_.map((element:InProgressTask, index: number) => { - return inprogress_tasks && inprogress_tasks.includes(element.id) && () + return inprogress_tasks && inprogress_tasks.includes(element.id) && () }); return Active Tasks: {data && data['active_tasks'] && data['active_tasks'].length} tasks