Skip to content

Commit

Permalink
[APM] Removing the icon for tech preview and fixing some of the alert…
Browse files Browse the repository at this point in the history
… badges (elastic#150528)

After a discussion with @maciejforcone and @grabowskit it was
recommended to remove the tech preview badge for the Alerts tab. We also
made small change in the alert badge in different areas in APM to make
easier to understand and align them with the actionable o11y team.

Before / After

![image](https://user-images.githubusercontent.com/13353203/217280187-939fbc76-d036-4fea-b1e8-50983738f73b.png)


![image](https://user-images.githubusercontent.com/13353203/217280566-ae5a2d00-c939-496d-9642-ba20735fc91b.png)

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
boriskirov and kibanamachine authored Feb 8, 2023
1 parent 752f87b commit ebc6750
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { EuiToolTip } from '@elastic/eui';
import {
EuiAvatar,
EuiBadge,
Expand Down Expand Up @@ -62,10 +63,10 @@ export function ServiceGroupsCard({
)}
</EuiText>
</EuiFlexItem>
<EuiFlexGroup>
<EuiFlexGroup alignItems="center">
<ServiceStat loading={isLoading}>
<EuiFlexItem>
<EuiText size="s" textAlign="left">
<EuiText size="xs" textAlign="left">
{serviceGroupCounts !== undefined &&
i18n.translate(
'xpack.apm.serviceGroups.cardsList.serviceCount',
Expand All @@ -80,25 +81,35 @@ export function ServiceGroupsCard({
</ServiceStat>
<ServiceStat loading={isLoading} grow={isLoading}>
{serviceGroupCounts && serviceGroupCounts.alerts > 0 && (
<EuiBadge
iconType="alert"
color="danger"
href={activeAlertsHref}
{...({
onClick(e: React.SyntheticEvent) {
e.stopPropagation(); // prevents extra click thru to EuiCard's href destination
},
} as object)} // workaround for type check that prevents href + onclick
>
{i18n.translate(
'xpack.apm.serviceGroups.cardsList.alertCount',
<EuiToolTip
position="bottom"
content={i18n.translate(
'xpack.apm.home.serviceGroups.tooltip.activeAlertsExplanation',
{
defaultMessage:
'{alertsCount} {alertsCount, plural, one {alert} other {alerts}}',
values: { alertsCount: serviceGroupCounts.alerts },
defaultMessage: 'Active alerts',
}
)}
</EuiBadge>
>
<EuiBadge
iconType="alert"
color="danger"
href={activeAlertsHref}
{...({
onClick(e: React.SyntheticEvent) {
e.stopPropagation(); // prevents extra click thru to EuiCard's href destination
},
} as object)} // workaround for type check that prevents href + onclick
>
{i18n.translate(
'xpack.apm.serviceGroups.cardsList.alertCount',
{
defaultMessage:
'{alertsCount} {alertsCount, plural, one {alert} other {alerts}}',
values: { alertsCount: serviceGroupCounts.alerts },
}
)}
</EuiBadge>
</EuiToolTip>
)}
</ServiceStat>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,37 @@ export function getServiceColumns({
? [
{
field: ServiceInventoryFieldName.AlertsCount,
name: '',
width: `${unit * 5}px`,
name: i18n.translate('xpack.apm.servicesTable.alertsColumnLabel', {
defaultMessage: 'Active alerts',
}),
width: `${unit * 8}px`,
sortable: true,
render: (_, { serviceName, alertsCount }) => {
if (!alertsCount) {
return null;
}

return (
<EuiBadge
iconType="alert"
color="danger"
href={link('/services/{serviceName}/alerts', {
path: { serviceName },
query,
})}
<EuiToolTip
position="bottom"
content={i18n.translate(
'xpack.apm.home.servicesTable.tooltip.activeAlertsExplanation',
{
defaultMessage: 'Active alerts',
}
)}
>
{alertsCount}
</EuiBadge>
<EuiBadge
iconType="alert"
color="danger"
href={link('/services/{serviceName}/alerts', {
path: { serviceName },
query,
})}
>
{alertsCount}
</EuiBadge>
</EuiToolTip>
);
},
} as ITableColumn<ServiceListItem>,
Expand Down Expand Up @@ -150,7 +162,7 @@ export function getServiceColumns({
defaultMessage: 'Environment',
}
),
width: `${unit * 10}px`,
width: `${unit * 9}px`,
sortable: true,
render: (_, { environments }) => (
<EnvironmentBadge environments={environments ?? []} />
Expand All @@ -166,7 +178,7 @@ export function getServiceColumns({
'xpack.apm.servicesTable.transactionColumnLabel',
{ defaultMessage: 'Transaction type' }
),
width: `${unit * 10}px`,
width: `${unit * 8}px`,
sortable: true,
},
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import {
EuiPageHeaderProps,
EuiSpacer,
EuiTitle,
EuiToolTip,
EuiBadge,
} from '@elastic/eui';
import { useLocation } from 'react-router-dom';
import { EuiBadge } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { enableAwsLambdaMetrics } from '@kbn/observability-plugin/common';
import { omit } from 'lodash';
Expand Down Expand Up @@ -357,13 +358,20 @@ function useTabs({ selectedTab }: { selectedTab: Tab['key'] }) {
path: { serviceName },
query,
}),
prepend:
append:
serviceAlertsCount.alertsCount > 0 ? (
<EuiBadge iconType="alert" color="danger">
{serviceAlertsCount.alertsCount}
</EuiBadge>
<EuiToolTip
position="bottom"
content={i18n.translate(
'xpack.apm.home.serviceAlertsTable.tooltip.activeAlertsExplanation',
{
defaultMessage: 'Active alerts',
}
)}
>
<EuiBadge color="danger">{serviceAlertsCount.alertsCount}</EuiBadge>
</EuiToolTip>
) : null,
append: <TechnicalPreviewBadge icon="beaker" />,
label: i18n.translate('xpack.apm.home.alertsTabLabel', {
defaultMessage: 'Alerts',
}),
Expand Down

0 comments on commit ebc6750

Please sign in to comment.