11import { useState } from 'react' ;
22
33type Backend =
4- | { kind : 'neptune-db' ; cluster : string ; region : string }
4+ | { kind : 'neptune-db' ; clusterUrl : string }
55 | { kind : 'neptune-graph' ; graphId : string }
66 | { kind : 'neo4j' ; host : string ; port : string }
77 | { kind : 'falkordb' ; host : string ; port : string } ;
@@ -16,7 +16,7 @@ const backends = [
1616function buildUrl ( b : Backend ) : string {
1717 switch ( b . kind ) {
1818 case 'neptune-db' :
19- return `neptune-db://${ b . cluster } .cluster-xxxxxxxx. ${ b . region } .neptune.amazonaws.com ` ;
19+ return `neptune-db://${ b . clusterUrl } ` ;
2020 case 'neptune-graph' :
2121 return `neptune-graph://${ b . graphId } ` ;
2222 case 'neo4j' :
@@ -48,14 +48,13 @@ const labelStyle: React.CSSProperties = {
4848
4949export default function StoreUrlBuilder ( ) {
5050 const [ kind , setKind ] = useState < Backend [ 'kind' ] > ( 'neptune-db' ) ;
51- const [ cluster , setCluster ] = useState ( 'my-graph' ) ;
52- const [ region , setRegion ] = useState ( 'us-east-1' ) ;
51+ const [ clusterUrl , setClusterUrl ] = useState ( 'my-graph.cluster-xxxxxxxx.us-east-1.neptune.amazonaws.com' ) ;
5352 const [ graphId , setGraphId ] = useState ( 'g-abc123def456' ) ;
5453 const [ host , setHost ] = useState ( 'localhost' ) ;
5554 const [ port , setPort ] = useState ( '7687' ) ;
5655
5756 let backend : Backend ;
58- if ( kind === 'neptune-db' ) backend = { kind, cluster , region } ;
57+ if ( kind === 'neptune-db' ) backend = { kind, clusterUrl } ;
5958 else if ( kind === 'neptune-graph' ) backend = { kind, graphId } ;
6059 else if ( kind === 'neo4j' ) backend = { kind, host, port } ;
6160 else backend = { kind, host, port } ;
@@ -106,16 +105,10 @@ export default function StoreUrlBuilder() {
106105 } }
107106 >
108107 { kind === 'neptune-db' && (
109- < >
110- < div >
111- < label style = { labelStyle } > Cluster name</ label >
112- < input style = { inputStyle } value = { cluster } onChange = { ( e ) => setCluster ( e . target . value ) } />
113- </ div >
114- < div >
115- < label style = { labelStyle } > Region</ label >
116- < input style = { inputStyle } value = { region } onChange = { ( e ) => setRegion ( e . target . value ) } />
117- </ div >
118- </ >
108+ < div >
109+ < label style = { labelStyle } > Cluster URL</ label >
110+ < input style = { inputStyle } value = { clusterUrl } onChange = { ( e ) => setClusterUrl ( e . target . value ) } />
111+ </ div >
119112 ) }
120113 { kind === 'neptune-graph' && (
121114 < div >
0 commit comments