neo4j-contrib / rabbithole

Interactive, embeddable Neo4j-Console
http://rabbithole.heroku.com
79 stars 41 forks source link

Pressing enter should insert a newline by default, not submit #56

Open aseemk opened 11 years ago

aseemk commented 11 years ago

This is similar to neo4j/neo4j#10 -- but humorously, I'm asking the opposite here!

The primary use case for the webadmin (originally, and to me at least) was to quickly inspect a node or relationship by ID. So there, having enter insert a newline by default, and requiring ctrl+enter to submit, was an annoyance.

Here, the primary use case for the console textbox is to enter Cypher queries, and any non-trivial Cypher query is (or should be at least) multi-line -- with the starter example query being a perfect example. So here, having enter submit by default, and requiring shift+enter to insert a newline, is also an annoyance.

But worse, here, it's actually dangerous, as a CREATE or SET or DELETE could happen prematurely. It's not the end of the world with this console, since you can refresh to reset, but if you're actually using the console to try things out, you could be in a state far removed from the initial one.

Please strongly consider switching the defaults here. (And like neo4j/neo4j#10, be liberal in meta keys: shift+enter should work to submit, but so should ctrl+enter and cmd+enter on Mac.) Thanks!

freeeve commented 11 years ago

-1, I like the current way. Accidentally sending a query is never unrecoverable... perhaps we need a poll for this.

freeeve commented 11 years ago

I find it amusing that you're asking for the opposite here. Why so fickle? :P

aseemk commented 11 years ago

Haha, in case you're not being rhetorical, I explained the difference (to me, at least) in my original post: the webadmin (at least at the time of the change) was primarily for looking up nodes or rels by ID -- without Cypher, as a simple single-line input -- while this console should be optimized for ease of entering and editing multi-line Cypher queries. You don't agree there's a difference in use case?

freeeve commented 11 years ago

I think switching it now would be a worse user experience than not switching it. (I for one, am sure that I would mess it up far more often after the switch). I usually find myself hitting enter in the webadmin console and adding lines, since it feels backwards to everything else out there. But I use console 100x more. Maybe we should make a configuration variable for this, set in a perm cookie. Same with color preference, so David can have his white background and everyone else can have the dark.

aseemk commented 11 years ago

Any change is always going to have a cost, especially for power users. IMHO, I don't think we should be optimizing for that in console.neo4j.org -- especially because beginners and new users are a primary target audience for it.

A pref isn't bad, but just doing "the right thing" is so much better. The change notwithstanding, do you agree that the console should be optimized for multi-line input? If so, we should just do it. Just my two cents though. =)

freeeve commented 11 years ago

I think the FB-style is "the right thing", because it's more common in practice. I often type my query on one line and send it so it auto formats for me to multiple lines. Only very complex queries get manual carriage returns. It is a bit weird that the web admin is the opposite. Maybe that's reason enough to "converge" to a standard, although my opinion remains that it should be enter to send (on both).

aseemk commented 11 years ago

FWIW, the FB-style you're referring to is only the default for comments, but not for posts or messages. Try it out. =)

There's a lot to be said for optimizing for the common scenario in each case, but there's also a lot to be said for UI affordances: single-line textboxes give the affordance that pressing enter will submit, but multi-line textboxes give the affordance that pressing enter will insert a newline.

It's good that the webadmin textbox is multi-line, and similarly, the console.neo4j.org textbox clearly appears multi-line by default.

freeeve commented 11 years ago

True. Btw, you know you can run your own rabbithole without much effort, right? (even against your own database) The changes you want could be made in ~5 minutes, and you could be happy off in your own world. Maybe a few more people chiming in saying your way is "the right way" would convince me.

aseemk commented 11 years ago

I didn't know that -- I didn't even know console.neo4j.org was called "rabbithole" =) -- thanks. But I'm not set up for Java development, and of course I'd rather not maintain and administer my own instance if I can avoid it.

I know you know that, and I don't mean to be making an excuse. I just want to convey my feedback as a regular user, from a simple UX perspective, that's all.

freeeve commented 11 years ago

Bah, you're not a "regular user", as much as I'm not. For one of the meetup talks I spun up 3 different rabbithole instances on their own port (on my macbook), each backed by a real database folder. The d3 kind of chugs when you have too many nodes, but it's neat to be able to make changes to something permanent with it. I prefer it to the webadmin--but obviously for real datasets, we'd need something that can filter the data to a subgraph or something before displaying. All you need is maven installed and you can build/run it (instructions in the readme in this repo). I do all my java dev (whenever I am forced to) in vim nowadays--you don't need some sort of special setup.

aseemk commented 11 years ago

Haha, point taken. I might look into it one day then, thanks. =)

jexp commented 11 years ago
git clone https://github.com/neo4j-contrib/rabbithole
heroku create app myrabbit
heroku addons:add neo4j
git push heroku master

The neo4j db is only needed if you want to share from that instance :)

But anyway, I agree with both of you. Hitting enter to execute a query is a convenience I don't want to miss. Hitting enter to insert a newline is the same good thing. Could it be more intelligen? Like hitting enter at the end of a line inserts a newline otherwise executes?

And if you want to break an existing line into two parts you would have to use shift-enter?

Does any of you hit the shiny run button with a mouse?

I think adding the prefs cookie would still be a good thing.

Michael

ghost commented 8 years ago

Couldn't you highlight the damn alternative of the "enter" for newline >:( Should people go through all of your discussion to get what google brought them here to get ?

ddunn801 commented 8 years ago

aseemk is spot on. If enter is going to execute automatically, then you need to make it MUCH more clear how to get it not to do that when entering a multi-line query. Currently, there is no obvious way.

stanleybishop commented 8 years ago

+1

r-chandra-1 commented 8 years ago

Anyone coming from google who'd like to turn of Enter = submit - do a Shift+Enter, so the console text area enters a multi-line mode.