From 40ef4fe8321387064b828ff7435db4baf35be10a Mon Sep 17 00:00:00 2001 From: Shahzad Date: Tue, 27 Oct 2020 20:47:23 +0100 Subject: [PATCH] revert truncation --- .../alert_details/components/alert_instances.tsx | 1 + .../server/lib/alerts/__tests__/status_check.test.ts | 8 ++++---- .../plugins/uptime/server/lib/alerts/status_check.ts | 12 ++++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_instances.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_instances.tsx index 403a4c639fb35..6f49b443ed80d 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_instances.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_instances.tsx @@ -38,6 +38,7 @@ export const alertInstancesTableColumns = ( { defaultMessage: 'Instance' } ), sortable: false, + truncateText: true, 'data-test-subj': 'alertInstancesTableCell-instance', }, { diff --git a/x-pack/plugins/uptime/server/lib/alerts/__tests__/status_check.test.ts b/x-pack/plugins/uptime/server/lib/alerts/__tests__/status_check.test.ts index 06b298aedeb2b..6757ab483dbad 100644 --- a/x-pack/plugins/uptime/server/lib/alerts/__tests__/status_check.test.ts +++ b/x-pack/plugins/uptime/server/lib/alerts/__tests__/status_check.test.ts @@ -1201,10 +1201,10 @@ describe('status check alert', () => { it('creates a set of unique IDs from a list of composite unique objects', () => { expect(getUniqueIdsByLoc(downItems, availItems)).toEqual( new Set([ - 'firstharrisburg', - 'firstfairbanks', - 'secondharrisburg', - 'secondfairbanks', + 'first-harrisburg', + 'first-fairbanks', + 'second-harrisburg', + 'second-fairbanks', ]) ); }); diff --git a/x-pack/plugins/uptime/server/lib/alerts/status_check.ts b/x-pack/plugins/uptime/server/lib/alerts/status_check.ts index 82d8d6e07322b..74a1af5ff1231 100644 --- a/x-pack/plugins/uptime/server/lib/alerts/status_check.ts +++ b/x-pack/plugins/uptime/server/lib/alerts/status_check.ts @@ -32,15 +32,19 @@ import { UMServerLibs } from '../lib'; const { MONITOR_STATUS } = ACTION_GROUP_DEFINITIONS; +const getMonIdByLoc = (monitorId: string, location: string) => { + return monitorId + '-' + location; +}; + const uniqueDownMonitorIds = (items: GetMonitorStatusResult[]): Set => items.reduce( - (acc, { monitorId, location }) => acc.add(monitorId + '-' + location), + (acc, { monitorId, location }) => acc.add(getMonIdByLoc(monitorId, location)), new Set() ); const uniqueAvailMonitorIds = (items: GetMonitorAvailabilityResult[]): Set => items.reduce( - (acc, { monitorId, location }) => acc.add(monitorId + '-' + location), + (acc, { monitorId, location }) => acc.add(getMonIdByLoc(monitorId, location)), new Set() ); @@ -330,11 +334,11 @@ export const statusCheckAlertFactory: UptimeAlertTypeFactory = (_server, libs) = mergedIdsByLoc.forEach((monIdByLoc) => { const availMonInfo = availabilityResults.find( - ({ monitorId, location }) => monitorId + location === monIdByLoc + ({ monitorId, location }) => getMonIdByLoc(monitorId, location) === monIdByLoc ); const downMonInfo = downMonitorsByLocation.find( - ({ monitorId, location }) => monitorId + location === monIdByLoc + ({ monitorId, location }) => getMonIdByLoc(monitorId, location) === monIdByLoc )?.monitorInfo; const monitorInfo = downMonInfo || availMonInfo?.monitorInfo!;