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
Add UI #1170
base: master
Are you sure you want to change the base?
Add UI #1170
Conversation
Thank you for this -- I will take a look shortly. |
I'm guessing the Docker file and yarn.lock file are not needed by the UI code. Want to delete? Any other files we can pull from the diff? What is the principle here? How are the non-Go files package up into the |
yarn.lock is required to configure the development environment. |
When the user accesses http://localhost:4001/ui, the files in the The ui/out directory isn't normally managed through a git repository because it can be created from source files at any time. To include the ui/out directory in the rqlite binary, I used Go's embed directive. To summarize, only the contents of the ui/out are packaged at build time. And they're included as simple text files, which the http/ui.go file just reads and serves. |
// Pattern should start with "all:" prefix in order to | ||
// include files and directories beginning with "." or "_". | ||
//go:embed all:ui/out/* | ||
var staticAssets embed.FS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ui/out directory is embedded as virtual file system at build time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's cool, definitely looking forward to learning more about that.
1MB increase is in size is fine. |
Just tried it -- very cool. I'm quite excited at integrating this into rqlite. Obviously there is lots we could do to improve this, but it's very convenient to have this built in. |
Yeah, it works quite well -- thanks again. I do have one question however. I'm not a front-end programmer. If someone asks me about security concerns with (what I call) a single-page app, how can I assure them the app is secure? That it doesn't make network connections it shouldn't, that it doesn't operate inside in the browser in a way it shouldn't etc etc. I do not mean to imply I think this happening -- not at all. But I need to be able to provide good answers to questions such as that if I want people to use rqlite. This is one argument in favour of keeping this application separate from the rqlite code base (though I would be happy to promote it, and add an article to rqlite.io about it). |
As you can see, the UI is just using the HTTP API provided by rqlite. So the UI can only be used in environments that have access to the API. I think there are three things that could be improved.
|
Hi, I'm just a regular user of rqlite, not team member or anything, but I had a few small comments: Is the file at In order to embed in rqlite, it looks like you are building the static SPA bundle via |
@patdx
I'll also exclude that file.
I'll add that as I refine README. |
- Replace localStorage to sessionStorage - Apply Content-Security-Policy
I added some security-related code.
|
Any recent movement on this PR? |
No movement on my side, I'm still not sure building a UI directly into rqlite is the right thing to do. I need to think about it. |
Ageeed. |
Perhaps @soonoo could release it as a separate project? rqlite-ui? I'm thinking about, for example, docker registry server and the various registry UIs that exist (for example). Clean separation of concerns between server and UI, clearly defined protocol in the middle. This feature looks like a fairly nontrivial maintenance obligation. |
@jtackaberry Hi, please check out https://github.com/soonoo/rqman if you're interested in. |
Related issue: #153
Hi,
I added an UI to run simple queries or check cluster status when accessed by http address.
You can check it by starting the cluster and accessing
http://localhost:4001/ui
.(You don't need to run the
yarn
command or something, just compile and run rqlite.)There are a lot of files that have changed, but only one Go file has changed, and all the other changes are UI related.
http/service.go
: An endpoint to serve the resource files is added.I'd love for you to give it a try and let me know if you see anything out of the ordinary.