Skip to content

Commit

Permalink
Merge pull request #423 from PagerDuty/release/0.12.2-beta.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gsreynolds authored Mar 28, 2024
2 parents 2896b5e + f497042 commit ad0aa3a
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 28 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/config/column-generator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion src/config/version.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 13 additions & 8 deletions src/mocks/incidents.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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: [
Expand Down
12 changes: 9 additions & 3 deletions src/redux/incidents/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/redux/incidents/sagas.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 11 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"

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

0 comments on commit ad0aa3a

Please sign in to comment.