diff --git a/extensions/prototypes/labgraph_monitor/README.md b/extensions/prototypes/labgraph_monitor/README.md
index a5b1566b..698aefca 100644
--- a/extensions/prototypes/labgraph_monitor/README.md
+++ b/extensions/prototypes/labgraph_monitor/README.md
@@ -7,7 +7,7 @@ This extension is an interactive visualization tool to monitor and make real-tim
**Prerequisites**:
- [Node.js](https://nodejs.org/en/)
-- [Yarn](https://classic.yarnpkg.com/lang/en/docs/install)
+- [Yarn](https://classic.yarnpkg.com/lang/en/docs/install) (**RECOMMENDED**)
Check that node and yarn were properly installed by running the following commands
@@ -21,28 +21,31 @@ yarn -v
**Set up the application**
+(!) The following tutorial utilizes **yarn** (recommended) however **npm** can be utilized as well.
+
1. Be sure that you are inside **extensions/prototypes/labgraph_monitor** directory
```
-cd extensions/prototypes/labgraph_monitor
+labgraph> cd extensions/prototypes/labgraph_monitor
+labgraph\extensions\prototypes\labgraph_monitor>
```
2. Install dependencies by running **yarn** command
```
-yarn
+labgraph\extensions\prototypes\labgraph_monitor> yarn
```
3. Test the application by running the following command
```
-yarn test --watchAll=false
+labgraph\extensions\prototypes\labgraph_monitor> yarn test --watchAll=false
```
4. Run the application
```
-yarn start
+labgraph\extensions\prototypes\labgraph_monitor> yarn start
```
(!) The application will be running on **localhost:3000** by default
@@ -71,7 +74,8 @@ REACT_APP_WS_API="ws://127.0.0.1:9000"
(!) LabGraph Websocket server runs on localhost:9000 by default
-2. Run Labgraph Websockets server. The following tutorial shows how to run LabGraph Websocket server properly : [tutorial](https://github.com/facebookresearch/labgraph/pull/58/files#diff-247005c77570899ce53f81a83b2a5fe6e7535616cc96564d67378fe7f73dac49)
+2. Run Labgraph Websockets server.
+ `python3 extensions/yaml_support/labgraph_monitor/examples/labgraph_monitor_example.py`
3. Under LabGraph Monitor settings panel click on REALTIME option and click connect.
@@ -82,7 +86,7 @@ To see the information related to a specific node or edge, just click on it, the
Node
-
Edge
+
edge
@@ -93,3 +97,19 @@ To see the information related to a specific node or edge, just click on it, the
**Nodes** : currently when a node is clicked its name will be displayed, However, this feature will be updated in the future to include more information.
**Edges** : currently when an edge is clicked the "message_name", "message_fields" and "fields_datatypes" will be displayed, However, this feature will be updated in the future to include more information (E.g: the field value in realtime).
+
+## Architecture Overview
+
+This is a bird's-eye view of the architecture of Labgraph Monitor.
+
+
+
+This web application is composed of multiple components (redux, pages, mocks, contextx, and components) below is the overview diagram for each:
+
+### Redux diagram:
+
+
+
+### Redux & Edge Settings
+
+
diff --git a/extensions/prototypes/labgraph_monitor/src/components/SettingPanel/EdgeSettings.tsx b/extensions/prototypes/labgraph_monitor/src/components/SettingPanel/EdgeSettings.tsx
index be5c4f74..cb086f68 100644
--- a/extensions/prototypes/labgraph_monitor/src/components/SettingPanel/EdgeSettings.tsx
+++ b/extensions/prototypes/labgraph_monitor/src/components/SettingPanel/EdgeSettings.tsx
@@ -14,15 +14,22 @@ import {
TableHead,
TableRow,
Typography,
+ Button,
} from '@mui/material';
-import React from 'react';
+import React, { useEffect } from 'react';
import { RootState } from '../../redux/store';
-import { useSelector } from 'react-redux';
+import { useDispatch, useSelector } from 'react-redux';
import WS_STATE from '../../redux/reducers/graph/ws/enums/WS_STATE';
+import { setMockRealtimeData } from '../../redux/reducers/graph/mock/mockReducer';
interface IMessage {
name: string;
- fields: { [fieldName: string]: string };
+ fields: {
+ [fieldName: string]: {
+ type: string;
+ content: any;
+ };
+ };
}
/**
@@ -37,8 +44,11 @@ const Edge: React.FC = (): JSX.Element => {
(state: RootState) => state.ws
);
const { mockGraph } = useSelector((state: RootState) => state.mock);
-
+ const mockData = useSelector(
+ (state: RootState) => state.mock.mockRealtimeData
+ );
const graph = connection === WS_STATE.CONNECTED ? realtimeGraph : mockGraph;
+ const [open, setOpen] = React.useState(false);
const messages: IMessage[] =
graph && selectedEdge.target
@@ -46,6 +56,23 @@ const Edge: React.FC = (): JSX.Element => {
selectedEdge.source
]
: [];
+ const handleToggle = () => {
+ setOpen(!open);
+ };
+ // creating mock data, check mockReducer.ts, IMock.ts and EdgeSettings.tsx for future updates
+ const dispatch = useDispatch();
+
+ useEffect(() => {
+ const id = setInterval(() => {
+ const date = Date.now();
+
+ dispatch(
+ setMockRealtimeData([date, date % 10, date * 3, date / 4])
+ );
+ }, 100);
+
+ return () => clearInterval(id);
+ }, [dispatch]);
return (
@@ -62,20 +89,55 @@ const Edge: React.FC = (): JSX.Element => {
+ {/* ZMQMessage Edge */}
{Object.entries(message.fields).map(
- ([name, type]) => {
+ (field, index) => {
return (
-
+
- {name}
+ {field[0]}
- {type}
+ {field[1].type}
);
}
)}
+
+
+ {Object.entries(message.fields).map(
+ (field, index) => {
+ return (
+
+ {open && (
+
+ {field[0]}
+
+ )}
+ {open ? (
+
+ {connection ===
+ WS_STATE.CONNECTED
+ ? `${field[1].content}, `
+ : mockData.join(
+ ' '
+ )}
+
+ ) : null}
+
+ );
+ }
+ )}