-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[ObsUx][Infra] Add collapsible sections in the overview tab #175716
Merged
jennypavlova
merged 23 commits into
elastic:main
from
jennypavlova:175558-infra-add-collapsible-sections-in-the-overview-tab
Feb 9, 2024
Merged
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
53507a8
Add collapsible sections in the asset details overview tab
jennypavlova b70bf99
Merge branch 'main' of github.com:elastic/kibana into 175558-infra-ad…
jennypavlova 636c00e
Update section id, add closed section content and no alerts case
jennypavlova bccf4cd
Add tests and fix test ids
jennypavlova e8cdbe9
Change data test subjs
jennypavlova 2e9dcc8
Try to use alerts count only in the alert widget and close section if…
jennypavlova e820931
Update ids and alerts closed content
jennypavlova e4d5d08
Refactoring: remove alerts customizations
jennypavlova d8f032b
Merge branch 'main' into 175558-infra-add-collapsible-sections
jennypavlova 4b70650
Investigate a way to get alerts count
jennypavlova a739183
Merge branch '175558-infra-add-collapsible-sections' of https://githu…
jennypavlova b4c377e
Merge branch 'main' of github.com:elastic/kibana into 175558-infra-ad…
jennypavlova 87d718e
Cleanup
jennypavlova 5e3a34f
Add tests
jennypavlova a91846d
Merge branch 'main' into 175558-infra-add-collapsible-sections-in-the…
jennypavlova 0c98488
Merge branch 'main' into 175558-infra-add-collapsible-sections-in-the…
jennypavlova 24b9025
Merge branch 'main' into 175558-infra-add-collapsible-sections-in-the…
jennypavlova 9f9edec
CR changes
jennypavlova aecd931
CR/Requested changes
jennypavlova 6ee4927
Align design with apm
jennypavlova 401bde1
CR changes
jennypavlova 9311caf
Test id fix
jennypavlova 4747262
Merge branch 'main' of github.com:elastic/kibana into 175558-infra-ad…
jennypavlova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
40 changes: 40 additions & 0 deletions
40
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,40 @@ | ||
/* | ||
* 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 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be the responsibility of the consumer to decide wether they want to render this component or not instead of having a component that doesn't render anything when no
activeAlertCount
prop has been passed in.What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @thomheymann, you are right in general but the idea here is that before we set the
activeAlertCount
we don't want to display any message and the message should be shown once we have theactiveAlertCount
- so when it's a number.