Hi devs, I made a TUI app. It’s supposed to serve as a proof of concept; I would love your feedback. It’s similar to Concept: DFX Dashboard but it is not a web app and it relies heavily on dfx. If you’re like me and prefer not to leave your text editor, this might be a thing for you.
Disclaimer: this is not DFINITY’s official project
Features so far:
view the list of deployed canisters
view started replica logs
filter logs by canister id
view canister metadata for selected canister ID
display a list of all identities stored with dfx, with the ability to select one
display details about the currently selected identity (cycles, ICP, principal); when the app opens, the selected identity is whatever the output of dfx identity whoami is
select the network (currently only “local” and “ic”); for the selected network, display some information like the ones you can see on the YT clip. Only selecting a local network makes any sense, selecting the ic network won’t tell you anything about mainnet canisters
register dfx project (by pointing to a directory where dfx.json can be found dfx top register-dfx-project <PATH>, the project must be already deployed) - by registering a project, the canister ID will get associated with the project path and the name of the canister from that project
adjustable app refresh rate, press + or - to set the value anything between 1s-10s
q to quit
to have all data at your fingertips, without touching the mouse
to have a better overview of what’s happening, I’m guessing it could be very useful for beginners
What could be improved:
this is version alpha, the code quality is poor, performance is bad, things will break, and not in a way that makes sense.
performance: the UI freezes for 400ms every time there is a data refresh (1.5s by default). It’s usable but slightly annoying. The end goal would be to have performance similar to GitHub - aristocratos/btop: A monitor of resources (basically 100ms data refresh rate, with no perceivable UI freezes - liquid butter)
networks: add the ability to display details about canisters deployed on mainnet (or testnets, or other local networks)
fix stopping the replica: it takes like 30sec (if it works at all)
add functionality to use log files instead of spawning the replica inside the app
manage identities, swap ICP for cycles, display QR code to top-up the ledger
more layouts, e.g. sort canisters by cycles balance to figure out which one will run out of cycles first
you tell me!
If your brave soul wishes to test drive it, here is how: GitHub - smallstepman/dfx-top. Besides executing dfx stop, the app won’t execute any command that would change the state of your projects or your dfx setup. You need dfx ^0.15.0
It seems to mostly work well for me on WSL with DFX 0.15.3. It can load the canisters and cansiter info. This is very cool @mnl !!!
One part that’s not working for me is replica/canister logs. Nothing shows up there.
Some small feedback on the message “No logs available, press ‘s’ to start the replica”, since the replica is already running on my computer this is a bit misleading.
Do you have any plans to read a dfx.json file and file the canister list according to the current project? Then the canisters could also be labeled with human readable labels from dfx.json.
thanks! hmm, I just tried 0.15.2, and it doesn’t work for me either (EDIT: I take it back, this is what it took to fix it: dfx stop && pkill dfx icx-proxy replica && dfx start --clean), in my case, the issue is that the dfx ping local command is not working as expected, I take :
❯ dfx ping local
Error: Failed while waiting for agent status.
Caused by: Failed while waiting for agent status.
The replica returned an HTTP Error: Http Error: status 500 Internal Server Error, content type "", content: Internal Server Error
Can you see if you are running into the same issue? For a good measure, you can see if mainnet version of that command is working for you?:
dfx ping ic
To roll out all other possibilities, try to visit that URL (port will be different for you), see if anything shows up there:
❯ echo "http://localhost:$(dfx info replica-port)/_/dashboard"
dfx.json dist node_modules package-lock.json package.json README.md src webpack.config.js
❯ dfx top register-dfx-project $(pwd)
afterwards you’ll be able to see canister names, types, and other info from dfx.json in dfx top
One part that’s not working for me is replica/canister logs
hmmm, can you try this:
pkill dfx icx-proxy replica
dfx start --clean --background
# press letter [s]
This should fix things for you; but there is still a work to be done on my part to figure out how dfx might’ve ended up in this broken state. Be mindful about running --clean - it will erase deployed canisters (if you can’t afford that at the minute). Also, just to be clear, it’s not possible to tap into logs of dfx start session which was initiated in another terminal.
Also, just to be clear, it’s not possible to tap into logs of dfx start session which was initiated in another terminal.
Yes this was definitely the problem, I had started it in a separate terminal. It would be great to document this in your readme.
It almost works now after starting dfx through dfx top, I see replica logs now but unfortunately not the canister logs. That “window” is still empty.
My terminal froze over a few times while I was playing around with it this time and I had to kill it and start again. I don’t have any specific reproduction steps though because they were all apparently random, but usually they happened at the initial launch or when I try to quit, everything in between seemed to run smooth.