File tree Expand file tree Collapse file tree 2 files changed +61
-34
lines changed
src/packages/frontend/project/explorer Expand file tree Collapse file tree 2 files changed +61
-34
lines changed Original file line number Diff line number Diff line change @@ -482,13 +482,7 @@ const Explorer0 = rclass(
482
482
className = "smc-vfill"
483
483
>
484
484
< FileListing
485
- isRunning = {
486
- this . props . project_map ?. getIn ( [
487
- this . props . project_id ,
488
- "state" ,
489
- "state" ,
490
- ] ) == "running"
491
- }
485
+ isRunning = { project_is_running }
492
486
name = { this . props . name }
493
487
active_file_sort = { this . props . active_file_sort }
494
488
listing = { listing }
@@ -732,12 +726,10 @@ const Explorer0 = rclass(
732
726
project_is_running = true ;
733
727
// next, we check if this is a common user (not public)
734
728
} else if ( my_group !== "public" ) {
735
- if ( this . props . project_map != undefined ) {
736
- project_state = this . props . project_map . getIn ( [
737
- this . props . project_id ,
738
- "state" ,
739
- ] ) as any ;
740
- }
729
+ project_state = this . props . project_map ?. getIn ( [
730
+ this . props . project_id ,
731
+ "state" ,
732
+ ] ) as any ;
741
733
project_is_running = project_state ?. get ( "state" ) == "running" ;
742
734
} else {
743
735
project_is_running = false ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import * as immutable from "immutable";
9
9
import React , { useEffect , useRef , useState } from "react" ;
10
10
import { useInterval } from "react-interval-hook" ;
11
11
import { Virtuoso , VirtuosoHandle } from "react-virtuoso" ;
12
-
12
+ import { Alert , Spin } from "antd" ;
13
13
import {
14
14
AppRedux ,
15
15
Rendered ,
@@ -65,26 +65,26 @@ export function watchFiles({ actions, current_path }): void {
65
65
}
66
66
}
67
67
68
- export const FileListing : React . FC < Props > = ( props : Props ) => {
69
- const {
70
- actions ,
71
- redux ,
72
- name ,
73
- active_file_sort ,
74
- listing ,
75
- file_map ,
76
- checked_files ,
77
- current_path ,
78
- create_folder ,
79
- create_file ,
80
- selected_file_index ,
81
- project_id ,
82
- shift_is_down ,
83
- sort_by ,
84
- configuration_main ,
85
- file_search = "" ,
86
- isRunning ,
87
- } = props ;
68
+ export const FileListing : React . FC < Props > = ( {
69
+ actions ,
70
+ redux ,
71
+ name ,
72
+ active_file_sort ,
73
+ listing ,
74
+ file_map ,
75
+ checked_files ,
76
+ current_path ,
77
+ create_folder ,
78
+ create_file ,
79
+ selected_file_index ,
80
+ project_id ,
81
+ shift_is_down ,
82
+ sort_by ,
83
+ configuration_main ,
84
+ file_search = "" ,
85
+ isRunning ,
86
+ } : Props ) => {
87
+ const [ starting , setStarting ] = useState < boolean > ( false ) ;
88
88
89
89
const prev_current_path = usePrevious ( current_path ) ;
90
90
@@ -229,6 +229,41 @@ export const FileListing: React.FC<Props> = (props: Props) => {
229
229
}
230
230
}
231
231
232
+ if ( ! isRunning && listing . length == 0 ) {
233
+ return (
234
+ < Alert
235
+ style = { {
236
+ textAlign : "center" ,
237
+ margin : "15px auto" ,
238
+ maxWidth : "400px" ,
239
+ } }
240
+ showIcon
241
+ type = "warning"
242
+ message = {
243
+ < div style = { { padding : "30px" , fontSize : "14pt" } } >
244
+ < a
245
+ onClick = { async ( ) => {
246
+ if ( starting ) return ;
247
+ try {
248
+ setStarting ( true ) ;
249
+ await actions . fetch_directory_listing_directly (
250
+ current_path ,
251
+ true ,
252
+ ) ;
253
+ } finally {
254
+ setStarting ( false ) ;
255
+ }
256
+ } }
257
+ >
258
+ Start this project to see your files.
259
+ { starting && < Spin /> }
260
+ </ a >
261
+ </ div >
262
+ }
263
+ />
264
+ ) ;
265
+ }
266
+
232
267
return (
233
268
< >
234
269
{ ! isRunning && listing . length > 0 && (
You can’t perform that action at this time.
0 commit comments