Closed EmeraldWither closed 2 months ago
Hey thanks for looking at this.
There should also be some way of unit testing this, the PR for restructuring the NT dependency makes testing it much easier, so it might make more sense to add unit tests for notifications after the rework is complete
Unit testing is something that I haven't done before (😓), but my summer break starts today, so I will take a look at how to do this and will put in later.
Attention: Patch coverage is 23.07692%
with 20 lines
in your changes missing coverage. Please review.
Project coverage is 45.45%. Comparing base (
f1d29a6
) to head (4666061
).:exclamation: Current head 4666061 differs from pull request most recent head cce8f91
Please upload reports for the commit cce8f91 to get more accurate results.
Files | Patch % | Lines |
---|---|---|
lib/services/robot_notifications_listener.dart | 13.63% | 19 Missing :warning: |
lib/pages/dashboard_page.dart | 66.66% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@EmeraldWither quick question, what's the reason for having it send all if it ignores the notification on initial connection?
Also, I merged all of these changes into the nt-dependency-rework branch
, so you can add unit tests for this much easier. Whenever you're ready, just make a PR to that branch. Let me know if you need any help with the tests
This is definitely a great addition, thanks for making this!
On the initial connection, when I start listening, it will always call the method with whatever is currently inside the topic, even if it's old/stale data (eg, rebooting elastic will cause the notification so show again even though we haven't actually posted anything).
By ignoring the first time that this happens, this allows us to only receive the new data.
https://github.com/Gold872/elastic-dashboard/assets/68785503/6e22f1bb-cafc-4cf4-82bd-e77da0f40d26
Robot code usage:
There are 3 levels of notifications:
INFO:![image](https://github.com/Gold872/elastic-dashboard/assets/68785503/26fe05e0-9076-47f6-abfd-84ba2c8e31e9)
WARNING:![image](https://github.com/Gold872/elastic-dashboard/assets/68785503/0e2e9170-ba6c-4b6e-a959-2fe08125a0b7)
ERROR:![image](https://github.com/Gold872/elastic-dashboard/assets/68785503/c94b1231-c3b9-46f8-88cd-5bdb84e43853)
The idea is that the driver can get a notification when something happens (eg. an arm extends too far and gets disabled).
Users can copy the Elastic class into their robot project, and use those methods to push notifications to the dashboard.