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

feat: add webui #582

Merged
merged 15 commits into from
Jul 9, 2020
Merged

feat: add webui #582

merged 15 commits into from
Jul 9, 2020

Conversation

reliveyy
Copy link
Collaborator

@reliveyy reliveyy commented Jul 3, 2020

This PR adds xud-webui-poc (ReactJS based frontend) and xud-socketio (NodeJS based backend) into one container webui. And the container will expose port 8080 to your host. The frontend app uses REST + Websocket (socketio) API to get the order book of different trading pairs. The backend server translates the REST + Websocket API to gRPC calls and send it back to xud container.

How to test?

Run bash setup.sh -b webui --webui, then you should see a web UI in http://localhost:8080 like below. And it will auto-update when orders changed.
Screen Shot 2020-07-02 at 11 43 01 AM

Known issues:

  • Disable webui by default. Add an option like --webui to enable it.
  • Decimal point alignment

EDIT: closes ExchangeUnion/xud#1495, closes ExchangeUnion/xud#1661

@reliveyy reliveyy requested a review from raladev July 3, 2020 01:10
@reliveyy reliveyy self-assigned this Jul 3, 2020
@reliveyy reliveyy marked this pull request as draft July 3, 2020 01:11
@kilrau
Copy link
Contributor

kilrau commented Jul 3, 2020

Nice! 🎉

Some minor things looking at the screenshot:

  • pair switcher left aligned
  • Exchange Union -> OpenDEX centered

@reliveyy reliveyy marked this pull request as ready for review July 6, 2020 11:42
@kilrau kilrau self-requested a review July 6, 2020 14:03
@kilrau kilrau added the P2 mid priority label Jul 6, 2020
@raladev
Copy link
Contributor

raladev commented Jul 6, 2020

  1. place ETH/BTC and LTC/BTC orders
  2. change pair in web ui
  3. wait ws update
  4. orderbook contains orders of 2 pairs

@kilrau
Copy link
Contributor

kilrau commented Jul 6, 2020

  • rename "OpenDEX centered" -> "OpenDEX". I meant centred as in the middle of the blue bar, but actually left aligned is fine like this. Just removing the word "centered" is enough.

@reliveyy
Copy link
Collaborator Author

reliveyy commented Jul 8, 2020

it looks like listorders call behavior, but I thought it should be more like orderbook call

Fixed. Orders are merged by price.

orderbooks are mixed after pair changing

Fixed. This is a frontend issue.

I removed all orders manually, but last order for each pair still is in orderbook even after page restart

WIP.

rename React App tab to OpenDEX (maybe favicon should be changed too).

Fixed (include favicon).

also, can we remove google play request?)

WIP.

rename "OpenDEX centered" -> "OpenDEX".

Fixed.

@raladev @kilrau

@kilrau
Copy link
Contributor

kilrau commented Jul 8, 2020

Fixed. Orders are merged by price.

Tested, works. Marked as done.

orderbooks are mixed after pair changing

I tried a couple of things (placing order, switching pairs back and forth) and couldn't make orders being messed up. Marked as done.

I removed all orders manually, but last order for each pair still is in orderbook even after page restart

I tested this, couldn't reproduce. Removed orders (empty orderbook) and the UI orderbook was empty too. I marked it as done for now, please retest this with this version @raladev

also, can we remove google play request?)

WIP.

I couldn't see it calling play.google.com, but fonts.googleapis.com, we should remove this one too.
image

@kilrau
Copy link
Contributor

kilrau commented Jul 8, 2020

Last commit removes the googleapis.com call. All good from my side, final ACK by @raladev

@kilrau
Copy link
Contributor

kilrau commented Jul 8, 2020

Actually two more things:

  • we need these additional <network>.conf entries (also in sample conf as usual) and --webui.disabled & webui.port cli paramerters
[webui]
disabled = false / true (default)
port = 28888 (default simnet) / 18888 (default testnet) / 8888 (default mainnet)
  • the webui container didn't cleanly shutdown and was killed by docker in my case:
-------------------------------------
 diff null
[ltc_btc] current 
---------- OrderBook (2) ----------
ASKS:
BIDS:
- 0.02: 0.01
-------------------------------------
 new 
---------- OrderBook (null) ----------
ASKS:
BIDS:
- 0.02: 0.01
-------------------------------------
 diff null
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses
Failed to fetch orders: Error: 14 UNAVAILABLE: failed to connect to all addresses

@raladev
Copy link
Contributor

raladev commented Jul 8, 2020

  1. Same for me with container shutdown
  2. Retested all points, all of them work.

reliveyy added 9 commits July 8, 2020 21:51
This commit adds xud-webui-poc (ReactJS based frontend) and xud-socketio (NodeJS based backend) into one container `webui`. And the container will expose port 8080 to your host. The frontend app uses REST + Websocket (socketio) API to get the order book of different trading pairs. The backend server translates the REST + Websocket API to gRPC calls and send it back to xud container.
@raladev
Copy link
Contributor

raladev commented Jul 8, 2020

  • web port should be exposed as default (28888/18888/8888 depends on network type). For now I should specify it, if i dont specify it, container will not have exposed ports.
  • it seems order changing does not solve shutdown problem, webui still dont want shutdown gracefully,
  • got timeout error once during startup phase.
    Screen

@kilrau
Copy link
Contributor

kilrau commented Jul 8, 2020

Just tested this too, options work all as expected, but found the same two issues as @raladev :

  • web port should be exposed as default (28888/18888/8888 depends on network type). For now I should specify it, if i dont specify it, container will not have exposed ports.

  • it seems order changing does not solve shutdown problem, webui still dont want shutdown gracefully,

I think we can ignore this one for now and only tackle it if it happens frequently:

  • got timeout error once during startup phase.

@reliveyy
Copy link
Collaborator Author

reliveyy commented Jul 9, 2020

web port should be exposed as default (28888/18888/8888 depends on network type). For now I should specify it, if i dont specify it, container will not have exposed ports.

Done.

it seems order changing does not solve shutdown problem, webui still dont want shutdown gracefully,

Fixed (using supervisord).

got timeout error once during startup phase.

The supervisord will take care of the startup failure and restart it.

@raladev

@@ -131,3 +131,4 @@

[webui]
#disabled = false
#expose-ports = ["8888"]
Copy link
Contributor

Choose a reason for hiding this comment

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

change to #expose-ports = ["8888:8080"]

#disabled = false
#expose-ports = ["28888"]
Copy link
Contributor

Choose a reason for hiding this comment

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

change to #expose-ports = ["28888:8080"]

@@ -134,3 +134,4 @@

[webui]
#disabled = false
#expose-ports = ["18888"]
Copy link
Contributor

Choose a reason for hiding this comment

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

change to #expose-ports = ["18888:8080"]

@raladev raladev self-requested a review July 9, 2020 13:29
@raladev raladev merged commit 47cd7a8 into master Jul 9, 2020
@raladev raladev deleted the webui branch July 9, 2020 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 mid priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

grpc-web Generate simple html website from orderbook
3 participants