|
7 | 7 | import React, { useState, useEffect, useCallback } from 'react'; |
8 | 8 | import { ScaleType } from '@elastic/charts'; |
9 | 9 |
|
10 | | -import { EuiFlexGroup, EuiFlexItem, EuiProgress, EuiSelect } from '@elastic/eui'; |
| 10 | +import { EuiFlexGroup, EuiFlexItem, EuiProgress, EuiSelect, EuiSpacer } from '@elastic/eui'; |
11 | 11 | import { noop } from 'lodash/fp'; |
12 | 12 | import * as i18n from './translations'; |
13 | 13 | import { BarChart } from '../charts/barchart'; |
@@ -141,48 +141,51 @@ export const MatrixHistogramComponent: React.FC<MatrixHistogramProps & |
141 | 141 | } |
142 | 142 |
|
143 | 143 | return ( |
144 | | - <InspectButtonContainer show={!isInitialLoading}> |
145 | | - <Panel data-test-subj={`${id}Panel`}> |
146 | | - {loading && !isInitialLoading && ( |
147 | | - <EuiProgress |
148 | | - data-test-subj="initialLoadingPanelMatrixOverTime" |
149 | | - size="xs" |
150 | | - position="absolute" |
151 | | - color="accent" |
152 | | - /> |
153 | | - )} |
| 144 | + <> |
| 145 | + <InspectButtonContainer show={!isInitialLoading}> |
| 146 | + <Panel data-test-subj={`${id}Panel`}> |
| 147 | + {loading && !isInitialLoading && ( |
| 148 | + <EuiProgress |
| 149 | + data-test-subj="initialLoadingPanelMatrixOverTime" |
| 150 | + size="xs" |
| 151 | + position="absolute" |
| 152 | + color="accent" |
| 153 | + /> |
| 154 | + )} |
154 | 155 |
|
155 | | - {isInitialLoading ? ( |
156 | | - <> |
157 | | - <HeaderSection id={id} title={titleWithStackByField} /> |
158 | | - <MatrixLoader /> |
159 | | - </> |
160 | | - ) : ( |
161 | | - <> |
162 | | - <HeaderSection |
163 | | - id={id} |
164 | | - title={titleWithStackByField} |
165 | | - subtitle={!loading && (totalCount >= 0 ? subtitleWithCounts : null)} |
166 | | - > |
167 | | - <EuiFlexGroup alignItems="center" gutterSize="none"> |
168 | | - <EuiFlexItem grow={false}> |
169 | | - {stackByOptions?.length > 1 && ( |
170 | | - <EuiSelect |
171 | | - onChange={setSelectedChartOptionCallback} |
172 | | - options={stackByOptions} |
173 | | - prepend={i18n.STACK_BY} |
174 | | - value={selectedStackByOption?.value} |
175 | | - /> |
176 | | - )} |
177 | | - </EuiFlexItem> |
178 | | - <EuiFlexItem grow={false}>{headerChildren}</EuiFlexItem> |
179 | | - </EuiFlexGroup> |
180 | | - </HeaderSection> |
181 | | - <BarChart barChart={barChartData} configs={barchartConfigs} /> |
182 | | - </> |
183 | | - )} |
184 | | - </Panel> |
185 | | - </InspectButtonContainer> |
| 156 | + {isInitialLoading ? ( |
| 157 | + <> |
| 158 | + <HeaderSection id={id} title={titleWithStackByField} /> |
| 159 | + <MatrixLoader /> |
| 160 | + </> |
| 161 | + ) : ( |
| 162 | + <> |
| 163 | + <HeaderSection |
| 164 | + id={id} |
| 165 | + title={titleWithStackByField} |
| 166 | + subtitle={!loading && (totalCount >= 0 ? subtitleWithCounts : null)} |
| 167 | + > |
| 168 | + <EuiFlexGroup alignItems="center" gutterSize="none"> |
| 169 | + <EuiFlexItem grow={false}> |
| 170 | + {stackByOptions?.length > 1 && ( |
| 171 | + <EuiSelect |
| 172 | + onChange={setSelectedChartOptionCallback} |
| 173 | + options={stackByOptions} |
| 174 | + prepend={i18n.STACK_BY} |
| 175 | + value={selectedStackByOption?.value} |
| 176 | + /> |
| 177 | + )} |
| 178 | + </EuiFlexItem> |
| 179 | + <EuiFlexItem grow={false}>{headerChildren}</EuiFlexItem> |
| 180 | + </EuiFlexGroup> |
| 181 | + </HeaderSection> |
| 182 | + <BarChart barChart={barChartData} configs={barchartConfigs} /> |
| 183 | + </> |
| 184 | + )} |
| 185 | + </Panel> |
| 186 | + </InspectButtonContainer> |
| 187 | + <EuiSpacer size="l" /> |
| 188 | + </> |
186 | 189 | ); |
187 | 190 | }; |
188 | 191 |
|
|
0 commit comments