-
Notifications
You must be signed in to change notification settings - Fork 47
Bennaaym/labgraph monitor #60
Bennaaym/labgraph monitor #60
Conversation
…vious graph structure is different than the new one
…e extensions/prototypes/labgraph_monitor
|
hey @bennaaym. again, awesome work! i just wanted to let you know that there are two sub-directories under |
|
@dtemir thank you for reporting that, "/home" wasn't supposed to be committed. I removed it. |
| @@ -0,0 +1,8 @@ | |||
| #!/bin/sh | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is .husky file a compulsory file for this commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently I'm using prettier, eslint, husky to automate formatting, identifying patterns which keeps the code consistent and production-ready.
I believe that aligns with the approach that LabGraph is using with python by using flake8. The point of using husky is to automate the process through git-hooks, my current code will run a check whenever a contributor tries to add a new commit(pre-commit git-hook) that will prevent bad commits from being committed if there are any (e.g: unwanted console.log(), unused packages, unformatted code ...).
The husky script will run only if there is a change in the extensions/prototypes/labgraph_monitor directory.
| @@ -0,0 +1,3 @@ | |||
| # https://www.robotstxt.org/robotstxt.html | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this robots.txt used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
robots.txt file tells search engine crawlers which URLs the crawler can access on the site (Robots Exclusion Protocol). This is used mainly to avoid overloading the site with requests. It is mainly useful in case Labgraph Monitor will be deployed. It can be deleted in case of localhost usage.
| @@ -0,0 +1,9601 @@ | |||
| # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to have this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yarn unlike npm provides a deterministic approach to set up node_modules using Lockfiles that ensures that every install results in the exact same file structure in node_modules across all machines. Deleting yarn.lock may create errors when trying to set up the dependencies. ref: https://engineering.fb.com/2016/10/11/web/yarn-a-new-package-manager-for-javascript/
jfResearchEng
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contributing this PR! This looks good and please have a quick review of my comments.
|
Hi, @fzchriha thanks for helping review this PR. The current application makes use of all the data provided by the WebSocket API, adding new features to the frontend should always be associated with updates in the backend. These are some features that I think are useful and align with LabGraph Monitor vision:
|
|
Thanks, bennaaym, for replying to the comments and recommendations on additional features! I've asked an additional reviewer to help review this PR by end of this week. |
navn-r
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @@ -0,0 +1,7 @@ | |||
| { | |||
| "trailingComma": "es5", | |||
| "tabWidth": 4, | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick Question, is this tab width also consistent with the formatting on the Python side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently, flake8 show a warning if the tab size isn't a multiple of 4 however the code can be always committed (that might need to be automated more). For typescript Airbnb guidelines suggest using 2 as tab size however I changed it to 4 to keep it consistent with Python.
ref: 949ffc9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I'm used to the Airbnb spec with 2, and probably most Front End contributors would be as well. However, if the repo wants to be consistent for both React and Python then yea I guess thats okay.
|
|
||
| Once Node is installed, you can verify that node/npm was installed successfully by running the following: | ||
| - [Node.js](https://nodejs.org/en/) | ||
| - [Yarn](https://classic.yarnpkg.com/lang/en/docs/install) (**RECOMMENDED**) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't put this as recommended, rather it should be compulsery. What we don't want is a contributor thinking its okay to just use npm and the repo would end up with two lockfiles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. however, I don't think there is a way to prevent the user from using npm. I added package-lock.json to .gitignore to prevent it from being committed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I think that works. My suggestion was really to tell a contributor
"hey don't use npm, just stick with yarn"
| **Set up the application** | ||
|
|
||
| The above should display the version of node/npm that were installed. For example: | ||
| (!) The following tutorial utilizes **yarn** (recommended) however **npm** can be utilized as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above statement about yarn and npm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| labgraph> cd extensions/prototypes/labgraph_monitor | ||
| labgraph\extensions\prototypes\labgraph_monitor> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick, since everyone has different prompts for their terminals, It would be better to have just
| labgraph> cd extensions/prototypes/labgraph_monitor | |
| labgraph\extensions\prototypes\labgraph_monitor> | |
| cd extensions/prototypes/labgraph_monitor |
as the step, so contributors could just copy paste the code snippet as they go through.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| Note: npx is a package that comes with npm 5.2+ | ||
| ``` | ||
| npx create-react-app labgraph_monitor_extension | ||
| labgraph\extensions\prototypes\labgraph_monitor> yarn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Nitpick] Same applies here, at this step, its assumed that the user is already at the given directory, so we could just have
| labgraph\extensions\prototypes\labgraph_monitor> yarn | |
| yarn |
Again this is just a nitpick, but if proceeding with my suggestion, make sure to do it to the other code snippets as well.
🤠
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| dispatch(setConnection(WS_STATE.IS_CONNECTING)); | ||
| }; | ||
|
|
||
| const handleDiconnect = (event: React.FormEvent<HTMLFormElement>) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const handleDiconnect = (event: React.FormEvent<HTMLFormElement>) => { | |
| const handleDisconnect = (event: React.FormEvent<HTMLFormElement>) => { |
be sure to change the other places in which this function is called :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| const [mock, setMock] = useState<string>(''); | ||
| const dispatch = useDispatch(); | ||
|
|
||
| const handleChange = (_: React.SyntheticEvent, newValue: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a bit redundant, we could just have (_, newValue) => setValue(newValue) inside the onChange, rather than having a brand new function. Either remove it, or rename it to something less generic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| {selectedNode.id && <Typography>{selectedNode.id}</Typography>} | ||
| {!selectedNode.id && ( | ||
| <Typography style={{ fontSize: '.8rem', fontWeight: 400 }}> | ||
| Click on a node to see its information | ||
| </Typography> | ||
| )} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| {selectedNode.id && <Typography>{selectedNode.id}</Typography>} | |
| {!selectedNode.id && ( | |
| <Typography style={{ fontSize: '.8rem', fontWeight: 400 }}> | |
| Click on a node to see its information | |
| </Typography> | |
| )} | |
| {selectedNode?.id ? (<Typography>{selectedNode.id}</Typography>) : ( | |
| <Typography style={{ fontSize: '.8rem', fontWeight: 400 }}> | |
| Click on a node to see its information | |
| </Typography> | |
| )} |
Better to switch to ternary in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| const WSContextProvider: React.FC<ReactNode> = ({ children }): JSX.Element => { | ||
| const { connection, graph } = useSelector((state: RootState) => state.ws); | ||
|
|
||
| const clientRef = useRef<any>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick, not helpful to have any, could we replace that with its actual type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| */ | ||
| import INode from './INode'; | ||
|
|
||
| interface IGraph { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this interface is present in multiple files. Any way we could just have one central source for the IGraph, INode interfaces, rahter than multiple IGraph.ts files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done


Description
This PR is an improvement of the existing Labgraph Monitor application
The PR adds the following :
(!) this PR is complementary to the following PR Bennaaym/yaml support #58
Fixes #45
Type of change
Feature/Issue validation/testing
Tested the different components of the application using react-testing-library & jest
Checklist: