Commit Graph

70 Commits

Author SHA1 Message Date
parazyd
f4bab15776 Update dependencies and CI. 2022-04-23 21:21:19 +02:00
parazyd
0299b45de3 Update all dependencies. 2022-04-23 21:21:15 +02:00
parazyd
d77d4dc02c Update dependencies. 2022-04-23 21:21:10 +02:00
lunar-mining
2e700efdc7 dnetview: create random id when channel is empty 2022-04-23 11:40:44 +02:00
lunar-mining
1301d2576c dnetview: serialize info into a hex string to create unique ids 2022-04-23 10:33:35 +02:00
lunar-mining
1b0e12aae4 dnetview/ parse: make NodeId unique to each node
solve problem of endless creation of new node_ids. we derive the id from
the node_name, insuring there are no duplicates.

our method for doing this right now is very weird- we convert the String
node_name into a u64. going forward we will likely replace the node_id
with a hash to be more straightforward.
2022-04-22 10:57:24 +02:00
lunar-mining
a9339c8018 dnetview/ error: created ValueIsNotObject error to handle when as_object == None 2022-04-22 08:28:39 +02:00
lunar-mining
fd588ef16c dnetview/ parse: return SessionInfo from parsing functions + cleanup 2022-04-22 08:03:04 +02:00
lunar-mining
4f8a8cd6d8 dnetview/ parse_data: change if/else parse logic to match 2022-04-21 09:52:12 +02:00
lunar-mining
ec26d1254f dnetview/ parse_data: add data to model and simplify
remove redundant model_vec
2022-04-21 09:08:54 +02:00
lunar-mining
0a7fe06449 dnetview/model: cleanup 2022-04-21 08:22:49 +02:00
lunar-mining
cc96f904b9 dnetview: make info hashmap singular and update README
instead of making several info hashmaps like so:

node_info = HashMap<NodeId, NodeInfo>
session_info = HashMap<SessionId, SessionInfo>

we make a single info hashmap:

infos = HashMap<Id, SelectableObject>

this is so we can keep track of what kind of selectable object the ID is
associated with.
2022-04-21 08:15:20 +02:00
lunar-mining
53f9ba6b2c dnetview: major refactor of Model/ underlying data structure
we create 3 types of info objects, NodeInfo, ConnectInfo, and
SessionInfo. NodeInfo is the parent and ConnectInfo and SessionInfo are children.

These info objects are passed into an enum:

enum SelectableObject {
    Node(NodeId)
    Session(SessionId)
    Connect(ConnectId)
}

We protect this data using mutexes and write it to a hashmap:

Mutex<FxHashMap<u32, SelectableObject>

View has not yet been updated with this new design.
2022-04-19 11:41:40 +02:00
lunar-mining
fc098b894c dnetview: move data parsing from RPC into isolated function, parse_data() 2022-04-19 11:41:40 +02:00
lunar-mining
4785fd31ff dnetview: updated README 2022-04-19 11:41:40 +02:00
lunar-mining
566bdf55ea dnetview: replace Vec<SelectableObject> with NodeInfo on model and view
this commit fixes ui::ui(). it's a temporary measure until we finish the
refactor.
2022-04-19 11:41:40 +02:00
lunar-mining
668fae0617 dnetview: create enum SelectableObject and pass to view, model
this commit breaks ui::ui()
2022-04-19 11:41:40 +02:00
lunar-mining
a21578088f dnetview: update README 2022-04-15 11:30:58 +02:00
lunar-mining
4a748d85f1 Merge branch 'master' of github.com:darkrenaissance/darkfi 2022-03-28 23:53:39 +02:00
parazyd
f940f653b2 General clippy cleanups. 2022-03-28 21:03:17 +02:00
parazyd
9b429d9b6c Update dependency versions. 2022-03-28 19:59:38 +02:00
parazyd
29c0cb9c09 Update dependency versions throughout project. 2022-03-28 19:59:37 +02:00
lunar-mining
d6b48f71a8 remove Addr structs and cleanup 2022-03-20 11:21:14 +01:00
lunar-mining
ba574bd75c create new data structures to enable addr sub-list 2022-03-19 09:23:05 +01:00
lunar-mining
6e5d94c632 ui: removed redundant is_empty check 2022-03-19 07:43:15 +01:00
lunar-mining
845040f978 small fix on Empty slot data
* Stopped pasting "Empty" on top of "Null"
2022-03-19 07:38:06 +01:00
lunar-mining
acb77e5be9 display node name instead of rpc_url
* read name param from config and display in UI
* rename node_id to rpc_url
2022-03-19 07:22:08 +01:00
lunar-mining
f19aeeecc8 add 'name' param to dnetview_config.toml 2022-03-19 07:13:00 +01:00
lunar-mining
344e06f7c8 rename Map struct to DNetView 2022-03-19 07:12:36 +01:00
ghassmo
75d01fb0cb bin/dnetview: use fxhash for HashMap and HashSet 2022-03-19 00:52:33 +04:00
lunar-mining
d773815e63 bug fix: only render title if it's not empty 2022-03-18 18:56:31 +01:00
lunar-mining
6165a9fb96 bug fix: stop rendering outbound recursively
move outbound outside loop
2022-03-18 18:56:31 +01:00
lunar-mining
ce810207e9 bug fix: only print Incoming/ Outgoing/ Manual once
move title outside for loop so it doesn't get printed recursively.
2022-03-18 18:56:31 +01:00
lunar-mining
7b57c39314 bug fix: stop saving duplicate incoming values
removed nested loop that was causing incoming data to be saved twice.
2022-03-18 18:56:31 +01:00
lunar-mining
1e7c8c09eb model: add is_empty param to Slot, OutboundInfo and InboundInfo
discard empty connections efficiently and only render when is_empty
== false.

