Skip to content

Commit

Permalink
revert truncation
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Oct 27, 2020
1 parent 69c6580 commit 40ef4fe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const alertInstancesTableColumns = (
{ defaultMessage: 'Instance' }
),
sortable: false,
truncateText: true,
'data-test-subj': 'alertInstancesTableCell-instance',
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>([
'firstharrisburg',
'firstfairbanks',
'secondharrisburg',
'secondfairbanks',
'first-harrisburg',
'first-fairbanks',
'second-harrisburg',
'second-fairbanks',
])
);
});
Expand Down
12 changes: 8 additions & 4 deletions x-pack/plugins/uptime/server/lib/alerts/status_check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> =>
items.reduce(
(acc, { monitorId, location }) => acc.add(monitorId + '-' + location),
(acc, { monitorId, location }) => acc.add(getMonIdByLoc(monitorId, location)),
new Set<string>()
);

const uniqueAvailMonitorIds = (items: GetMonitorAvailabilityResult[]): Set<string> =>
items.reduce(
(acc, { monitorId, location }) => acc.add(monitorId + '-' + location),
(acc, { monitorId, location }) => acc.add(getMonIdByLoc(monitorId, location)),
new Set<string>()
);

Expand Down Expand Up @@ -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!;
Expand Down

0 comments on commit 40ef4fe

Please sign in to comment.