Skip to content

Commit

Permalink
fix: fix a bug that loading spinner is on when there is no data
Browse files Browse the repository at this point in the history
Signed-off-by: vikhy-aws <191836418+vikhy-aws@users.noreply.github.com>
  • Loading branch information
vikhy-aws committed Jan 30, 2025
1 parent 22f4ecc commit ce1bbd9
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions public/pages/Correlations/containers/CorrelationsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ export class Correlations extends React.Component<CorrelationsProps, Correlation
};

private renderCorrelationsTable = (loadingData: boolean) => {
if (loadingData) {
if (this.state.correlationsTableData.length && loadingData) {
return (
<div style={{ margin: '0px 47%', height: 800, paddingTop: 384 }}>
<EuiLoadingChart size="xl" className="chart-view-container-loading" />
Expand All @@ -817,11 +817,29 @@ export class Correlations extends React.Component<CorrelationsProps, Correlation

const filteredTableData = this.getFilteredTableData(this.state.correlationsTableData);

return (
return filteredTableData.length > 0 ? (
<>
{this.renderCorrelatedFindingsChart()}
<CorrelationsTable tableData={filteredTableData} onViewDetails={this.openTableFlyout} />
</>
) : (
<EuiEmptyPrompt
title={
<EuiText size="s">
<h2>No correlations found</h2>
</EuiText>
}
body={
<EuiText size="s">
<p>There are no correlated findings in the system.</p>
</EuiText>
}
actions={[
<EuiSmallButton fill={true} color="primary" href={`#${ROUTES.CORRELATION_RULE_CREATE}`}>
Create correlation rule
</EuiSmallButton>,
]}
/>
);
};

Expand Down

0 comments on commit ce1bbd9

Please sign in to comment.