Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/update chart stats component #194

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 16 additions & 20 deletions public/pages/Overview/components/Widgets/Summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { EuiFlexGroup, EuiFlexItem, EuiText, EuiLink } from '@elastic/eui';
import { ROUTES } from '../../../../utils/constants';
import { EuiFlexGroup, EuiFlexItem, EuiLink, EuiStat } from '@elastic/eui';
import React, { useCallback, useEffect, useState } from 'react';
import { WidgetContainer } from './WidgetContainer';
import { summaryGroupByOptions } from '../../utils/constants';
import { getOverviewVisualizationSpec, getTimeWithMinPrecision } from '../../utils/helpers';
import { AlertItem, FindingItem } from '../../models/interfaces';
import { createSelectComponent, renderVisualization } from '../../../../utils/helpers';
import { ROUTES } from '../../../../utils/constants';

export interface SummaryProps {
findings: FindingItem[];
Expand Down Expand Up @@ -92,26 +92,22 @@ export const Summary: React.FC<SummaryProps> = ({ alerts, findings }) => {
<EuiFlexItem>
<EuiFlexGroup gutterSize="xl">
<EuiFlexItem grow={false}>
<EuiText size="s">
<p>Total active alerts</p>
</EuiText>
<EuiLink
href={`#${ROUTES.ALERTS}`}
style={{ fontSize: 20, textDecoration: 'underline' }}
>
{activeAlerts}
</EuiLink>
<EuiStat
title={<EuiLink href={`#${ROUTES.ALERTS}`}>{activeAlerts}</EuiLink>}
description="Total active alerts"
textAlign="left"
titleColor="primary"
isLoading={!activeAlerts}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiText size="s">
<p>Total findings</p>
</EuiText>
<EuiLink
href={`#${ROUTES.FINDINGS}`}
style={{ fontSize: 20, textDecoration: 'underline' }}
>
{totalFindings}
</EuiLink>
<EuiStat
title={<EuiLink href={`#${ROUTES.FINDINGS}`}>{totalFindings}</EuiLink>}
description="Total findings"
textAlign="left"
titleColor="primary"
isLoading={!totalFindings}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
Expand Down