@@ -172,6 +172,7 @@ export function DataConnectorModalContinueButton({
172
172
continueId = "add-data-connector-continue"
173
173
step = { cloudStorageState . step }
174
174
testId = "test-data-connector"
175
+ editDataConnector = { addOrEditStorage }
175
176
/>
176
177
{ disableContinueButton && (
177
178
< UncontrolledTooltip
@@ -262,11 +263,13 @@ interface TestConnectionAndContinueButtonsProps
262
263
continueId : string ;
263
264
step : number ;
264
265
testId : string ;
266
+ editDataConnector ?: ( ) => void ;
265
267
}
266
268
function TestConnectionAndContinueButtons ( {
267
269
continueId,
268
270
step,
269
271
testId,
272
+ editDataConnector,
270
273
} : TestConnectionAndContinueButtonsProps ) {
271
274
const dispatch = useAppDispatch ( ) ;
272
275
const { flatDataConnector, isActionOngoing, validationResultIsCurrent } =
@@ -367,59 +370,96 @@ function TestConnectionAndContinueButtons({
367
370
368
371
const buttonContinueId = `${ continueId } -button` ;
369
372
const divContinueId = `${ continueId } -div` ;
370
- const continueContent = validationResult . isSuccess ? (
371
- < >
372
- Continue < ChevronRight className = "bi" />
373
- </ >
374
- ) : validationResult . isError ? (
375
- < >
376
- Skip Test < ChevronRight className = "bi" />
377
- </ >
373
+ const dataConnectorId = flatDataConnector . dataConnectorId ;
374
+ const continueContent =
375
+ dataConnectorId ? null : validationResult . isSuccess ? (
376
+ < >
377
+ Continue < ChevronRight className = "bi" />
378
+ </ >
379
+ ) : validationResult . isError ? (
380
+ < >
381
+ Skip Test < ChevronRight className = "bi" />
382
+ </ >
383
+ ) : null ;
384
+
385
+ const updateContent = dataConnectorId ? (
386
+ validationResult . isSuccess ? (
387
+ < >
388
+ < PencilSquare className = { cx ( "bi" , "me-1" ) } /> Update connector
389
+ </ >
390
+ ) : (
391
+ < >
392
+ < PencilSquare className = { cx ( "bi" , "me-1" ) } /> Skip Test and Save
393
+ </ >
394
+ )
378
395
) : null ;
379
396
const continueColorClass = validationResult . isSuccess
380
397
? "btn-primary"
381
398
: validationResult . isError
382
399
? "btn-outline-danger"
383
400
: "btn-primary" ;
384
- const continueSection =
385
- ! validationResult . isError && ! validationResult . isSuccess ? null : (
401
+ const continueSection = dataConnectorId ? null : ! validationResult . isError &&
402
+ ! validationResult . isSuccess ? null : (
403
+ < div id = { divContinueId } className = { cx ( "d-inline-block" , "ms-2" ) } >
404
+ < Button
405
+ color = ""
406
+ id = { buttonContinueId }
407
+ data-cy = { buttonContinueId }
408
+ className = { cx ( continueColorClass ) }
409
+ disabled = { validationResult . isLoading }
410
+ onClick = { ( ) => {
411
+ dispatch (
412
+ dataConnectorFormSlice . actions . setValidationResult ( {
413
+ validationResult : {
414
+ isSuccess : validationResult . isSuccess ,
415
+ isError : validationResult . isError ,
416
+ error : validationResult . error ,
417
+ } ,
418
+ } )
419
+ ) ;
420
+ if ( validationResult . isError || validationResult . isSuccess ) {
421
+ validationResult . reset ( ) ;
422
+ }
423
+ dispatch (
424
+ dataConnectorFormSlice . actions . setCloudStorageState ( {
425
+ cloudStorageState : {
426
+ step : step === 0 ? CLOUD_STORAGE_TOTAL_STEPS : step + 1 ,
427
+ completedSteps :
428
+ step === 0 ? CLOUD_STORAGE_TOTAL_STEPS - 1 : step ,
429
+ } ,
430
+ } )
431
+ ) ;
432
+ } }
433
+ >
434
+ { continueContent }
435
+ </ Button >
436
+ { validationResult . isError && (
437
+ < UncontrolledTooltip placement = "top" target = { divContinueId } >
438
+ The connection is not working as configured. You can make changes and
439
+ try again, or skip and continue.
440
+ </ UncontrolledTooltip >
441
+ ) }
442
+ </ div >
443
+ ) ;
444
+
445
+ const saveSection =
446
+ ! dataConnectorId || ! editDataConnector ? null : ! validationResult . isError &&
447
+ ! validationResult . isSuccess ? null : (
386
448
< div id = { divContinueId } className = { cx ( "d-inline-block" , "ms-2" ) } >
387
449
< Button
388
450
color = ""
389
451
id = { buttonContinueId }
390
452
data-cy = { buttonContinueId }
391
453
className = { cx ( continueColorClass ) }
392
454
disabled = { validationResult . isLoading }
393
- onClick = { ( ) => {
394
- dispatch (
395
- dataConnectorFormSlice . actions . setValidationResult ( {
396
- validationResult : {
397
- isSuccess : validationResult . isSuccess ,
398
- isError : validationResult . isError ,
399
- error : validationResult . error ,
400
- } ,
401
- } )
402
- ) ;
403
- if ( validationResult . isError || validationResult . isSuccess ) {
404
- validationResult . reset ( ) ;
405
- }
406
- dispatch (
407
- dataConnectorFormSlice . actions . setCloudStorageState ( {
408
- cloudStorageState : {
409
- step : step === 0 ? CLOUD_STORAGE_TOTAL_STEPS : step + 1 ,
410
- completedSteps :
411
- step === 0 ? CLOUD_STORAGE_TOTAL_STEPS - 1 : step ,
412
- } ,
413
- } )
414
- ) ;
415
- } }
455
+ onClick = { ( ) => editDataConnector ( ) }
416
456
>
417
- { continueContent }
457
+ { updateContent }
418
458
</ Button >
419
459
{ validationResult . isError && (
420
460
< UncontrolledTooltip placement = "top" target = { divContinueId } >
421
461
The connection is not working as configured. You can make changes
422
- and try again, or skip and continue .
462
+ and try again, or skip and save .
423
463
</ UncontrolledTooltip >
424
464
) }
425
465
</ div >
@@ -429,6 +469,7 @@ function TestConnectionAndContinueButtons({
429
469
< div className = "d-inline-block" >
430
470
{ testConnectionSection }
431
471
{ continueSection }
472
+ { saveSection }
432
473
</ div >
433
474
) ;
434
475
}
0 commit comments