@@ -37,6 +37,7 @@ export default function () {
37
37
const [ searchFilter , setSearchFilter ] = useState < string | undefined > ( ) ;
38
38
const [ statusFilter , setStatusFilter ] = useState < PrebuiltWorkspaceState | undefined > ( ) ;
39
39
40
+ const [ isLoadingPrebuilds , setIsLoadingPrebuilds ] = useState < boolean > ( true ) ;
40
41
const [ prebuilds , setPrebuilds ] = useState < PrebuildWithStatus [ ] > ( [ ] ) ;
41
42
42
43
useEffect ( ( ) => {
@@ -47,13 +48,16 @@ export default function () {
47
48
onPrebuildUpdate : ( update : PrebuildWithStatus ) => {
48
49
if ( update . info . projectId === project . id ) {
49
50
setPrebuilds ( prev => [ update , ...prev . filter ( p => p . info . id !== update . info . id ) ] ) ;
51
+ setIsLoadingPrebuilds ( false ) ;
50
52
}
51
53
}
52
54
} ) ;
53
55
54
56
( async ( ) => {
57
+ setIsLoadingPrebuilds ( true ) ;
55
58
const prebuilds = await getGitpodService ( ) . server . findPrebuilds ( { projectId : project . id } ) ;
56
59
setPrebuilds ( prebuilds ) ;
60
+ setIsLoadingPrebuilds ( false ) ;
57
61
} ) ( ) ;
58
62
59
63
return ( ) => {
@@ -78,7 +82,7 @@ export default function () {
78
82
setProject ( newProject ) ;
79
83
}
80
84
} ) ( ) ;
81
- } , [ teams ] ) ;
85
+ } , [ projectSlug , team , teams ] ) ;
82
86
83
87
const prebuildContextMenu = ( p : PrebuildWithStatus ) => {
84
88
const isFailed = p . status === "aborted" || p . status === "timeout" || ! ! p . error ;
@@ -166,7 +170,7 @@ export default function () {
166
170
< div className = "py-3 pl-3" >
167
171
< DropDown prefix = "Prebuild Status: " contextMenuWidth = "w-32" entries = { statusFilterEntries ( ) } />
168
172
</ div >
169
- { ( ! ! project && prebuilds . length === 0 ) &&
173
+ { ( ! isLoadingPrebuilds && prebuilds . length === 0 ) &&
170
174
< button onClick = { ( ) => triggerPrebuild ( null ) } className = "ml-2" > Run Prebuild</ button > }
171
175
</ div >
172
176
< ItemsList className = "mt-2" >
@@ -181,6 +185,10 @@ export default function () {
181
185
< span > Branch</ span >
182
186
</ ItemField >
183
187
</ Item >
188
+ { isLoadingPrebuilds && < div className = "flex items-center justify-center space-x-2 text-gray-400 text-sm pt-16" >
189
+ < img alt = "" className = "h-4 w-4 animate-spin" src = { Spinner } />
190
+ < span > Fetching prebuilds...</ span >
191
+ </ div > }
184
192
{ prebuilds . filter ( filter ) . sort ( prebuildSorter ) . map ( ( p , index ) => < Item key = { `prebuild-${ p . info . id } ` } className = "grid grid-cols-3" >
185
193
< ItemField className = "flex items-center my-auto" >
186
194
< Link to = { `/${ ! ! team ? 't/' + team . slug : 'projects' } /${ projectSlug } /${ p . info . id } ` } className = "cursor-pointer" >
0 commit comments