@@ -180,9 +180,7 @@ export const Clone = observer((props: Props) => {
180
180
const headRendered = (
181
181
< >
182
182
{ /* //TODO(Anton): make global reset styles. */ }
183
- < style >
184
- { 'p { margin: 0;}' }
185
- </ style >
183
+ < style > { 'p { margin: 0;}' } </ style >
186
184
187
185
{ props . elements . breadcrumbs }
188
186
@@ -259,6 +257,9 @@ export const Clone = observer((props: Props) => {
259
257
const jdbcConnectionStr = getJdbcConnectionStr ( clone )
260
258
const psqlConnectionStr = getPsqlConnectionStr ( clone )
261
259
260
+ const hasConnectionInfo =
261
+ sshPortForwardingUrl || jdbcConnectionStr || psqlConnectionStr
262
+
262
263
// Controls.
263
264
const isDisabledControls =
264
265
isResettingClone ||
@@ -307,9 +308,7 @@ export const Clone = observer((props: Props) => {
307
308
className = { classes . actionButton }
308
309
>
309
310
Reload info
310
- { isReloading && (
311
- < Spinner size = "sm" className = { classes . spinner } />
312
- ) }
311
+ { isReloading && < Spinner size = "sm" className = { classes . spinner } /> }
313
312
</ Button >
314
313
</ div >
315
314
@@ -405,139 +404,155 @@ export const Clone = observer((props: Props) => {
405
404
< span className = { classes . paramTitle } >
406
405
Physical data diff size:
407
406
</ span >
408
- { formatBytesIEC ( clone . metadata . cloneDiffSize ) }
407
+ { clone . metadata . cloneDiffSize
408
+ ? formatBytesIEC ( clone . metadata . cloneDiffSize )
409
+ : '-' }
409
410
</ p >
410
411
411
412
< p className = { classes . text } >
412
413
< span className = { classes . paramTitle } > Clone creation time:</ span >
413
- { round ( clone . metadata . cloningTime , 2 ) } s
414
+ { clone . metadata . cloningTime
415
+ ? `${ round ( clone . metadata . cloningTime , 2 ) } s`
416
+ : '-' }
414
417
</ p >
415
418
</ div >
416
419
417
420
< br />
418
421
419
- < p >
420
- < strong > Connection info</ strong >
421
- </ p >
422
-
423
- { sshPortForwardingUrl && (
424
- < div className = { classes . fieldBlock } >
425
- In a separate console, set up SSH port forwarding (and keep it
426
- running):
427
- < div className = { classes . copyFieldContainer } >
428
- < TextField
429
- variant = "outlined"
430
- label = "SSH port forwarding"
431
- value = { sshPortForwardingUrl }
432
- className = { classes . textField }
433
- margin = "normal"
434
- fullWidth
435
- // @ts -ignore
436
- readOnly
437
- InputLabelProps = { {
438
- shrink : true ,
439
- style : styles . inputFieldLabel ,
440
- } }
441
- FormHelperTextProps = { {
442
- style : styles . inputFieldHelper ,
443
- } }
444
- />
445
- < IconButton
446
- className = { classes . copyButton }
447
- aria-label = "Copy"
448
- onClick = { ( ) => copyToClipboard ( sshPortForwardingUrl ) }
449
- >
450
- { icons . copyIcon }
451
- </ IconButton >
452
- </ div >
453
- </ div >
422
+ { hasConnectionInfo && (
423
+ < >
424
+ < p >
425
+ < strong > Connection info</ strong >
426
+ </ p >
427
+
428
+ { sshPortForwardingUrl && (
429
+ < div className = { classes . fieldBlock } >
430
+ In a separate console, set up SSH port forwarding (and keep it
431
+ running):
432
+ < div className = { classes . copyFieldContainer } >
433
+ < TextField
434
+ variant = "outlined"
435
+ label = "SSH port forwarding"
436
+ value = { sshPortForwardingUrl }
437
+ className = { classes . textField }
438
+ margin = "normal"
439
+ fullWidth
440
+ // @ts -ignore
441
+ readOnly
442
+ InputLabelProps = { {
443
+ shrink : true ,
444
+ style : styles . inputFieldLabel ,
445
+ } }
446
+ FormHelperTextProps = { {
447
+ style : styles . inputFieldHelper ,
448
+ } }
449
+ />
450
+ < IconButton
451
+ className = { classes . copyButton }
452
+ aria-label = "Copy"
453
+ onClick = { ( ) => copyToClipboard ( sshPortForwardingUrl ) }
454
+ >
455
+ { icons . copyIcon }
456
+ </ IconButton >
457
+ </ div >
458
+ </ div >
459
+ ) }
460
+
461
+ { psqlConnectionStr && (
462
+ < div className = { classes . fieldBlock } >
463
+ < div className = { classes . copyFieldContainer } >
464
+ < TextField
465
+ variant = "outlined"
466
+ id = "psqlConnStr"
467
+ label = "psql connection string"
468
+ value = { psqlConnectionStr }
469
+ className = { classes . textField }
470
+ margin = "normal"
471
+ fullWidth
472
+ // @ts -ignore
473
+ readOnly
474
+ InputLabelProps = { {
475
+ shrink : true ,
476
+ style : styles . inputFieldLabel ,
477
+ } }
478
+ FormHelperTextProps = { {
479
+ style : styles . inputFieldHelper ,
480
+ } }
481
+ />
482
+ < IconButton
483
+ className = { classes . copyButton }
484
+ aria-label = "Copy"
485
+ onClick = { ( ) => copyToClipboard ( psqlConnectionStr ) }
486
+ >
487
+ { icons . copyIcon }
488
+ </ IconButton >
489
+ </ div >
490
+
491
+ < Tooltip
492
+ content = {
493
+ < >
494
+ Used to connect to Postgres using psql. Change DBNAME
495
+ to name of the database you want to connect. Use
496
+ PGPASSWORD environment variable to set database
497
+ password or type it when prompted.
498
+ </ >
499
+ }
500
+ >
501
+ < span className = { classes . textFieldInfo } >
502
+ { icons . infoIcon }
503
+ </ span >
504
+ </ Tooltip >
505
+ </ div >
506
+ ) }
507
+
508
+ { jdbcConnectionStr && (
509
+ < div className = { classes . fieldBlock } >
510
+ < div className = { classes . copyFieldContainer } >
511
+ < TextField
512
+ variant = "outlined"
513
+ label = "JDBC connection string"
514
+ value = { jdbcConnectionStr }
515
+ className = { classes . textField }
516
+ margin = "normal"
517
+ fullWidth
518
+ // @ts -ignore
519
+ readOnly
520
+ InputLabelProps = { {
521
+ shrink : true ,
522
+ style : styles . inputFieldLabel ,
523
+ } }
524
+ FormHelperTextProps = { {
525
+ style : styles . inputFieldHelper ,
526
+ } }
527
+ />
528
+ < IconButton
529
+ className = { classes . copyButton }
530
+ aria-label = "Copy"
531
+ onClick = { ( ) => copyToClipboard ( jdbcConnectionStr ) }
532
+ >
533
+ { icons . copyIcon }
534
+ </ IconButton >
535
+ </ div >
536
+
537
+ < Tooltip
538
+ content = {
539
+ < >
540
+ Used to connect to Postgres using JDBC. Change DBNAME
541
+ to name of the database you want to connect,
542
+ change DBPASSWORD to the password you’ve used on
543
+ clone creation.
544
+ </ >
545
+ }
546
+ >
547
+ < span className = { classes . textFieldInfo } >
548
+ { icons . infoIcon }
549
+ </ span >
550
+ </ Tooltip >
551
+ </ div >
552
+ ) }
553
+ </ >
454
554
) }
455
555
456
- < div className = { classes . fieldBlock } >
457
- < div className = { classes . copyFieldContainer } >
458
- < TextField
459
- variant = "outlined"
460
- id = "psqlConnStr"
461
- label = "psql connection string"
462
- value = { psqlConnectionStr }
463
- className = { classes . textField }
464
- margin = "normal"
465
- fullWidth
466
- // @ts -ignore
467
- readOnly
468
- InputLabelProps = { {
469
- shrink : true ,
470
- style : styles . inputFieldLabel ,
471
- } }
472
- FormHelperTextProps = { {
473
- style : styles . inputFieldHelper ,
474
- } }
475
- />
476
- < IconButton
477
- className = { classes . copyButton }
478
- aria-label = "Copy"
479
- onClick = { ( ) => copyToClipboard ( psqlConnectionStr ) }
480
- >
481
- { icons . copyIcon }
482
- </ IconButton >
483
- </ div >
484
-
485
- < Tooltip
486
- content = {
487
- < >
488
- Used to connect to Postgres using psql. Change DBNAME to
489
- name of the database you want to connect. Use PGPASSWORD
490
- environment variable to set database password or type it
491
- when prompted.
492
- </ >
493
- }
494
- >
495
- < span className = { classes . textFieldInfo } > { icons . infoIcon } </ span >
496
- </ Tooltip >
497
- </ div >
498
-
499
- < div className = { classes . fieldBlock } >
500
- < div className = { classes . copyFieldContainer } >
501
- < TextField
502
- variant = "outlined"
503
- label = "JDBC connection string"
504
- value = { jdbcConnectionStr }
505
- className = { classes . textField }
506
- margin = "normal"
507
- fullWidth
508
- // @ts -ignore
509
- readOnly
510
- InputLabelProps = { {
511
- shrink : true ,
512
- style : styles . inputFieldLabel ,
513
- } }
514
- FormHelperTextProps = { {
515
- style : styles . inputFieldHelper ,
516
- } }
517
- />
518
- < IconButton
519
- className = { classes . copyButton }
520
- aria-label = "Copy"
521
- onClick = { ( ) => copyToClipboard ( jdbcConnectionStr ) }
522
- >
523
- { icons . copyIcon }
524
- </ IconButton >
525
- </ div >
526
-
527
- < Tooltip
528
- content = {
529
- < >
530
- Used to connect to Postgres using JDBC. Change DBNAME to
531
- name of the database you want to connect, change
532
- DBPASSWORD to the password you’ve used on clone
533
- creation.
534
- </ >
535
- }
536
- >
537
- < span className = { classes . textFieldInfo } > { icons . infoIcon } </ span >
538
- </ Tooltip >
539
- </ div >
540
-
541
556
< br />
542
557
543
558
< div className = { classes . fieldBlock } >
0 commit comments