Skip to content

Commit

Permalink
Refactor per code review
Browse files Browse the repository at this point in the history
- Remove stui classes
- Inline status
  • Loading branch information
scottybollinger committed Dec 1, 2020
1 parent beb9589 commit db239d7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,22 @@ export interface IIndexingStatusProps extends IIndexingStatus {
setGlobalIndexingStatus?(activeReindexJob: IIndexingStatus): void;
}

export const IndexingStatus: React.FC<IIndexingStatusProps> = (props) => {
const statusPanel = (percentComplete: number) => (
<EuiPanel paddingSize="l" hasShadow>
<IndexingStatusContent percentageComplete={percentComplete} />
</EuiPanel>
);

return (
<IndexingStatusFetcher {...props}>
{(percentageComplete, numDocumentsWithErrors) => (
<div className="c-stui-indexing-status-wrapper">
{percentageComplete < 100 && statusPanel(percentageComplete)}
{percentageComplete === 100 && numDocumentsWithErrors > 0 && (
<>
<EuiSpacer />
<IndexingStatusErrors viewLinkPath={props.viewLinkPath} />
</>
)}
</div>
)}
</IndexingStatusFetcher>
);
};
export const IndexingStatus: React.FC<IIndexingStatusProps> = (props) => (
<IndexingStatusFetcher {...props}>
{(percentageComplete, numDocumentsWithErrors) => (
<div>
{percentageComplete < 100 && (
<EuiPanel paddingSize="l" hasShadow>
<IndexingStatusContent percentageComplete={percentageComplete} />
</EuiPanel>
)}
{percentageComplete === 100 && numDocumentsWithErrors > 0 && (
<>
<EuiSpacer />
<IndexingStatusErrors viewLinkPath={props.viewLinkPath} />
</>
)}
</div>
)}
</IndexingStatusFetcher>
);
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ interface IIndexingStatusErrorsProps {

export const IndexingStatusErrors: React.FC<IIndexingStatusErrorsProps> = ({ viewLinkPath }) => (
<EuiCallOut
className="c-stui-indexing-status-errors"
color="danger"
iconType="cross"
title="There was an error"
Expand Down

0 comments on commit db239d7

Please sign in to comment.