Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output CSV and implement packet logger #226

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open

Conversation

Brenn515
Copy link
Contributor

This PR allows logged packets to be saved to a CSV file. It also adds a log for packets sent by Basestation.

UhOhDonovan
UhOhDonovan previously approved these changes Oct 12, 2022
src/RON/components/PacketLogger.tsx Outdated Show resolved Hide resolved
@@ -104,10 +111,29 @@ class PacketLogger extends Component<IProps, IState> {
this.setState((prevState) => ({ data: [newData].concat(prevState.data) }));
}

exportPacket(): void {
fs.writeFile(
'packetLog.csv',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should specify that it's the received packet log, and include the timestamp so it doesn't overwrite if we save multiple logs before we analyze them.

Comment on lines +124 to +128
(err) => {
if (err) console.log(err);
else {
console.log('File written successfully\n');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to log that it was a success. We can assume it was successful if it didn't give an error. We should log this error to the app's logger, not the console log. rovecomm.emit('all', 'Error saving log');

@@ -131,6 +157,9 @@ class PacketLogger extends Component<IProps, IState> {
showPageSizeOptions={false}
style={{ textAlign: 'center', margin: 'auto' }}
/>
<button type="button" style={buttons} onClick={() => this.exportPacket()}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should pass the exportPacket function as a parameter here instead of creating an anonymous function just to call it.

Comment on lines +8 to +12
const h1Style: CSS.Properties = {
fontFamily: 'arial',
fontSize: '18px',
margin: '5px 0px',
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused css

Comment on lines +36 to +45
const selectbox: CSS.Properties = {
display: 'flex',
flexDirection: 'row',
width: '75%',
margin: '2.5px',
justifyContent: 'space-around',
};
const selector: CSS.Properties = {
width: '200px',
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused CSS


addData(newData: any): void {
this.setState((prevState) => ({ data: [newData].concat(prevState.data) }));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add a clear button or only save up to like 100 packets for this since we don't want it to eat up the entire system's memory over the entire time of a task saving every packet that was sent.

src/RON/components/PacketLogger.tsx Outdated Show resolved Hide resolved
Comment on lines +5 to +6
// import "../../node_modules/react-table-v6/react-table.css"
import { rovecomm, RovecommManifest } from '../../Core/RoveProtocol/Rovecomm';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manifest is unused, so can be removed. Commented line can be removed

@wiidler wiidler dismissed UhOhDonovan’s stale review October 21, 2023 19:33

changes need to be made

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export packet logs to csv file Add sent packet log
4 participants