for outbound connections, use iter().all() to ensure that is_empty is
only set to false when all slots are empty.
2022-03-18 18:56:31 +01:00
lunar-mining
9e14a3849f ui: add debug info 2022-03-18 18:56:31 +01:00
lunar-mining
7895493c84 ui: don't render Incoming sessions if they are empty 2022-03-18 18:56:31 +01:00
parazyd
36fa2e020c net: Minor cleanups for idiomatic naming. 2022-03-17 13:35:18 +01:00
parazyd
92a4410e31 Miscellaneous fixes and 'make fix'. 2022-03-16 22:30:54 +01:00
parazyd
c7d0d4ca32 Update crate version dependencies throughout the codebase. 2022-03-16 22:30:54 +01:00
lunar-mining
560acab1b6 ui: render msgs as a vec![Spans]. finish first version of dnetview.
Previously, we were trying to render messages using a seperate widget
called Paragraph. This would enable us to put msgs on the right of the
screen using the enum Alignment.

However, rendering msgs as a seperate widget meant we had to keep track
of the position of other widgets in order to align properly. This quickly
became highly complex.

Instead, we have now rendered all the data in a single widget called List.
List is composed of a ListItem which is composed of Spans. Spans
indiciate a seperate line whereas Span is a grapheme on a single line.

We render addrs and msgs on the same line as follows:

    lines.push(Spans::from(vec![addr, msgs])

Where lines is a Vec<Spans> that initializes ListItem.

We are currently aligning the msgs Span with empty spaces, which is the
method used by tui-rs/example/list.rs. Ideally we would use some variant
of Alignment for this so we don't have variation between screen sizes.
2022-03-16 08:49:38 +01:00
lunar-mining
72205bc1f0 ui: render connection data (no msgs)
render is working properly as of this commit. we still do not render
msgs, as using a different alignment requires more complexity.
2022-03-15 14:08:22 +01:00
lunar-mining
0086435862 ui: dramatically simplify.
removed all structs and now simply printing connection data under the
related node ID.

for now there is zero formatting: we simply print the info.
2022-03-15 14:08:22 +01:00
lunar-mining
a43c8a84bd ui: better names.
ListObject -> NodeBox
NetFrame -> ConnectBox
NetWidget -> InfoBox
2022-03-14 11:47:58 +01:00
lunar-mining
4f79726875 ui() bug fix.
replace

    if foo.to_str().is_empty()

with

    if foo.to_str() == "Empty"
2022-03-14 10:49:08 +01:00
lunar-mining
73af3e4d02 poll() bug fix.
do not discard empty values on outgoing connections.
2022-03-14 10:49:08 +01:00
ghassmo
456cee39dd bin/dnetview: cargo fmt 2022-03-14 01:44:50 +04:00
lunar-mining
a4f0904e46 ui() bug fix.
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.
2022-03-13 22:20:57 +01:00
lunar-mining
33f299f8c6 poll() bug fix.
write "Null" to Outbound object instead of empty String when the channel
is "Null".
2022-03-13 22:18:56 +01:00
lunar-mining
e6dce6d3f7 poll: fix match error due to quotation marks around str
serde_json deserializes strings with quotation marks, and you can have
to explicitly convert them using to_str() to extract the inner value.
2022-03-13 20:15:45 +01:00