@@ -43,7 +43,6 @@ type Props = {
43
43
adminConsoleMetadata : Metadata | null ;
44
44
airgapUploader : AirgapUploader | null ;
45
45
airgapUploadError : string | null ;
46
-
47
46
checkingForUpdates : boolean ;
48
47
checkingForUpdateError : boolean ;
49
48
checkingUpdateText : string ;
@@ -181,6 +180,32 @@ const DashboardVersionCard = (props: Props) => {
181
180
} = useNextAppVersionWithIntercept ( ) ;
182
181
const { latestDeployableVersion } = newAppVersionWithInterceptData || { } ;
183
182
183
+ const fetchAvailableUpdates = async ( ) => {
184
+ const appSlug = params . slug ;
185
+ setState ( { isFetchingAvailableUpdates : true } ) ;
186
+ const res = await fetch (
187
+ `${ process . env . API_ENDPOINT } /app/${ appSlug } /updates` ,
188
+ {
189
+ headers : {
190
+ "Content-Type" : "application/json" ,
191
+ } ,
192
+ credentials : "include" ,
193
+ method : "GET" ,
194
+ }
195
+ ) ;
196
+ if ( ! res . ok ) {
197
+ setState ( { isFetchingAvailableUpdates : false } ) ;
198
+ return ;
199
+ }
200
+ const response = await res . json ( ) ;
201
+
202
+ setState ( {
203
+ isFetchingAvailableUpdates : false ,
204
+ availableUpdates : response . updates ,
205
+ } ) ;
206
+ return response ;
207
+ } ;
208
+
184
209
// moving this out of the state because new repeater instances were getting created
185
210
// and it doesn't really affect the UI
186
211
const versionDownloadStatusJobs : {
@@ -1413,33 +1438,6 @@ const DashboardVersionCard = (props: Props) => {
1413
1438
) ;
1414
1439
} ;
1415
1440
1416
- const fetchAvailableUpdates = async ( ) => {
1417
- const appSlug = params . slug ;
1418
- setState ( { isFetchingAvailableUpdates : true } ) ;
1419
- const res = await fetch (
1420
- `${ process . env . API_ENDPOINT } /app/${ appSlug } /updates` ,
1421
- {
1422
- headers : {
1423
- "Content-Type" : "application/json" ,
1424
- } ,
1425
- credentials : "include" ,
1426
- method : "GET" ,
1427
- }
1428
- ) ;
1429
- if ( ! res . ok ) {
1430
- setState ( { isFetchingAvailableUpdates : false } ) ;
1431
- return ;
1432
- }
1433
- const response = await res . json ( ) ;
1434
-
1435
- setState ( {
1436
- isFetchingAvailableUpdates : false ,
1437
- // only show the most recent available update
1438
- availableUpdates : response . updates ,
1439
- } ) ;
1440
- return response ;
1441
- } ;
1442
-
1443
1441
const {
1444
1442
currentVersion,
1445
1443
checkingForUpdates,
@@ -1594,24 +1592,14 @@ const DashboardVersionCard = (props: Props) => {
1594
1592
) }
1595
1593
{ props . adminConsoleMetadata ?. isEmbeddedCluster &&
1596
1594
state . availableUpdates ?. length > 0 && (
1597
- < >
1598
- { state . isFetchingAvailableUpdates ? (
1599
- < div className = "flex-column flex1 alignItems--center justifyContent--center" >
1600
- < Loader size = "30" />
1601
- </ div >
1602
- ) : (
1603
- < AvailableUpdateCard
1604
- updates = { state . availableUpdates }
1605
- showReleaseNotes = { showReleaseNotes }
1606
- upgradeService = { state . upgradeService }
1607
- appSlug = { params . slug }
1608
- />
1609
- ) }
1610
- </ >
1595
+ < AvailableUpdateCard
1596
+ updates = { state . availableUpdates }
1597
+ showReleaseNotes = { showReleaseNotes }
1598
+ upgradeService = { state . upgradeService }
1599
+ appSlug = { params . slug }
1600
+ />
1611
1601
) }
1612
-
1613
1602
{ renderBottomSection ( ) }
1614
-
1615
1603
< div className = "u-marginTop--10" >
1616
1604
< Link
1617
1605
to = { `/app/${ selectedApp ?. slug } /version-history` }
0 commit comments