@@ -36,17 +36,24 @@ class FssFilesysItem {
3636
3737 const fsItem = document . createElement ( 'div' ) ;
3838 fsItem . classList . add ( 'jfss-fsitem-root' ) ;
39+ this . root = fsItem ;
3940
4041 if ( 'error' in fsInfo ) {
4142 fsItem . classList . add ( 'jfss-fsitem-error' ) ;
43+ fsItem . dataset . errorMessage = fsInfo . error . short_traceback ;
44+ fsItem . addEventListener (
45+ 'mouseenter' ,
46+ this . handleDisplayFSError . bind ( this )
47+ ) ;
48+ } else {
49+ fsItem . addEventListener ( 'mouseenter' , this . handleFsysHover . bind ( this ) ) ;
50+ fsItem . addEventListener ( 'mouseleave' , this . handleFsysHover . bind ( this ) ) ;
51+
52+ // Set the tooltip
53+ this . root . title = `Root Path: ${ fsInfo . path } ` ;
4254 }
43- fsItem . addEventListener ( 'mouseenter' , this . handleFsysHover . bind ( this ) ) ;
44- fsItem . addEventListener ( 'mouseleave' , this . handleFsysHover . bind ( this ) ) ;
45- fsItem . dataset . fssname = fsInfo . name ;
46- this . root = fsItem ;
4755
48- // Set the tooltip
49- this . root . title = `Root Path: ${ fsInfo . path } ` ;
56+ fsItem . dataset . fssname = fsInfo . name ;
5057
5158 this . nameField = document . createElement ( 'div' ) ;
5259 this . nameField . classList . add ( 'jfss-fsitem-name' ) ;
@@ -176,6 +183,48 @@ class FssFilesysItem {
176183 }
177184 }
178185
186+ handleDisplayFSError ( event : MouseEvent ) : void {
187+ const fsItem = event . currentTarget as HTMLElement ;
188+ const errorMessage = fsItem . dataset . errorMessage ;
189+
190+ const tooltip = document . createElement ( 'div' ) ;
191+ tooltip . className = 'jfss-fsitem-tooltip' ;
192+ tooltip . textContent = `[Inactive] ${ errorMessage } ` ;
193+
194+ Object . assign ( tooltip . style , {
195+ position : 'fixed' ,
196+ backgroundColor : 'rgba(242, 159, 159, 0.85)' ,
197+ color : 'rgb(77, 16, 16)' ,
198+ padding : '4px 8px' ,
199+ boxShadow : '0 2px 6px rgba(0,0,0,0.2)' ,
200+ zIndex : '9999' ,
201+ fontSize : '12px' ,
202+ visibility : 'hidden'
203+ } ) ;
204+
205+ document . body . appendChild ( tooltip ) ;
206+
207+ // Measure and position tooltip
208+ const offset = 10 ;
209+ const { clientX : x , clientY : y } = event ;
210+ const { width, height } = tooltip . getBoundingClientRect ( ) ;
211+ const maxX = window . innerWidth - width - offset ;
212+ const maxY = window . innerHeight - height - offset ;
213+
214+ const left = Math . min ( x + offset , maxX ) ;
215+ const top = Math . min ( y + offset , maxY ) ;
216+
217+ tooltip . style . left = `${ left } px` ;
218+ tooltip . style . top = `${ top } px` ;
219+ tooltip . style . visibility = 'visible' ;
220+
221+ const removeTooltip = ( ) => {
222+ tooltip . remove ( ) ;
223+ fsItem . removeEventListener ( 'mouseleave' , removeTooltip ) ;
224+ } ;
225+ fsItem . addEventListener ( 'mouseleave' , removeTooltip ) ;
226+ }
227+
179228 handleFsysHover ( event : any ) {
180229 if ( event . type === 'mouseenter' ) {
181230 this . hovered = true ;
@@ -190,10 +239,11 @@ class FssFilesysItem {
190239 protocol : this . filesysProtocol ,
191240 path : this . fsInfo . path
192241 } ) ;
193- if ( this . fsInfo . error ) {
242+ if ( 'error' in this . fsInfo ) {
194243 this . logger . error ( 'Inactive filesystem' , {
195244 ...this . fsInfo . error
196245 } ) ;
246+ return ;
197247 }
198248 this . selected = true ;
199249 this . filesysClicked . emit ( this . fsInfo ) ;
0 commit comments