44 *-----------------------------------------------------------------------------------------------*/
55
66import React from 'react' ;
7- import { Checkbox , Divider , FormControlLabel , FormGroup , IconButton , InputAdornment , Modal , Pagination , Stack , TextField , Tooltip , Typography } from '@mui/material' ;
7+ import { Alert , Checkbox , Divider , FormControlLabel , FormGroup , IconButton , InputAdornment , Modal , Pagination , Stack , TextField , Tooltip , Typography } from '@mui/material' ;
88import { Close , Search } from '@mui/icons-material' ;
99import { HelmListItem } from './helmListItem' ;
1010import { ChartResponse , HelmRepo } from '../../../helm/helmChartType' ;
@@ -163,6 +163,7 @@ function SearchBar(props: {
163163
164164export function HelmSearch ( ) {
165165 const ITEMS_PER_PAGE = 18 ;
166+ const [ isSomeHelmChartsRetrieved , setSomeHelmChartsRetrieved ] = React . useState ( false ) ;
166167 const [ helmRepos , setHelmRepos ] = React . useState < HelmRepo [ ] > ( [ ] ) ;
167168 const [ helmCharts , sethelmCharts ] = React . useState < ChartResponse [ ] > ( [ ] ) ;
168169 const [ helmChartEnabled , setHelmChartEnabled ] = React . useState <
@@ -196,6 +197,7 @@ export function HelmSearch() {
196197 case 'getHelmCharts' : {
197198 sethelmCharts ( ( _helmCharts ) => message . data . helmCharts as ChartResponse [ ] ) ;
198199 VSCodeMessage . postMessage ( { action : 'getProviderTypes' } ) ;
200+ setSomeHelmChartsRetrieved ( _unused => true ) ;
199201 break ;
200202 }
201203 default :
@@ -277,7 +279,7 @@ export function HelmSearch() {
277279 < >
278280 < Stack direction = 'column' height = '100%' spacing = { 0.5 } >
279281 {
280- helmCharts . length === 0 ?
282+ ! isSomeHelmChartsRetrieved ?
281283 < LoadScreen title = 'Retrieving Helm Charts' /> :
282284 < Stack direction = "row" spacing = { 1 } width = { '100%' } >
283285 {
@@ -328,8 +330,11 @@ export function HelmSearch() {
328330 ( getFilteredCharts ( ) . length % ITEMS_PER_PAGE > 0.0001 ? 1 : 0 ) }
329331 perPageCount = { ITEMS_PER_PAGE }
330332 chartsLength = { getFilteredCharts ( ) . length } />
331- { /* 320px is the approximate combined height of the top bar and bottom bar in the devfile search view */ }
332- { /* 5em is the padding at the top of the page */ }
333+ { helmRepos . length === 0 ?
334+ < Stack direction = 'row' justifyContent = 'center' alignItems = 'center' paddingTop = '2rem' >
335+ < Alert severity = 'info' > No Helm repos are configured. Please configure a Helm repo to view its charts.</ Alert >
336+ </ Stack >
337+ :
333338 < Stack
334339 id = 'devfileList'
335340 direction = 'column'
@@ -353,7 +358,7 @@ export function HelmSearch() {
353358 } } />
354359 ) ;
355360 } ) }
356- </ Stack >
361+ </ Stack > }
357362 </ Stack >
358363 </ Stack >
359364 }
0 commit comments