forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ObsUx][Infra] Add collapsible sections in the overview tab (elastic#…
…175716) Closes elastic#175989 ## Summary This PR is a follow-up to elastic#175558. It adds the active alerts count next to the alert section title (this will happen after the alerts widget is loaded) following the rules: Default behaviour No alerts at all ==> Collapse and say 'No active alerts' No active alerts ==> Collapse and say 'No active alerts' Active alerts ==> Expand fully Collapsed No alerts at all ==> Say 'No active alerts' No active alerts ==> Say 'No active alerts' Active alerts ==> say "X active alerts" It adds a change in the `AlertSummaryWidget` to make it possible to get the alerts count after the widget is loaded using a new prop. This PR also changes the alerts tab active alert count badge color on the hosts view to keep it consistent: | Before | After | | ------ | ------ | | <img width="242" alt="image" src="https://github.com/elastic/kibana/assets/14139027/85beec43-6522-4d58-a808-d3f7ec3e0759"> | <img width="263" alt="image" src="https://github.com/elastic/kibana/assets/14139027/43983493-3270-471a-8788-40ce38bed334"> | ## Testing - Open hosts view and select a host with active alerts (flyout or full page) - The alerts section should be expanded showing the alerts widget <img width="1920" alt="image" src="https://github.com/elastic/kibana/assets/14139027/f851c914-96cf-475f-bab3-dddc485405ec">fd1a21035a5f) - Collapse the alerts section by clicking on the title or the button: <img width="1917" alt="image" src="https://github.com/elastic/kibana/assets/14139027/e23e09ed-a781-4961-b592-6f13f539c316"> - Open hosts view and select a host without active alerts (flyout or full page) - The alerts section should be collapsed showing the message 'No active alerts' ![Image](https://github.com/elastic/obs-infraobs-team/assets/14139027/7077d3b3-c020-4be5-a3da-b46dda0d3ae0) https://github.com/elastic/kibana/assets/14139027/4058ed69-95f5-4b4c-8925-6680ac3791c1
- Loading branch information
1 parent
336ad2b
commit d8ec6e7
Showing
9 changed files
with
154 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
x-pack/plugins/infra/public/components/asset_details/tabs/overview/alerts_closed_content.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { EuiBadge, EuiToolTip } from '@elastic/eui'; | ||
|
||
export const AlertsClosedContent = ({ activeAlertCount }: { activeAlertCount?: number }) => { | ||
const shouldRenderAlertsClosedContent = typeof activeAlertCount === 'number'; | ||
|
||
if (!shouldRenderAlertsClosedContent) { | ||
return null; | ||
} | ||
|
||
if (activeAlertCount > 0) { | ||
return ( | ||
<EuiToolTip | ||
position="bottom" | ||
content={i18n.translate('xpack.infra.assetDetails.tooltip.activeAlertsExplanation', { | ||
defaultMessage: 'Active alerts', | ||
})} | ||
> | ||
<EuiBadge | ||
data-test-subj="infraAssetDetailsAlertsClosedContentWithAlerts" | ||
iconType="warning" | ||
color="danger" | ||
> | ||
{activeAlertCount} | ||
</EuiBadge> | ||
</EuiToolTip> | ||
); | ||
} | ||
|
||
return ( | ||
<span data-test-subj="infraAssetDetailsAlertsClosedContentNoAlerts"> | ||
{i18n.translate('xpack.infra.assetDetails.noActiveAlertsContentClosedSection', { | ||
defaultMessage: 'No active alerts', | ||
})} | ||
</span> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters