-
Notifications
You must be signed in to change notification settings - Fork 353
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
Update :server connect form to pick database #1194
Conversation
20ac6e0
to
a7c1c44
Compare
@@ -156,7 +167,11 @@ export const discoveryOnStartupEpic = (some$, store) => { | |||
getAllowedBoltSchemes(store.getState()), | |||
host | |||
) | |||
store.dispatch(updateDiscoveryConnection({ host })) // Update discovery host in redux | |||
const supportsMultiDb = | |||
parseInt((result.neo4j_version || '0').charAt(0)) >= 4 |
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.
I'm thinking there's a better way to get version number? Or is this fine?
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.
This is actually not the whole truth, I think. Some Aura editions has version 4 but do not support multi-db.
Better check with them what version they expose in the discovery endpoint.
Ugly things like
if (['4.0-aura', '4.0-AuraProfessional'].includes(serverInfo.version)) { |
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.
So do you suggest we check that the version starts with 4 and is not running on aura?
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.
Also, good catch!
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.
Some aura editions do support multi-db, so it's tricky. I suggest you talk to Aura and ask which editions that has multi-db support and what version string those editions expose in the discovery endpoint.
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.
Asked just now!
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.
It seems aura only supports the system + 1 other database at this moment. I think it'd make sense to disable the field for aura, WDYT?
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.
Cool, well done!
I have a few comments on naming and UI.
Connect frame UI
I don't think this looks particularly good to be honest. The form looks very unusual.
Auto-connect on refresh
It looks like the auto-connect doesn't work anymore. Successfully connect. Refresh page. You should auto-connect.
Continuously trying to :use
In the scenario of connecting successfully but using a db that doesn't exist for some reason, it looks like it's running :use
on every dbmeta-tick.
@@ -156,7 +167,11 @@ export const discoveryOnStartupEpic = (some$, store) => { | |||
getAllowedBoltSchemes(store.getState()), | |||
host | |||
) | |||
store.dispatch(updateDiscoveryConnection({ host })) // Update discovery host in redux | |||
const supportsMultiDb = | |||
parseInt((result.neo4j_version || '0').charAt(0)) >= 4 |
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.
This is actually not the whole truth, I think. Some Aura editions has version 4 but do not support multi-db.
Better check with them what version they expose in the discovery endpoint.
Ugly things like
if (['4.0-aura', '4.0-AuraProfessional'].includes(serverInfo.version)) { |
data-testid="database" | ||
onChange={props.onDatabaseChange} | ||
value={props.database} | ||
placeholder="default database" |
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.
Maybe change this to "Database to use" or something
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.
You mean the label? I think the current placeholder makes sense
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.
I don't :)
It's not a default db the users enters, it's the target db that the user wants to use when a connection is made.
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.
Yeah and that's why the place holder is there to show what happens if you leave the field empty! Right now it think it makes sense to have a field titled "Database to use" and the default/placeholder being "default database". Having both be "database to use" I think would lead to me thinking the field was required
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.
I see your reasoning, but placeholders are hints on what the users should enter, not to indicate value if left blank.
The label could suggest "leave empty for default)" or something to let the users know what happens if it's left empty.
Good catches, didn't see the screen shots you sent! Thanks a lot! :)) |
Updated the form styling when I was thinking we'd always show the db field. Then it got really tall, but now when I know that's not the case I reverted to the older styling because it was simpler code wise and familiar. |
Not 100% sure the aura check works. What would be the best way to try it out? Not sure where to find the discovery response object |
Form allows connecting to any database Don't show error until db-meta has loaded Add reasonable error handling Try using rxjs Only works once Connect to correct db Form and query param both work Autofills form Cleanup Fix styling
Add better tests
20ea421
to
7c516a2
Compare
99ad48f
to
b2d2861
Compare
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.
Good changes!
Still has a few more issues though:
-
When choosing something other than the default db, there's a delay until next dbMeta to update the meta items in the sidebar. See gif.
-
Same thing when entering a db that doesn't exist for the user. It takes until next dbmeta tick to update the UI with the correct info.
Also, would it be possible to add e2e test for checking so browser actually switches to use the entered db?
And maybe the error case as well?
|
||
const isAura = getEnv(store.getState()) === CLOUD | ||
const supportsMultiDb = | ||
!isAura && parseInt((result.neo4j_version || '0').charAt(0)) >= 4 |
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.
Aren't there Aura editions that support multi-db?
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.
From asking there's only editions with proper support for multi-db. At most they support the system-db in addition to the default one. So I think if it's important there, you'll have to use the url param
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.
Seems to behave as expected now, well done!
You just need to be extra cautious to make sure one failure in the forkJoin
doesn't cancel the other ones + cancels the whole listener.
But other than that, 👍
Ping me to review when you're catching any errors and I'll approve it
@@ -105,5 +111,68 @@ describe('Connect form', () => { | |||
cy.connect('neo4j', Cypress.config('password'), boltUrl) | |||
cy.executeCommand(':server disconnect') | |||
}) | |||
|
|||
if (isEnterpriseEdition()) { | |||
it.only('shows correct metadata when using db field', () => { |
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.
No .only
please
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.
I'll set up an on commit hook for this so I won't forget it again
return Rx.Observable.forkJoin([ | ||
getLabelsAndTypes(store), | ||
clusterRole(store), | ||
databaseList(store) |
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.
Even if one of these errors we'll need to keep the stream going, so I'f like to see some error catching here
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.
And if I remember correctly, if one fail the other ones are cancelled as well, so I think you need to catch on each one of the inner ones.
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.
🌮 Merge on green tests 🌮
Introduces a
db
url param for selecting a database anddbms
as an alternative param to connectURL.Prefills form from the url like so:
