Skip to content

Commit

Permalink
fixed types and reduced redundancy
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Sebastian <[email protected]>
  • Loading branch information
paulstn committed Oct 23, 2023
1 parent ffbd310 commit 0715996
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 43 deletions.
10 changes: 5 additions & 5 deletions common/types/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,9 @@ export interface GridSortingColumn {
}

export enum DirectQueryLoadingStatus {
SUCCESS,
FAILED,
RUNNING,
SCHEDULED,
CANCELED,
SUCCESS = 'SUCCESS',
FAILED = 'FAILED',
RUNNING = 'RUNNING',
SCHEDULED = 'SCHEDULED',
CANCELED = 'CANCELED',
}
58 changes: 20 additions & 38 deletions public/components/event_analytics/explorer/explorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -552,43 +552,7 @@ export const Explorer = ({
<EuiSpacer size="m" />
</>
)}
{isDefaultDataSourceType || appLogEvents ? (
<>
{countDistribution.data && countDistribution.data['count()'] ? (
<DataGrid
http={http}
pplService={pplService}
rows={explorerData.jsonData}
rowsAll={explorerData.jsonDataAll}
explorerFields={explorerFields}
timeStampField={queryRef.current![SELECTED_TIMESTAMP]}
rawQuery={appBasedRef.current || queryRef.current![RAW_QUERY]}
totalHits={_.sum(countDistribution.data?.['count()'])}
requestParams={requestParams}
startTime={appLogEvents ? startTime : dateRange[0]}
endTime={appLogEvents ? endTime : dateRange[1]}
/>
) : (
<EuiPanel paddingSize="s">
<div style={{ padding: '20px' }}>
<EuiFlexGroup
direction="column"
alignItems="center"
gutterSize="none"
>
<EuiFlexItem>
<EuiLoadingSpinner size="xl" />
</EuiFlexItem>
<EuiSpacer size="s" />
<EuiFlexItem>
<strong>Loading Documents</strong>
</EuiFlexItem>
</EuiFlexGroup>
</div>
</EuiPanel>
)}
</>
) : (
{countDistribution.data && countDistribution.data['count()'] ? (
<DataGrid
http={http}
pplService={pplService}
Expand All @@ -597,11 +561,29 @@ export const Explorer = ({
explorerFields={explorerFields}
timeStampField={queryRef.current![SELECTED_TIMESTAMP]}
rawQuery={appBasedRef.current || queryRef.current![RAW_QUERY]}
totalHits={explorerData?.datarows?.length || 0}
totalHits={
isDefaultDataSourceType || appLogEvents
? _.sum(countDistribution.data?.['count()'])
: explorerData?.datarows?.length || 0
}
requestParams={requestParams}
startTime={appLogEvents ? startTime : dateRange[0]}
endTime={appLogEvents ? endTime : dateRange[1]}
/>
) : (
<EuiPanel paddingSize="s">
<div style={{ padding: '20px' }}>
<EuiFlexGroup direction="column" alignItems="center" gutterSize="none">
<EuiFlexItem>
<EuiLoadingSpinner size="xl" />
</EuiFlexItem>
<EuiSpacer size="s" />
<EuiFlexItem>
<strong>Loading Documents</strong>
</EuiFlexItem>
</EuiFlexGroup>
</div>
</EuiPanel>
)}
<a tabIndex={0} id="discoverBottomMarker">
&#8203;
Expand Down

0 comments on commit 0715996

Please sign in to comment.