diff --git a/package.json b/package.json index 2729b66b..dbdbee68 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pd-live-react", "homepage": "https://pagerduty.github.io/pd-live-react", - "version": "0.12.1-beta.0", + "version": "0.12.2-beta.0", "private": true, "dependencies": { "@chakra-ui/icons": "^2.1.1", @@ -56,7 +56,7 @@ "styled-components": "^6.0.4", "use-debounce": "^9.0.3", "validator": "^13.11.0", - "web-vitals": "^3.4.0" + "web-vitals": "^3.5.2" }, "scripts": { "start": "vite", @@ -110,7 +110,7 @@ "@welldone-software/why-did-you-render": "^7.0.1", "babel-jest": "^29.6.3", "cypress": "^13.5.1", - "cypress-fail-fast": "^7.0.3", + "cypress-fail-fast": "^7.1.0", "cypress-real-events": "^1.11.0", "dotenv": "^16.4.4", "eslint": "^8.43.0", diff --git a/src/config/column-generator.jsx b/src/config/column-generator.jsx index 26110e95..00d4167b 100644 --- a/src/config/column-generator.jsx +++ b/src/config/column-generator.jsx @@ -773,7 +773,11 @@ export const customAlertColumnForSavedColumn = (savedColumn) => { return null; } const accessor = (incident) => { - const path = `alerts[*].body.cef_details.${accessorPath}`; + // custom details are in both body.cef_details.details and body.details for events + // but only body.details is guaranteed to exist, and won't be null + // body.cef_details.details can be null if the alert is from an email + // const path = `alerts[*].body.cef_details.${accessorPath}`; + const path = `alerts[*].body.${accessorPath}`; let result = null; try { result = JSONPath({ diff --git a/src/config/version.js b/src/config/version.js index 19bf0a60..f885508f 100644 --- a/src/config/version.js +++ b/src/config/version.js @@ -1,2 +1,2 @@ // Generated by genversion. -export const version = '0.12.1-beta.0'; +export const version = '0.12.2-beta.0'; diff --git a/src/mocks/incidents.test.js b/src/mocks/incidents.test.js index 6e7f7430..3182c045 100644 --- a/src/mocks/incidents.test.js +++ b/src/mocks/incidents.test.js @@ -22,6 +22,14 @@ const generateMockAlert = () => { const message = faker.commerce.productDescription(); const uuid = faker.string.uuid(); const link = faker.internet.url(); + const customDetails = { + quote, + 'some obsecure field': uuid, + link, + object_details: { + key1: 'value1', + }, + }; return { type: 'alert', id: alertId, @@ -30,18 +38,15 @@ const generateMockAlert = () => { created_at: createdAt, body: { contexts: [], + // custom details are in both body.cef_details.details and body.details for events + // but only body.details is guaranteed to exist, and won't be null + // body.cef_details.details can be null if the alert is from an email + details: customDetails, cef_details: { contexts: [], dedup_key: alertId, description: title, - details: { - quote, - 'some obsecure field': uuid, - link, - object_details: { - key1: 'value1', - }, - }, + details: customDetails, event_class: jobType, message, mutations: [ diff --git a/src/redux/incidents/sagas.js b/src/redux/incidents/sagas.js index d3cd0b76..0a517596 100644 --- a/src/redux/incidents/sagas.js +++ b/src/redux/incidents/sagas.js @@ -498,7 +498,10 @@ export function* filterIncidentsImpl() { // Handle case when '[*]' accessors are used const strippedAccessor = col.accessorPath.replace(/([[*\]])/g, '.'); return ( - `alerts.body.cef_details.${strippedAccessor}` + // custom details are in both body.cef_details.details and body.details for events + // but only body.details is guaranteed to exist, and won't be null + // body.cef_details.details can be null if the alert is from an email + `alerts.body.${strippedAccessor}` .split('.') // Handle case when special character is wrapped in quotation marks .map((a) => (a.includes("'") ? a.replaceAll("'", '') : a)) @@ -523,8 +526,11 @@ export function* filterIncidentsImpl() { const incidentAlertsForSearch = incidentAlerts[incident.id] instanceof Array ? incidentAlerts[incident.id] : []; const incidentAlertsForSearchWithFlattedCustomDetails = incidentAlertsForSearch.map( (alert) => { - const flattedCustomDetails = alert.body?.cef_details - ? Object.values(flattenObject(alert.body.cef_details)).join(' ') + // custom details are in both body.cef_details.details and body.details for events + // but only body.details is guaranteed to exist, and won't be null + // body.cef_details.details can be null if the alert is from an email + const flattedCustomDetails = alert.body?.details + ? Object.values(flattenObject(alert.body.details)).join(' ') : ''; return { ...alert, diff --git a/src/redux/incidents/sagas.test.js b/src/redux/incidents/sagas.test.js index d3b7c3c1..b0202b57 100644 --- a/src/redux/incidents/sagas.test.js +++ b/src/redux/incidents/sagas.test.js @@ -154,7 +154,7 @@ describe('Sagas: Incidents', () => { it('filterIncidents: Search by Alert Custom Detail Field', () => { const mockIncident = mockIncidents[0]; const customField = 'some obsecure field'; - const customFieldValue = mockIncident.alerts[0].body.cef_details.details[customField]; + const customFieldValue = mockIncident.alerts[0].body.details[customField]; const expectedIncidentResult = [mockIncident]; return expectSaga(filterIncidents) .withReducer(incidents) diff --git a/yarn.lock b/yarn.lock index 341cbd74..0886ac86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5278,10 +5278,10 @@ csstype@^3.0.11, csstype@^3.0.2, csstype@^3.1.2: resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.2.tgz#1d4bf9d572f11c14031f0436e1c10bc1f571f50b" integrity sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ== -cypress-fail-fast@^7.0.3: - version "7.0.3" - resolved "https://registry.yarnpkg.com/cypress-fail-fast/-/cypress-fail-fast-7.0.3.tgz#85ac2861c155611939f0bad03a09e561891f9ddf" - integrity sha512-IYVDZ+ykfTd2DFBK3N6NnWXc2gix7VwSi9Vg4zv40jm6PLknZTD4cZoRmh7uvpoQAIKNIFbx5V81qQD5pLHLSQ== +cypress-fail-fast@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/cypress-fail-fast/-/cypress-fail-fast-7.1.0.tgz#36e28e39fffaacf852b4866c8459e5274eb8326d" + integrity sha512-OnN5WqSP49yHKoitq+FmMG/+nUvat6NdFLNUQgVJYbmDdgyiiS1aI33S8+AuRb4zRZR5+5/eq53p/oL+a/m2Tw== dependencies: chalk "4.1.2" @@ -6614,9 +6614,9 @@ focus-lock@^0.11.6: tslib "^2.0.3" follow-redirects@^1.15.4: - version "1.15.5" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.5.tgz#54d4d6d062c0fa7d9d17feb008461550e3ba8020" - integrity sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw== + version "1.15.6" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b" + integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA== font-awesome@^4.7.0: version "4.7.0" @@ -10961,10 +10961,10 @@ warning@^4.0.0, warning@^4.0.2, warning@^4.0.3: dependencies: loose-envify "^1.0.0" -web-vitals@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-3.4.0.tgz#45ed33a3a2e029dc38d36547eb5d71d1c7e2552d" - integrity sha512-n9fZ5/bG1oeDkyxLWyep0eahrNcPDF6bFqoyispt7xkW0xhDzpUBTgyDKqWDi1twT0MgH4HvvqzpUyh0ZxZV4A== +web-vitals@^3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-3.5.2.tgz#5bb58461bbc173c3f00c2ddff8bfe6e680999ca9" + integrity sha512-c0rhqNcHXRkY/ogGDJQxZ9Im9D19hDihbzSQJrsioex+KnFgmMzBiy57Z1EjkhX/+OjyBpclDCzz2ITtjokFmg== webidl-conversions@^3.0.0: version "3.0.1"