@@ -33,15 +33,15 @@ const ConfigurationScreen: FC<{ theme: string }> = ({ theme }) => {
3333
3434 toastManager . setTheme ( theme ) ;
3535
36- function reset ( ) {
36+ function reset ( ) : void {
3737 setApiKey ( '' ) ;
3838 setTenantId ( - 1 ) ;
3939 setUserTenants ( [ ] ) ;
4040 setIsLoading ( false ) ;
4141 setIsCompleted ( false ) ;
4242 }
4343
44- function getCurrentConfigurationStep ( ) {
44+ function getCurrentConfigurationStep ( ) : ConfigurationSteps {
4545 if ( tenants . length === 0 ) {
4646 return ConfigurationSteps . Initial ;
4747 }
@@ -52,13 +52,13 @@ const ConfigurationScreen: FC<{ theme: string }> = ({ theme }) => {
5252 return ConfigurationSteps . Completed ;
5353 }
5454
55- const handleApiKeyChange = ( e ) => setApiKey ( e . target . value ) ;
56- const handleTenantIdChange = ( e ) => setTenantId ( parseInt ( e . target . value , 10 ) ) ;
57- const handleIsIngestingMetadataChange = ( e ) => {
55+ const handleApiKeyChange = ( e ) : void => setApiKey ( e . target . value ) ;
56+ const handleTenantIdChange = ( e ) : void => setTenantId ( parseInt ( e . target . value , 10 ) ) ;
57+ const handleIsIngestingMetadataChange = ( e ) : void => {
5858 setIsIngestingMetadataOnly ( e . target . checked ) ;
5959 } ;
6060
61- const handleBackButton = ( ) => {
61+ const handleBackButton = ( ) : void => {
6262 const currentConfigurationStep = getCurrentConfigurationStep ( ) ;
6363 if ( currentConfigurationStep === ConfigurationSteps . Initial ) {
6464 redirectToHomepage ( ) ;
@@ -69,19 +69,19 @@ const ConfigurationScreen: FC<{ theme: string }> = ({ theme }) => {
6969 }
7070 } ;
7171
72- const handleSubmitApiKey = ( ) => {
72+ const handleSubmitApiKey = ( ) : void => {
7373 setIsLoading ( true ) ;
7474 retrieveUserTenants (
7575 apiKey ,
76- ( userTenants ) => {
76+ ( userTenants : Tenant [ ] ) => {
7777 if ( tenantId === - 1 && userTenants . length > 0 ) {
7878 setTenantId ( userTenants [ 0 ] . id ) ;
7979 }
8080 setErrorMessage ( '' ) ;
8181 setUserTenants ( userTenants ) ;
8282 setIsLoading ( false ) ;
8383 } ,
84- ( error ) => {
84+ ( error : string ) => {
8585 setErrorMessage ( error ) ;
8686 setIsLoading ( false ) ;
8787 toastManager . show ( {
@@ -93,7 +93,7 @@ const ConfigurationScreen: FC<{ theme: string }> = ({ theme }) => {
9393 ) ;
9494 } ;
9595
96- const handleSubmitTenant = ( ) => {
96+ const handleSubmitTenant = ( ) : void => {
9797 setIsLoading ( true ) ;
9898 saveConfiguration ( apiKey , tenantId , isIngestingMetadataOnly )
9999 . then ( ( ) => {
@@ -105,7 +105,7 @@ const ConfigurationScreen: FC<{ theme: string }> = ({ theme }) => {
105105 content : 'Configured Flare Account' ,
106106 } ) ;
107107 } )
108- . catch ( ( e ) => {
108+ . catch ( ( e : any ) => {
109109 setIsLoading ( false ) ;
110110 toastManager . show ( {
111111 id : TOAST_API_KEY_ERROR ,
@@ -115,8 +115,8 @@ const ConfigurationScreen: FC<{ theme: string }> = ({ theme }) => {
115115 } ) ;
116116 } ;
117117
118- function getSelectedTenantName ( ) {
119- const filteredTenants = tenants . filter ( ( p ) => p . id === tenantId ) ;
118+ function getSelectedTenantName ( ) : string {
119+ const filteredTenants = tenants . filter ( ( tenant : Tenant ) => tenant . id === tenantId ) ;
120120 if ( filteredTenants . length > 0 ) {
121121 return filteredTenants [ 0 ] . name ;
122122 }
@@ -128,10 +128,12 @@ const ConfigurationScreen: FC<{ theme: string }> = ({ theme }) => {
128128 if ( isCompleted ) {
129129 return ;
130130 }
131- retrieveApiKey ( ) . then ( ( key ) => setApiKey ( key ) ) ;
132- retrieveTenantId ( ) . then ( ( id ) => setTenantId ( id ) ) ;
133- retrieveIngestMetadataOnly ( ) . then ( ( ingestMetadataOnly ) =>
134- setIsIngestingMetadataOnly ( ingestMetadataOnly )
131+ Promise . all ( [ retrieveApiKey ( ) , retrieveTenantId ( ) , retrieveIngestMetadataOnly ( ) ] ) . then (
132+ ( [ key , id , ingestMetadataOnly ] ) => {
133+ setApiKey ( key ) ;
134+ setTenantId ( id ) ;
135+ setIsIngestingMetadataOnly ( ingestMetadataOnly ) ;
136+ }
135137 ) ;
136138 } , [ isCompleted ] ) ;
137139
@@ -168,25 +170,25 @@ const ConfigurationScreen: FC<{ theme: string }> = ({ theme }) => {
168170 apiKey = { apiKey }
169171 errorMessage = { errorMessage }
170172 isLoading = { isLoading }
171- onBackClicked = { handleBackButton }
172- onNextClicked = { handleSubmitApiKey }
173- onApiKeyChanged = { handleApiKeyChange }
173+ onCancelConfigurationClick = { handleBackButton }
174+ onSubmitApiKeyClick = { handleSubmitApiKey }
175+ onApiKeyChange = { handleApiKeyChange }
174176 />
175177 < ConfigurationUserPreferencesStep
176178 show = { currentConfigurationStep === ConfigurationSteps . UserPreferences }
177179 selectedTenantId = { tenantId }
178180 tenants = { tenants }
179181 isLoading = { isLoading }
180182 isIngestingMetadataOnly = { isIngestingMetadataOnly }
181- onBackClicked = { handleBackButton }
182- onNextClicked = { handleSubmitTenant }
183- onTenantIdChanged = { handleTenantIdChange }
184- onIngestingMetadataChanged = { handleIsIngestingMetadataChange }
183+ onNavigateBackClick = { handleBackButton }
184+ onSubmitUserPreferencesClick = { handleSubmitTenant }
185+ onTenantIdChange = { handleTenantIdChange }
186+ onIngestingMetadataChange = { handleIsIngestingMetadataChange }
185187 />
186188 < ConfigurationCompletedStep
187189 show = { currentConfigurationStep === ConfigurationSteps . Completed }
188190 tenantName = { getSelectedTenantName ( ) }
189- onBackClicked = { handleBackButton }
191+ onEditConfigurationClick = { handleBackButton }
190192 />
191193 </ div >
192194 < div id = "learn-more" className = "link" >
0 commit comments