get_and_draw_outbound():
* loop through the slots of every outbound connection, instead of
just the first value (&connect.outbound[0])
* recursively initialize and draw new widgets for each node instead
of writing everything to the same vectors and frame.
get_and_draw_inbound()
* recursively initialize and draw new widgets for each node instead
of writing everything to the same vectors and frame.
for now we have the following hierarchy:
ListObject
NetFrame
NetWidget
where ListObject is composed of NetFrame's and NetFrame is composed of
NetWidget's.
this line was silently crashing:
let inbound_connect: InboundInfo = serde_json::from_value(inbound_connected.clone())?;
we resolve this by parsing the data manually.
we reduce boilerplate by creating a new generic function called draw().
variables are initialized in draw_outbound(), draw_inbound(), and
draw_manual() and are then sent to draw().
dynamic resizing is enabled by returning the total frame length like so:
let len = draw_outbound(...)
let len = draw_inbound(..., len)
it would be cleaner to store this value in a struct. however this is non
trivial to implement.
ui::ui() cannot be async and therefore cannot use mutexes due to its use
in the following non-async function from external library tui::Terminal:
terminal.draw(|f| {
ui::ui(f, view.clone());
})?;
however ui::ui() is called within the async function render(), which
means values set inside ui::ui() may be overwritten during async calls.
let external_addr = addr.as_str().unwrap()
^ this line was crashing when we receive a Null value for external_addr.
we now set the string value to "Null" if external_addr.is_null()
created seperate functions to render the different data types. frames
dynamically resize according to the length of the data. we do this by
keeping track of the previous length and passing it into each new render.
there's a lot of boilerplate rn that needs to be cleaned up, and the
dynamic resizing can probably be further simplified.
NodeId is read from config and is initalized into Model.
The values from Model are then copied into View.
We therefore do not need to read this data in the UI, as it already exists in View.
node_info = HashMap<NodeId, NodeInfo>
If we receive an external addr from the rpc data, we set that as the NodeID.
otherwise we display client's rpc port as the NodeID.
Note: this is a temporary solution until we add a 'name' param to the
config. This commit indicates a number of TODOs.