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

[ObsUx][Infra] Add collapsible sections in the overview tab #175716

Conversation

jennypavlova
Copy link
Member

@jennypavlova jennypavlova commented Jan 26, 2024

Closes #175989

Summary

This PR is a follow-up to #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
image image

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
      imagefd1a21035a5f)
    • Collapse the alerts section by clicking on the title or the button:
      image
  • 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
alerts_section_with_alerts_count.mov

@jennypavlova jennypavlova added the Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team label Jan 26, 2024
@jennypavlova jennypavlova self-assigned this Jan 26, 2024
@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@jennypavlova jennypavlova force-pushed the 175558-infra-add-collapsible-sections-in-the-overview-tab branch from 65278aa to cbaad15 Compare January 30, 2024 15:10
@jennypavlova
Copy link
Member Author

/ci

@jennypavlova jennypavlova marked this pull request as ready for review February 5, 2024 17:36
@jennypavlova jennypavlova requested review from a team as code owners February 5, 2024 17:36
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@jennypavlova jennypavlova added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting labels Feb 5, 2024
Copy link
Contributor

@crespocarlos crespocarlos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jennypavlova , thanks for the adjustments. I have a couple of suggestions/questions:

I know we didn't have any designs for the message next to the alert title, but I'm wondering if we could use badges to display the alert count, to make it consistent with how we're going to display it in the Hosts Table:

image

https://docs.google.com/document/d/1XHcBdDjfJfA8sT1H1vHwG16qKxQCVbQ_Cy4zI3_zHaA/edit#heading=h.php0dgdhwjlp

When there is no active alerts, I wonder if we should still allow users to try to expand the section

no_active_alerts.mov

@jennypavlova
Copy link
Member Author

I know we didn't have any designs for the message next to the alert title, but I'm wondering if we could use badges to display the alert count, to make it consistent with how we're going to display it in the Hosts Table

That's a good idea, thanks for sharing that. I tried to keep it simple for now before we get the design ready and discussed those messages with @roshan-elastic as a first iteration while we were waiting for the design. We can have either a badge (like those in the table) or the same style as the widget - I can try both and see how it looks :)

When there is no active alerts, I wonder if we should still allow users to try to expand the section

I know what you mean here - initially I showed the same "No alerts" message there but I don't think it's useful with the default closed section. Another case we miss here is when for example there are 5 recovered alerts the user should be still able to see the section there (even if there are no active alerts), so in short, we should still have the option to expand the section.
There are 2 cases when we have no alerts (any alerts) - when we don't have any rules or when the host is "healthy": If you ask me we can have something visual there that no active alerts are present or a prompt with a button to link to rule creation (in case of no rules) or both somehow - but IMO this should be handled in the alerts summary widget

@jennypavlova
Copy link
Member Author

@roshan-elastic @crespocarlos So question about the active alerts message based on the discussion above and the alerts designs here I tried 2 versions of the closed section message with active alerts:

  • Same as the widget:
    image

  • Same as table (badge):
    image

  • Note: The current version is just text:
    image

TBH I like the red color there but I can't decide which one fits better 😅 Wdyt?

BTW off-topic: but we can maybe also add an issue to convert the pink alert badge to red inside the hosts view tab so it will be also consistent with the design of the alerts feature (of course, if we are not trying to avoid red color for the specific case).
image

