@@ -19,7 +19,8 @@ import {
1919 IToolbarWidgetRegistry ,
2020 setToolbar ,
2121 showDialog ,
22- Dialog
22+ Dialog ,
23+ Notification
2324} from '@jupyterlab/apputils' ;
2425import { ISettingRegistry } from '@jupyterlab/settingregistry' ;
2526import {
@@ -39,8 +40,9 @@ import { Widget } from '@lumino/widgets';
3940
4041import { driveBrowserIcon , removeIcon } from '../icons' ;
4142import { Drive } from '../contents' ;
42- import { getContents , setListingLimit } from '../requests' ;
43+ import { getContents , mountDrive , setListingLimit } from '../requests' ;
4344import { CommandIDs } from '../token' ;
45+ import { DrivesResponseError } from '../handler' ;
4446
4547/**
4648 * Status bar widget for displaying drive information
@@ -535,9 +537,23 @@ namespace Private {
535537 ariaLabel : 'Add Drive'
536538 } )
537539 ]
538- } ) . then ( result => {
540+ } ) . then ( async result => {
539541 if ( result . value ) {
540- drive . addPublicDrive ( result . value ) ;
542+ const response = await mountDrive ( result . value , {
543+ provider : 's3'
544+ } ) ;
545+ if ( response && response . error ) {
546+ // Show error in case of failure.
547+ Notification . emit (
548+ ( response . error as DrivesResponseError ) . message ,
549+ 'error' ,
550+ {
551+ autoClose : 5000
552+ }
553+ ) ;
554+ } else {
555+ drive . addPublicDrive ( result . value ) ;
556+ }
541557 }
542558 } ) ;
543559 } ,
@@ -567,9 +583,24 @@ namespace Private {
567583 ariaLabel : 'Add Drive'
568584 } )
569585 ]
570- } ) . then ( result => {
586+ } ) . then ( async result => {
571587 if ( result . value ) {
572- drive . addExternalDrive ( result . value [ 0 ] , result . value [ 1 ] ) ;
588+ const response = await mountDrive ( result . value [ 0 ] , {
589+ provider : 's3' ,
590+ location : result . value [ 1 ]
591+ } ) ;
592+ if ( response && response . error ) {
593+ // Show error in case of failure.
594+ Notification . emit (
595+ ( response . error as DrivesResponseError ) . message ,
596+ 'error' ,
597+ {
598+ autoClose : 5000
599+ }
600+ ) ;
601+ } else {
602+ drive . addExternalDrive ( result . value [ 0 ] , result . value [ 1 ] ) ;
603+ }
573604 }
574605 } ) ;
575606 } ,
0 commit comments