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

Change agents summary no results #7041

Merged
merged 11 commits into from
Oct 2, 2024
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Update malware detection group values in data sources [#6963](https://github.com/wazuh/wazuh-dashboard-plugins/issues/6963)
- Changed the registration id of the Settings application for compatibility with OpenSearch Dashboard 2.16.0 [#6938](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6938)
- Changed Malware detection dashboard visualizations [#6964](https://github.com/wazuh/wazuh-dashboard-plugins/issues/6964)
- Changed the agents summary in overview with no results to an agent deployment help message. [#7041](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7041)
- Changed malware feature description [#7036](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7036)

### Fixed
Expand Down
JuanGarriuz marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,303 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Stats component renders correctly to match the snapshot 1`] = `
<div>
<div
class="euiPage euiPage--paddingMedium euiPage--grow"
>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--directionRow euiFlexGroup--responsive"
>
<div
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<div
class="euiPanel euiPanel--paddingLarge euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow euiCard euiCard--centerAligned euiCard--hasBetaBadge"
>
<div
class="euiCard__content"
>
<span
class="euiTitle euiTitle--small euiCard__title"
id="htmlIdTitle"
/>
<div
class="euiCard__children"
>
<div
class="wazuh-visualization-layout"
style="width: 100%; height: 150px;"
>
<div
class="euiEmptyPrompt"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--xxLarge euiIcon--subdued euiIcon-isLoading"
focusable="false"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M5.277 10.088c.02.014.04.03.057.047.582.55 1.134.812 1.666.812.586 0 1.84-.293 3.713-.88L9 6.212V2H7v4.212l-1.723 3.876Zm-.438.987L3.539 14h8.922l-1.32-2.969C9.096 11.677 7.733 12 7 12c-.74 0-1.463-.315-2.161-.925ZM6 2H5V1h6v1h-1v4l3.375 7.594A1 1 0 0 1 12.461 15H3.54a1 1 0 0 1-.914-1.406L6 6V2Z"
/>
</svg>
<div
class="euiSpacer euiSpacer--m"
/>
<h4
class="euiTitle euiTitle--medium"
>
No results
</h4>
<span
class="euiTextColor euiTextColor--subdued"
>
<div
class="euiSpacer euiSpacer--m"
/>
<div
class="euiText euiText--medium"
>
No results were found.
</div>
</span>
</div>
</div>
</div>
</div>
<span
class="euiCard__betaBadgeWrapper"
>
<span
class="euiBetaBadge euiBetaBadge--hollow euiCard__betaBadge"
id="htmlIdBetaBadge"
title="Agents summary"
>
Agents summary
</span>
</span>
</div>
</div>
<div
class="euiFlexItem"
>
<div
class="euiPanel euiPanel--paddingLarge euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow euiCard euiCard--centerAligned euiCard--hasBetaBadge"
>
<div
class="euiCard__content"
>
<span
class="euiTitle euiTitle--small euiCard__title"
id="htmlIdTitle"
/>
<div
class="euiCard__children"
>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--directionRow euiFlexGroup--responsive euiFlexGroup--wrap vulnerabilites-summary-card"
>
<div
class="euiFlexItem"
>
<div
class="osdRedirectCrossAppLinks"
>
<div
class="euiStat euiStat--centerAligned"
>
<div
class="euiText euiText--small euiStat__description"
>
<h3
aria-hidden="true"
>
Critical severity
</h3>
</div>
<p
aria-hidden="true"
class="euiTitle euiTitle--large euiStat__title"
style="color: rgb(189, 39, 30);"
>
<span
class="euiToolTipAnchor"
>
<a
class="euiLink euiLink--primary statWithLink"
href=""
rel="noreferrer"
style="font-weight: normal; color: rgb(189, 39, 30);"
>
-
</a>
</span>
</p>
</div>
<div
class="euiText euiText--extraSmall"
css="margin-top: 0.7vh"
>
Rule level 15 or higher
</div>
</div>
</div>
<div
class="euiFlexItem"
>
<div
class="osdRedirectCrossAppLinks"
>
<div
class="euiStat euiStat--centerAligned"
>
<div
class="euiText euiText--small euiStat__description"
>
<h3
aria-hidden="true"
>
High severity
</h3>
</div>
<p
aria-hidden="true"
class="euiTitle euiTitle--large euiStat__title"
style="color: rgb(254, 197, 20);"
>
<span
class="euiToolTipAnchor"
>
<a
class="euiLink euiLink--primary statWithLink"
href=""
rel="noreferrer"
style="font-weight: normal; color: rgb(254, 197, 20);"
>
-
</a>
</span>
</p>
</div>
<div
class="euiText euiText--extraSmall"
css="margin-top: 0.7vh"
>
Rule level 12 to 14
</div>
</div>
</div>
<div
class="euiFlexItem"
>
<div
class="osdRedirectCrossAppLinks"
>
<div
class="euiStat euiStat--centerAligned"
>
<div
class="euiText euiText--small euiStat__description"
>
<h3
aria-hidden="true"
>
Medium severity
</h3>
</div>
<p
aria-hidden="true"
class="euiTitle euiTitle--large euiStat__title"
style="color: rgb(96, 146, 192);"
>
<span
class="euiToolTipAnchor"
>
<a
class="euiLink euiLink--primary statWithLink"
href=""
rel="noreferrer"
style="font-weight: normal; color: rgb(96, 146, 192);"
>
-
</a>
</span>
</p>
</div>
<div
class="euiText euiText--extraSmall"
css="margin-top: 0.7vh"
>
Rule level 7 to 11
</div>
</div>
</div>
<div
class="euiFlexItem"
>
<div
class="osdRedirectCrossAppLinks"
>
<div
class="euiStat euiStat--centerAligned"
>
<div
class="euiText euiText--small euiStat__description"
>
<h3
aria-hidden="true"
>
Low severity
</h3>
</div>
<p
aria-hidden="true"
class="euiTitle euiTitle--large euiStat__title"
style="color: rgb(0, 120, 113);"
>
<span
class="euiToolTipAnchor"
>
<a
class="euiLink euiLink--primary statWithLink"
href=""
rel="noreferrer"
style="font-weight: normal; color: rgb(0, 120, 113);"
>
-
</a>
</span>
</p>
</div>
<div
class="euiText euiText--extraSmall"
css="margin-top: 0.7vh"
>
Rule level 0 to 6
</div>
</div>
</div>
</div>
</div>
</div>
<span
class="euiCard__betaBadgeWrapper"
>
<span
class="euiBetaBadge euiBetaBadge--hollow euiCard__betaBadge"
id="htmlIdBetaBadge"
title="Last 24 hours alerts"
>
Last 24 hours alerts
</span>
</span>
</div>
</div>
</div>
</div>
</div>
`;
exports[`Stats component renders correctly to match the snapshot 1`] = `<div />`;
51 changes: 38 additions & 13 deletions plugins/main/public/controllers/overview/components/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
EuiFlexGroup,
EuiPage,
EuiToolTip,
EuiEmptyPrompt,
} from '@elastic/eui';
import { withErrorBoundary } from '../../../components/common/hocs';
import { API_NAME_AGENT_STATUS } from '../../../../common/constants';
Expand All @@ -30,6 +31,8 @@ import { LastAlertsStat } from './last-alerts-stat';
import { VisualizationBasic } from '../../../components/common/charts/visualizations/basic';
import NavigationService from '../../../react-services/navigation-service';
import './stats.scss';
import { WzButtonPermissions } from '../../../components/common/permissions/button';

export const Stats = withErrorBoundary(
class Stats extends Component {
constructor(props) {
Expand Down Expand Up @@ -86,14 +89,13 @@ export const Stats = withErrorBoundary(
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<EuiCard betaBadgeLabel='Agents summary' title=''>
<VisualizationBasic
isLoading={this.state.loadingSummary}
type='donut'
size={{ width: '100%', height: '150px' }}
showLegend
data={
hasResults &&
this.agentStatus.map(
{hasResults ? (
<VisualizationBasic
isLoading={this.state.loadingSummary}
type='donut'
size={{ width: '100%', height: '150px' }}
showLegend
data={this.agentStatus.map(
({ status, label, color, onClick }) => ({
onClick,
label,
Expand All @@ -103,11 +105,34 @@ export const Stats = withErrorBoundary(
: 0,
color,
}),
)
}
noDataTitle='No results'
noDataMessage='No results were found.'
/>
)}
/>
) : (
!hasResults &&
this.props !== undefined && (
<EuiEmptyPrompt
body={<p>Add agents to fleet to start monitoring</p>}
JuanGarriuz marked this conversation as resolved.
Show resolved Hide resolved
actions={
<WzButtonPermissions
color='primary'
fill
permissions={[
{ action: 'agent:create', resource: '*:*:*' },
]}
iconType='plusInCircle'
href={NavigationService.getInstance().getUrlForApp(
endpointSummary.id,
{
path: `#${endpointSummary.redirectTo()}deploy`,
},
)}
JuanGarriuz marked this conversation as resolved.
Show resolved Hide resolved
>
Deploy new agent
</WzButtonPermissions>
}
/>
)
)}
</EuiCard>
</EuiFlexItem>
<EuiFlexItem>
Expand Down
Loading