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

Save network usage processed data as List object #2577 #2583

Conversation

FroggyFlox
Copy link
Member

Fixes #2577
@phillxnet, ready for review

The network widget was not displaying any data due to a change in what the map() function returns:

  • Python2: a list
  • Python3: an iterator

We then pick many elements of that object to construct our "payload" to the widget. Because is is now an iterator, this worked only the first element, but then returned empty for all others, leading to an empty payload to the widget.

Saving this as a list allows us to get back to previous behavior, resulting in a functional widget:
image

In Python2, we directly saved our processed parsing of network
activity directly from `map()`. In Python3, `map()` now returns an
iterator which prevents us from picking each of its included data
one at a time as we used to do (this now only works once).

This commit saves the `map()` object as a List so that we can
extract from it as needed.
- use more explicit variable name for `line`
(fixes PEP 8: E741 ambiguous variable name 'l')
- Update Copyright (date + https)
- Black formatting
Copy link
Member

@phillxnet phillxnet left a comment

Choose a reason for hiding this comment

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

@FroggyFlox Thanks for sorting this out, and for the detailed explanation.
Adding the list cast locally and what do you know:
pr-review-pic-working-net-widget

Nice. Merging now directly.

@phillxnet phillxnet merged commit 11b0cbf into rockstor:testing Jun 7, 2023
@FroggyFlox FroggyFlox deleted the 2577_Py36_Dashboard_Network_widget_not_functional branch August 19, 2023 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants