Skip to content

Peers window: Show direction in a new column, with clearer icon #363

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

Closed
wants to merge 3 commits into from

Conversation

luke-jr
Copy link
Member

@luke-jr luke-jr commented Jun 12, 2021

Replaces the space-wasting "Inbound"/"Outbound" strings with left/right pointing to/from the address, and a tiny text label (which can be translated) overlayed.

@jarolrod jarolrod added the UX All about "how to get things done" label Jun 13, 2021
@ghost
Copy link

ghost commented Jun 14, 2021

Would be helpful to attach screenshot before/after code change.

Copy link
Member

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

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

I don't agree with this patchset and I think #317 is the way to go. If it appeases everyone, #317 can keep the arrows next to the address.

Some notes:
This patchset is quite complicated for what it seeks to accomplish. It can be condensed down into this diff:

diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp
index 9188cc32f..d20de25f5 100644
--- a/src/qt/peertablemodel.cpp
+++ b/src/qt/peertablemodel.cpp
@@ -73,9 +73,14 @@ QVariant PeerTableModel::data(const QModelIndex& index, int role) const
         switch (column) {
         case NetNodeId:
             return (qint64)rec->nodeStats.nodeid;
+        case Direction:
+            return QString(rec->nodeStats.fInbound ?
+                               //: An Inbound Connection from a Peer.
+                               "↓ " + tr("IN") :
+                               //: An Outbound Connection to a Peer.
+                               "↑ " + tr("OUT"));
         case Address:
-            // prepend to peer address down-arrow symbol for inbound connection and up-arrow for outbound connection
-            return QString::fromStdString((rec->nodeStats.fInbound ? "↓ " : "↑ ") + rec->nodeStats.addrName);
+            return QString::fromStdString(rec->nodeStats.addrName);
         case ConnectionType:
             return GUIUtil::ConnectionTypeToQString(rec->nodeStats.m_conn_type, /* prepend_direction */ false);
         case Network:
@@ -94,6 +99,7 @@ QVariant PeerTableModel::data(const QModelIndex& index, int role) const
         switch (column) {
         case NetNodeId:
             return QVariant(Qt::AlignRight | Qt::AlignVCenter);
+        case Direction:
         case Address:
             return {};
         case ConnectionType:
diff --git a/src/qt/peertablemodel.h b/src/qt/peertablemodel.h
index a02472550..07e2ebfc1 100644
--- a/src/qt/peertablemodel.h
+++ b/src/qt/peertablemodel.h
@@ -48,6 +48,7 @@ public:
 
     enum ColumnIndex {
         NetNodeId = 0,
+        Direction,
         Address,
         ConnectionType,
         Network,
@@ -86,6 +87,9 @@ private:
         /*: Title of Peers Table column which contains a
             unique number used to identify a connection. */
         tr("Peer"),
+        /*: Title of Peers Table Column which indicates
+            the direction of the peer connection. */
+        tr("Direction"),
         /*: Title of Peers Table column which contains the
             IP/Onion/I2P address of the connected peer. */
         tr("Address"),
diff --git a/src/qt/peertablesortproxy.cpp b/src/qt/peertablesortproxy.cpp
index 78932da8d..f92eef48f 100644
--- a/src/qt/peertablesortproxy.cpp
+++ b/src/qt/peertablesortproxy.cpp
@@ -26,6 +26,8 @@ bool PeerTableSortProxy::lessThan(const QModelIndex& left_index, const QModelInd
         return left_stats.nodeid < right_stats.nodeid;
     case PeerTableModel::Address:
         return left_stats.addrName.compare(right_stats.addrName) < 0;
+    case PeerTableModel::Direction:
+        return left_stats.fInbound > right_stats.fInbound; // default sort Inbound, then Outbound
     case PeerTableModel::ConnectionType:
         return left_stats.m_conn_type < right_stats.m_conn_type;
     case PeerTableModel::Network:

Screenshots comparing patch sets:

This PR PR Alternative Diff
Screen Shot 2021-06-17 at 3 35 36 PM Screen Shot 2021-06-17 at 4 25 37 PM

@luke-jr luke-jr force-pushed the qt_peers_directionarrow branch 3 times, most recently from a10cae6 to 41c881c Compare June 22, 2021 20:03
@rebroad
Copy link
Contributor

rebroad commented Jun 26, 2021

NACK - takes up more space - left and right don't obviously correspond to in or out, unless it's in the same column as something and then perhaps it would.

@jonatack
Copy link
Member

The Direction column needs to be right before the Type column because Direction and Type are the two aspects of the current connection type naming, e.g. Outbound Full Relay, etc. It also should be "Inbound" or "Outbound" per the same naming. Another option is to drop the Type column completely, which I reckon is the wrong direction but the current state is confusing to users who have reported it as a bug.

@luke-jr
Copy link
Member Author

luke-jr commented Jun 26, 2021

@rebroad Left/right point away/toward the IP column. There's also the text part to avoid any uncertainty.

Copy link
Member

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

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

I'm NACK on this

Can you elaborate on why you would want this approach versus #317?

Copy link
Contributor

@shaavan shaavan left a comment

Choose a reason for hiding this comment

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

Concept 0
Tested 41c881c on Ubuntu 20.04

This PR is adding the left and right arrows as a representation of if the signal is incoming and outgoing. This PR also removes the up and down arrows from the address column. This is achieved by adding a new column with custom-drawn arrows for the left and right directions. And simplifying the address column to just displaying address instead of both address and direction.
The PR is successful in doing what it says.
Here is the screenshot of the PR’s peertable. I have compiled the PR and ran it on the signet chain.
Screenshot from 2021-08-02 23-22-02

I can see how op is approaching this problem. However, I prefer its alternative #317 over this PR. The reasons being:

  1. The left and right arrows, do not have the same strong sense of incoming and outgoing as the up and down arrows.
  2. There is no particular heading for the arrow column in this PR. Which could lead to confusion for a new user for the application of this column. Basically, it would decrease the user’s experience.
  3. The arrows don’t look aesthetically pleasing. I would aesthetics of up and down arrows as suggested here (under the PR alternative heading)

@shaavan
Copy link
Contributor

shaavan commented Aug 14, 2021

@luke-jr, @hebasto. Just a reminder. One of the alternatives of this PR, #317, has been merged. So, can this PR be closed?

@luke-jr luke-jr force-pushed the qt_peers_directionarrow branch from 41c881c to 217d105 Compare August 31, 2021 23:36
@luke-jr
Copy link
Member Author

luke-jr commented Aug 31, 2021

Rebased and description updated to current state of master

@hebasto
Copy link
Member

hebasto commented Sep 7, 2021

Would be helpful to attach screenshot before/after code change.

@luke-jr luke-jr force-pushed the qt_peers_directionarrow branch from 217d105 to 57ee44f Compare April 21, 2022 22:42
@DrahtBot
Copy link
Contributor

DrahtBot commented May 20, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #602 (Unify bitcoin-qt and bitcoind persistent settings by ryanofsky)
  • #601 (refactor: Pass interfaces::Node references to OptionsModel constructor by ryanofsky)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".

@hebasto
Copy link
Member

hebasto commented Oct 26, 2022

Closing this as it has not had any activity in a while. If you are interested in continuing work on this, please leave a comment so that it can be reopened.

@hebasto hebasto closed this Oct 26, 2022
@bitcoin-core bitcoin-core locked and limited conversation to collaborators Oct 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs rebase UX All about "how to get things done"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants