@@ -46,13 +46,17 @@ import { CommandIDs } from '../token';
4646class DriveStatusWidget extends Widget {
4747 constructor ( ) {
4848 super ( ) ;
49- this . addClass ( 'jp-drive-status-widget' ) ;
49+ this . node . classList . add (
50+ 'jp-drive-status-widget' ,
51+ 'jp-drive-status-loading' ,
52+ 'lm-mod-hidden'
53+ ) ;
5054 this . node . textContent = '' ;
5155 this . _isLoading = false ;
5256 }
5357
5458 updateStatus ( text : string ) {
55- this . node . textContent = `Drives: ${ text } ` ;
59+ this . node . textContent = `${ text } ` ;
5660 }
5761
5862 /**
@@ -64,21 +68,20 @@ class DriveStatusWidget extends Widget {
6468 if ( type === 'directory' ) {
6569 const displayPath =
6670 path === '' ? 'Root' : path . split ( '/' ) . pop ( ) || 'Directory' ;
67- this . updateStatus ( displayPath ) ;
71+ this . updateStatus ( `Opening: ${ displayPath } ` ) ;
6872 } else {
6973 const fileName = path . split ( '/' ) . pop ( ) || 'File' ;
70- this . updateStatus ( fileName ) ;
74+ this . updateStatus ( `Opening: ${ fileName } ` ) ;
7175 }
72-
73- this . addClass ( 'jp-drive-status-loading' ) ;
76+ this . removeClass ( 'lm-mod-hidden' ) ;
7477 }
7578
7679 /**
7780 * Clear loading state and show current status
7881 */
7982 setLoaded ( path ?: string ) {
8083 this . _isLoading = false ;
81- this . removeClass ( 'jp-drive-status-loading ') ;
84+ this . addClass ( 'lm-mod-hidden ') ;
8285
8386 this . updateStatus ( '' ) ;
8487 }
@@ -195,27 +198,21 @@ export const driveFileBrowser: JupyterFrontEndPlugin<void> = {
195198 isActive : ( ) => true
196199 } ) ;
197200
198- // Item being opened
201+ // Item/dir being opened
199202 //@ts -expect-error listing is protected
200203 driveBrowser . listing . onItemOpened . connect ( ( _ , args ) => {
201- console . log ( '[search] PLEASE]' , args ) ;
202204 const { path, type } = args ;
203205 driveStatusWidget . setLoading ( path , type ) ;
204- console . log ( 'loaded' ) ;
205206 } ) ;
206207
207- // Item done opening
208- docWidgetOpener . opened . connect ( ( _ , args ) => {
209- console . log ( '[search] opened signal' , args ) ;
210-
211- const { context } = args ;
212-
213- const { contentsModel } = context ;
214- console . log ( 'contentsModel' , contentsModel ) ;
208+ const doneLoading = ( _ : any , args : any ) => {
215209 driveStatusWidget . setLoaded ( ) ;
216- } ) ;
210+ } ;
211+ // Item done opening
212+ docWidgetOpener . opened . connect ( doneLoading ) ;
217213
218- driveStatusWidget . updateStatus ( 'Connected' ) ;
214+ // Directory done opening
215+ driveBrowser . model . pathChanged . connect ( doneLoading ) ;
219216 }
220217
221218 const uploader = new Uploader ( { model : driveBrowser . model , translator } ) ;
0 commit comments