@@ -60,12 +60,12 @@ const IndexActions: React.FunctionComponent<IndexActionsProps> = ({
6060 onHideIndexClick,
6161 onUnhideIndexClick,
6262} ) => {
63- const progressPercentage = ( index . buildProgress ?? 0 ) * 100 ;
64-
6563 const indexActions : GroupedItemAction < IndexAction > [ ] = useMemo ( ( ) => {
6664 const actions : GroupedItemAction < IndexAction > [ ] = [ ] ;
65+ const buildProgress = index . buildProgress ?? 0 ;
66+ const isBuilding = buildProgress > 0 && buildProgress < 1 ;
6767
68- if ( progressPercentage < 100 && progressPercentage > 0 ) {
68+ if ( isBuilding ) {
6969 // partially built
7070 actions . push ( {
7171 action : 'delete' ,
@@ -101,7 +101,7 @@ const IndexActions: React.FunctionComponent<IndexActionsProps> = ({
101101 }
102102
103103 return actions ;
104- } , [ index . name , index . extra ?. hidden , serverVersion , progressPercentage ] ) ;
104+ } , [ index . name , index . extra ?. hidden , index . buildProgress , serverVersion ] ) ;
105105
106106 const onAction = useCallback (
107107 ( action : IndexAction ) => {
@@ -116,14 +116,15 @@ const IndexActions: React.FunctionComponent<IndexActionsProps> = ({
116116 [ onDeleteIndexClick , onHideIndexClick , onUnhideIndexClick , index ]
117117 ) ;
118118
119- if ( progressPercentage > 0 && progressPercentage < 100 ) {
119+ const buildProgress = index . buildProgress ?? 0 ;
120+ if ( buildProgress > 0 && buildProgress < 1 ) {
120121 return (
121122 < div
122123 className = { combinedContainerStyles }
123124 data-testid = "index-building-spinner"
124125 >
125126 < Body className = { progressTextStyles } >
126- Building... { progressPercentage | 0 } %
127+ Building... { ( buildProgress * 100 ) | 0 } %
127128 </ Body >
128129 < SpinLoader size = { 16 } title = "Index build in progress" />
129130 < ItemActionGroup < IndexAction >
0 commit comments