Skip to content

Commit 764759f

Browse files
Fit and Finish UX changes Pt 2 (#1099) (#1104)
* remove truncated monitor name * wip * fix alerts not showing up when no datasource id * fix url for composite monitors * check if datasource is enabled * fix overflow monitor name * make monitor name truncated dynamically * change mounting point id and fix sizing --------- (cherry picked from commit 42ee4fe) Signed-off-by: Joanne Wang <jowg@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 628638e commit 764759f

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { dataSourceFilterFn, getSeverityColor, getSeverityBadgeText, getTruncate
1111
import { renderTime } from "../../pages/Dashboard/utils/tableUtils";
1212
import { ALERTS_NAV_ID, MONITORS_NAV_ID } from "../../../utils/constants";
1313
import { APP_PATH, DEFAULT_EMPTY_DATA } from "../../utils/constants";
14+
import { dataSourceEnabled, getURL } from "../../pages/utils/helpers.js";
1415

1516
export interface DataSourceAlertsCardProps {
1617
getDataSourceMenu?: DataSourceManagementPluginSetup['ui']['getDataSourceMenu'];
@@ -31,7 +32,7 @@ export const DataSourceAlertsCard: React.FC<DataSourceAlertsCardProps> = ({ get
3132
query: {
3233
size: 25,
3334
sortField: 'start_time',
34-
dataSourceId: dataSource?.id || '',
35+
...(dataSourceEnabled() && { dataSourceId: dataSource?.id || ''}),
3536
sortDirection: 'desc'
3637
}
3738
}).then(res => {
@@ -53,14 +54,22 @@ export const DataSourceAlertsCard: React.FC<DataSourceAlertsCardProps> = ({ get
5354
const createAlertDetailsHeader = useCallback((alert) => {
5455
const severityColor = getSeverityColor(alert.severity);
5556
const triggerName = alert.trigger_name ?? DEFAULT_EMPTY_DATA;
57+
const monitorUrl = `${MONITORS_NAV_ID}#/monitors/${
58+
alert.alert_source === 'workflow' ? alert.workflow_id : alert.monitor_id
59+
}?&type=${alert.alert_source}`;
60+
const url = getURL(monitorUrl, dataSource?.id);
5661

5762
return (
5863
<EuiFlexGroup gutterSize="s" justifyContent="spaceBetween" alignItems="center">
5964
<EuiFlexItem grow={false}>
6065
<div>
6166
<EuiBadge color={severityColor?.background} style={{ padding: '1px 4px', color: severityColor?.text }}>{getSeverityBadgeText(alert.severity)}</EuiBadge>
6267
&nbsp;&nbsp;
63-
<span style={{ color: "#006BB4" }} className="eui-textTruncate">{getTruncatedText(triggerName)}</span>
68+
<EuiLink href={url}>
69+
<span style={{ color: '#006BB4' }} className="eui-textTruncate">
70+
{getTruncatedText(triggerName)}
71+
</span>
72+
</EuiLink>
6473
</div>
6574
</EuiFlexItem>
6675
<EuiFlexItem grow={false} >
@@ -79,8 +88,8 @@ export const DataSourceAlertsCard: React.FC<DataSourceAlertsCardProps> = ({ get
7988
<EuiFlexItem grow={false}>
8089
<EuiText size="s" color="subdued">Monitor:</EuiText>
8190
</EuiFlexItem>
82-
<EuiFlexItem grow={false} >
83-
<EuiText size="m">{getTruncatedText(monitorName)}</EuiText>
91+
<EuiFlexItem grow={false} style={{ overflow: 'hidden', textOverflow: 'ellipsis' }}>
92+
<EuiText size="m" style={{ overflow: 'hidden', textOverflow: 'ellipsis' }}>{monitorName}</EuiText>
8493
</EuiFlexItem>
8594
</EuiFlexGroup>
8695
<EuiHorizontalRule margin="xs" />
@@ -96,7 +105,7 @@ export const DataSourceAlertsCard: React.FC<DataSourceAlertsCardProps> = ({ get
96105
});
97106

98107
return (
99-
<EuiPanel hasBorder={false} hasShadow={false}>
108+
<EuiPanel hasBorder={false} hasShadow={false} style={{ overflow: 'hidden' }}>
100109
<EuiFlexGroup style={{ height: '100%' }} direction="column" justifyContent="spaceBetween" alignItems="flexStart" gutterSize="xs">
101110
<EuiFlexItem grow={false} style={{ width: '100%', height: '90%' }}>
102111
<EuiFlexGroup direction="column" style={{ height: '100%' }}>

0 commit comments

Comments
 (0)