From bfb0d795fc66f4195742012d260914488d646a2e Mon Sep 17 00:00:00 2001 From: Joanne Wang Date: Tue, 24 Sep 2024 12:09:15 -0400 Subject: [PATCH] Fit and Finish UX changes Pt 2 (#1099) (#1107) * 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 --------- Signed-off-by: Joanne Wang --- .../DataSourceAlertsCard.tsx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx b/public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx index 1f43bed5..6dd41b89 100644 --- a/public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx +++ b/public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx @@ -11,6 +11,7 @@ import { dataSourceFilterFn, getSeverityColor, getSeverityBadgeText, getTruncate import { renderTime } from "../../pages/Dashboard/utils/tableUtils"; import { ALERTS_NAV_ID, MONITORS_NAV_ID } from "../../../utils/constants"; import { APP_PATH, DEFAULT_EMPTY_DATA } from "../../utils/constants"; +import { dataSourceEnabled, getURL } from "../../pages/utils/helpers.js"; export interface DataSourceAlertsCardProps { getDataSourceMenu?: DataSourceManagementPluginSetup['ui']['getDataSourceMenu']; @@ -31,7 +32,7 @@ export const DataSourceAlertsCard: React.FC = ({ get query: { size: 25, sortField: 'start_time', - dataSourceId: dataSource?.id || '', + ...(dataSourceEnabled() && { dataSourceId: dataSource?.id || ''}), sortDirection: 'desc' } }).then(res => { @@ -53,6 +54,10 @@ export const DataSourceAlertsCard: React.FC = ({ get const createAlertDetailsHeader = useCallback((alert) => { const severityColor = getSeverityColor(alert.severity); const triggerName = alert.trigger_name ?? DEFAULT_EMPTY_DATA; + const monitorUrl = `${MONITORS_NAV_ID}#/monitors/${ + alert.alert_source === 'workflow' ? alert.workflow_id : alert.monitor_id + }?&type=${alert.alert_source}`; + const url = getURL(monitorUrl, dataSource?.id); return ( @@ -60,7 +65,11 @@ export const DataSourceAlertsCard: React.FC = ({ get
{getSeverityBadgeText(alert.severity)}    - {getTruncatedText(triggerName)} + + + {getTruncatedText(triggerName)} + +
@@ -79,8 +88,8 @@ export const DataSourceAlertsCard: React.FC = ({ get Monitor: - - {getTruncatedText(monitorName)} + + {monitorName}
@@ -96,7 +105,7 @@ export const DataSourceAlertsCard: React.FC = ({ get }); return ( - +