@@ -48,13 +53,23 @@ export const AlertsSummaryContent = ({
[assetName, dateRange]
);

const onLoaded = (alertsCount?: AlertsCount) => {
const hasActiveAlerts =
typeof alertsCount?.activeAlertCount === 'number' && alertsCount?.activeAlertCount > 0;
Copy link
Contributor

@kpatticha kpatticha Feb 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need typeof alertsCount?.activeAlertCount === 'number' ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the type number | undefined so the first check is to make sure that it's a number and not undefined (Typescript will complain that it can be undefined if we remove the check) Do you think there is something wrong with checking that? We can also change it to alertsCount?.activeAlertCount && ... but I think checking the type is easy to understand and helps validate the activeAlertCount value type I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: you could do this

const { activeAlertCount = 0 } = alertsCount ?? {};
const hasActiveAlerts = activeAlertCount > 0;
...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅

@crespocarlos
Copy link
Contributor

Thanks for looking into that @jennypavlova .

I like option 2, with the badge, both in the alerts section title and the alerts tab.

@roshan-elastic
Copy link

Hey @jennypavlova - I like the idea of being consistent between the alerts tab and the alerts section for sure.

I think we need UX here as I think it needs a little tweaking. Could we wait for @sileschristian to take a look a this?

@roshan-elastic
Copy link

roshan-elastic commented Feb 8, 2024

Hey @jennypavlova - I like the idea of being consistent between the alerts tab and the alerts section for sure.

I think we need UX here as I think it needs a little tweaking. Could we wait for @sileschristian to take a look a this?

@jennypavlova @crespocarlos

Actually, given we're nearly at FF, @sileschristian still looks sick so I'd rather get this out and tweak it later.

Looking at APM, can we keep it consistent with how they do it (and we can tweak both if we need to once @sileschristian has had a look)?

Alerts in APM
image

image

OK to go with that?

*the alignment looks a bit off

image

@jennypavlova
Copy link
Member Author

@roshan-elastic @crespocarlos Thank you both!

Regarding the alignment - it was just an example, I didn't really look at the position just the item itself and thanks for spotting that, so I set a central alignment it now:
image

So I changed both as suggested:

image

Wdyt?

@roshan-elastic
Copy link

Good to go @jennypavlova - we can always update later!

Great work! :-D

@jennypavlova
Copy link
Member Author

@roshan-elastic Thanks for checking that!
BTW I forgot the tooltip from the APM badge in the table and now I changed it to have the same styles:

image

@jennypavlova
Copy link
Member Author

@crespocarlos Can you please take a look again - I updated the description and the screenshots :)

Copy link
Contributor

@crespocarlos crespocarlos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes @jennypavlova. Left a couple nits

@@ -37,6 +39,9 @@ export const AlertsSummaryContent = ({
const { featureFlags } = usePluginConfig();
const [isAlertFlyoutVisible, { toggle: toggleAlertFlyout }] = useBoolean(false);
const { overrides } = useAssetDetailsRenderPropsContext();
const [isAlertSectionOpen, setIsAlertSectionOpen] =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This prop is not a boolean, we could name it collapsibleStatus, wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, renamed ✅

@@ -48,13 +53,23 @@ export const AlertsSummaryContent = ({
[assetName, dateRange]
);

const onLoaded = (alertsCount?: AlertsCount) => {
const hasActiveAlerts =
typeof alertsCount?.activeAlertCount === 'number' && alertsCount?.activeAlertCount > 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: you could do this

const { activeAlertCount = 0 } = alertsCount ?? {};
const hasActiveAlerts = activeAlertCount > 0;
...

Copy link
Contributor

@crespocarlos crespocarlos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @jennypavlova.

Copy link
Contributor

@thomheymann thomheymann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code generally looks good. Small suggestion below.

Comment on lines +12 to +16
const shouldRenderAlertsClosedContent = typeof activeAlertCount === 'number';

if (!shouldRenderAlertsClosedContent) {
return null;
}
Copy link
Contributor

@thomheymann thomheymann Feb 8, 2024

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?

Copy link
Member Author

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 the activeAlertCount - so when it's a number.

Copy link
Contributor

@Zacqary Zacqary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ResponseOps changes LGTM

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
infra 1422 1423 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
infra 1.3MB 1.3MB +951.0B
triggersActionsUi 1.4MB 1.4MB +46.0B
total +997.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jennypavlova

@jennypavlova jennypavlova merged commit cd1f2b0 into elastic:main Feb 9, 2024
17 checks passed
@jennypavlova jennypavlova deleted the 175558-infra-add-collapsible-sections-in-the-overview-tab branch February 9, 2024 10:06
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
…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
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
…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
fkanout pushed a commit to fkanout/kibana that referenced this pull request Mar 4, 2024
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ObxUx][Infra] Alerts section: show alerts count and close the section if there are no alerts