Skip to content

Commit

Permalink
update to v10
Browse files Browse the repository at this point in the history
  • Loading branch information
craigrbarnes committed Dec 6, 2024
1 parent 96801ce commit 43368c3
Show file tree
Hide file tree
Showing 7 changed files with 601 additions and 17 deletions.
52 changes: 43 additions & 9 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@mantine/modals": "^7.13.3",
"@mantine/dates": "^7.13.3",
"@mantine/notifications": "^7.13.3",
"jsonpath-plus": "^10.2.0",
"classnames": "^2.3.1",
"colorette": "^2.0.20",
"dom-to-svg": "^0.12.2",
Expand Down
1 change: 0 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"@types/fastestsmallesttextencoderdecoder": "^1.0.2",
"@types/flat": "^5.0.3",
"@types/isomorphic-fetch": "^0.0.36",
"@types/jsonpath-plus": "5.0.5",
"@types/lodash": "^4.14.191",
"@types/papaparse": "^5.3.14",
"@types/uuid": "^9.0.0"
Expand Down
18 changes: 13 additions & 5 deletions packages/core/src/features/guppy/guppySlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,32 @@ const statusEndpoint = '/_status';
const processHistogramResponse = (
data: Record<string, any>,
): AggregationsData => {
const pathData = JSONPath({
const valueData = JSONPath({
json: data,
path: '$..histogram',
resultType: 'all',
resultType: 'value',
});
const results = pathData.reduce(
(acc: AggregationsData, element: Record<string, any>) => {

const pointerData = JSONPath({
json: data,
path: '$..histogram',
resultType: 'pointer',
});

const results = pointerData.reduce(
(acc: AggregationsData, element: Record<string, any>, idx: number) => {
const key = element.pointer
.slice(1)
.replace(/\/histogram/g, '')
.replace(/\//g, '.');
return {
...acc,
[key]: element.value,
[key]: valueData[idx],
};
},
{} as AggregationsData,
);
console.log('processHistogramResponse', results);
return results as AggregationsData;
};

Expand Down
Loading

0 comments on commit 43368c3

Please sign in to comment.