Skip to content

Commit

Permalink
Merge pull request #78 from newrelic/kav/chains
Browse files Browse the repository at this point in the history
feat: add extra opt. chains
  • Loading branch information
Kav91 authored Nov 29, 2024
2 parents 09800bf + c358546 commit 9122c5d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions visualizations/nrql-status-widget/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ export const deriveValues = (nrqlData, config, timeRangeResult) => {
const values = { timeseries: [] };
(nrqlData || []).forEach(d => {
const groupDisplayName =
d.metadata.groups[d.metadata.groups.length - 1].displayName;
const groupName = d.metadata.groups[d.metadata.groups.length - 1].name;
const groupValue = d.metadata.groups[d.metadata.groups.length - 1].value;
d.metadata?.groups?.[d.metadata.groups.length - 1]?.displayName;
const groupName = d.metadata.groups?.[d.metadata.groups.length - 1]?.name;
const groupValue = d.metadata.groups?.[d.metadata.groups.length - 1]?.value;

let selectedGroup = '';

if (
d.data[0][groupDisplayName] !== null &&
d.data[0][groupDisplayName] !== undefined
d.data?.[0]?.[groupDisplayName] !== null &&
d.data?.[0]?.[groupDisplayName] !== undefined
) {
values[groupDisplayName] = d.data[d.data.length - 1][groupDisplayName];
values.latestValue = values[groupDisplayName];
values.value = values.latestValue;
selectedGroup = 'groupDisplayName';
} else if (
d.data[0][groupName] !== null &&
d.data[0][groupName] !== undefined
d.data?.[0]?.[groupName] !== null &&
d.data?.[0]?.[groupName] !== undefined
) {
values[groupName] = d.data[d.data.length - 1][groupName];
values.latestValue = values[groupName];
values.value = values.latestValue;
selectedGroup = 'groupName';
} else if (
d.data[0][groupValue] !== null &&
d.data[0][groupValue] !== undefined
d.data?.[0]?.[groupValue] !== null &&
d.data?.[0]?.[groupValue] !== undefined
) {
values[groupValue] = d.data[d.data.length - 1][groupValue];
values.latestValue = values[groupValue];
Expand Down

0 comments on commit 9122c5d

Please sign in to comment.