@@ -64,8 +64,8 @@ import {
6464 stripScheme
6565} from 'shared/services/boltscheme.utils'
6666import { isCloudHost } from 'shared/services/utils'
67-
68- type ConnectionFormState = any
67+ import { Neo4jError } from 'neo4j-driver'
68+ import { GlobalState } from 'shared/globalState'
6969
7070const isAuraHost = ( host : string ) => isCloudHost ( host , NEO4J_CLOUD_DOMAINS )
7171
@@ -76,7 +76,7 @@ function getAllowedAuthMethodsForHost(host: string): AuthenticationMethod[] {
7676const getAllowedSchemesForHost = ( host : string , allowedSchemes : string [ ] ) =>
7777 isAuraHost ( host ) ? CLOUD_SCHEMES : allowedSchemes
7878
79- export class ConnectionForm extends Component < any , ConnectionFormState > {
79+ export class ConnectionFormController extends Component < any , any > {
8080 constructor ( props : any ) {
8181 super ( props )
8282 const connection = this . getConnection ( )
@@ -106,7 +106,7 @@ export class ConnectionForm extends Component<any, ConnectionFormState> {
106106 }
107107 }
108108
109- componentDidMount ( ) {
109+ componentDidMount ( ) : void {
110110 const { authenticationMethod } = this . state
111111 if ( authenticationMethod === NO_AUTH ) {
112112 this . connect ( ( ) => this . setState ( { connecting : false } ) )
@@ -269,11 +269,17 @@ export class ConnectionForm extends Component<any, ConnectionFormState> {
269269 this . props . error ( { } )
270270 }
271271
272- onChangePasswordChange ( ) {
272+ onChangePasswordChange ( ) : void {
273273 this . props . error ( { } )
274274 }
275275
276- onChangePassword ( { newPassword, error } : any ) {
276+ onChangePassword ( {
277+ newPassword,
278+ error
279+ } : {
280+ newPassword : string
281+ error ?: Neo4jError
282+ } ) : void {
277283 this . setState ( { isLoading : true } )
278284 if ( error && error . code ) {
279285 this . setState ( { isLoading : false } )
@@ -332,7 +338,7 @@ export class ConnectionForm extends Component<any, ConnectionFormState> {
332338 )
333339 }
334340
335- saveAndStart ( ) {
341+ saveAndStart ( ) : void {
336342 this . setState ( { forcePasswordChange : false , used : true } )
337343 this . state . successCallback ( )
338344 this . props . bus && this . props . bus . send ( FOCUS )
@@ -344,7 +350,7 @@ export class ConnectionForm extends Component<any, ConnectionFormState> {
344350 }
345351 }
346352
347- saveCredentials ( ) {
353+ saveCredentials ( ) : void {
348354 this . props . updateConnection ( {
349355 id : CONNECTION_ID ,
350356 host : this . state . host ,
@@ -440,7 +446,7 @@ export class ConnectionForm extends Component<any, ConnectionFormState> {
440446 }
441447}
442448
443- const mapStateToProps = ( state : any ) => {
449+ const mapStateToProps = ( state : GlobalState ) => {
444450 return {
445451 discoveredData : getConnectionData ( state , CONNECTION_ID ) ,
446452 initCmd : getInitCmd ( state ) ,
@@ -458,7 +464,7 @@ const mapDispatchToProps = (dispatch: any) => {
458464 updateConnection : ( connection : any ) => {
459465 dispatch ( updateConnection ( connection ) )
460466 } ,
461- setActiveConnection : ( id : any ) => dispatch ( setActiveConnection ( id ) ) ,
467+ setActiveConnection : ( id : string ) => dispatch ( setActiveConnection ( id ) ) ,
462468 dispatchInitCmd : ( initCmd : any ) => dispatch ( executeSystemCommand ( initCmd ) )
463469 }
464470}
@@ -481,5 +487,9 @@ const mergeProps = (stateProps: any, dispatchProps: any, ownProps: any) => {
481487}
482488
483489export default withBus (
484- connect ( mapStateToProps , mapDispatchToProps , mergeProps ) ( ConnectionForm )
490+ connect (
491+ mapStateToProps ,
492+ mapDispatchToProps ,
493+ mergeProps
494+ ) ( ConnectionFormController )
485495)
0 commit comments