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

Move various state computations from the UI to the NodeModel #434

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jarolrod
Copy link
Member

@jarolrod jarolrod commented Nov 21, 2024

To enforce clear seperation between the UI and the backend, as well as to begin the removal of any js functions, this shifts the following string construction and state computations from the UI into the NodeModel itself (which is where it belongs)

  • formatted verification progress string
  • connected state
  • synced state
  • estimating state
  • formatted remaining sync time

These strings and states are now available and reusable wherever they may be needed, instead of needing to be computed by every file which needs that information.

As a rule, the UI should have no computation of any sorts outside of things related to UI specific ideas such as color or sizing; any other computation needs to be strictly done in our backend.

Instead of having the UI compute the formatted version of verification
progress using js, move this computation into the nodemodel; where it
belongs.

The UI is the UI, and the backend is the backend.
Instead of having the UI compute when the node is connected to the
network, move this computation into the nodemodel; where it belongs.

The UI is the UI, and the backend is the backend.
Instead of having the UI compute when the node is synced, move this
computation into the nodemodel; where it belongs.

The UI is the UI, and the backend is the backend.
Instead of having the UI construct the formatted version of the
remaining sync time as well as computing when the node is estimating the
remaining sync time using js, move this construction and computation
into the nodemodel; where it belongs.

The UI is the UI, and the backend is the backend.
This is not needed, and we cannot have any javascript functions.
Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

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

cr ACK

It looks much cleaner. Regarding the formatting, as discussed offline, I'd take it out from the NodeModel, I think it's not its responsibility and not related with business logic and the node itself, I'd create a separate object to make the formatting.

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