-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ObsUx][Infra] Add collapsible sections in the overview tab #175716
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
65278aa
to
cbaad15
Compare
… there are no alerts
cbaad15
to
2e9dcc8
Compare
…b.com/jennypavlova/kibana into 175558-infra-add-collapsible-sections-in-the-overview-tab
…d-collapsible-sections-in-the-overview-tab
/ci |
Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services) |
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.
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:
When there is no active alerts, I wonder if we should still allow users to try to expand the section
no_active_alerts.mov
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 :)
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. |
@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: 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). |
@@ -48,13 +53,23 @@ export const AlertsSummaryContent = ({ | |||
[assetName, dateRange] | |||
); | |||
|
|||
const onLoaded = (alertsCount?: AlertsCount) => { | |||
const hasActiveAlerts = | |||
typeof alertsCount?.activeAlertCount === 'number' && alertsCount?.activeAlertCount > 0; |
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.
do we need typeof alertsCount?.activeAlertCount === 'number'
?
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.
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.
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.
suggestion: you could do this
const { activeAlertCount = 0 } = alertsCount ?? {};
const hasActiveAlerts = activeAlertCount > 0;
...
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.
Done ✅
Thanks for looking into that @jennypavlova . I like option 2, with the badge, both in the alerts section title and the alerts tab. |
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? |
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)?
OK to go with that? *the alignment looks a bit off |
@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: So I changed both as suggested: Wdyt? |
Good to go @jennypavlova - we can always update later! Great work! :-D |
@roshan-elastic Thanks for checking that! |
@crespocarlos Can you please take a look again - I updated the description and the screenshots :) |
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 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] = |
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.
nit: This prop is not a boolean, we could name it collapsibleStatus
, wdyt?
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.
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; |
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.
suggestion: you could do this
const { activeAlertCount = 0 } = alertsCount ?? {};
const hasActiveAlerts = activeAlertCount > 0;
...
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.
LGTM! Thanks @jennypavlova.
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.
Code generally looks good. Small suggestion below.
const shouldRenderAlertsClosedContent = typeof activeAlertCount === 'number'; | ||
|
||
if (!shouldRenderAlertsClosedContent) { | ||
return null; | ||
} |
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 the activeAlertCount
- so when it's a number.
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.
ResponseOps changes LGTM
…d-collapsible-sections-in-the-overview-tab
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: |
…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
…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
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:
Testing
fd1a21035a5f)
alerts_section_with_alerts_count.mov