@parca/profile 0.16.333 → 0.16.335
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.16.335](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.334...@parca/profile@0.16.335) (2024-01-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
10
|
+
## [0.16.334](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.333...@parca/profile@0.16.334) (2024-01-18)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @parca/profile
|
|
13
|
+
|
|
6
14
|
## [0.16.333](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.332...@parca/profile@0.16.333) (2024-01-11)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @parca/profile
|
|
@@ -38,7 +38,17 @@ const sanitizeDateRange = (time_selection_a, from_a, to_a) => {
|
|
|
38
38
|
return { time_selection_a: range.getRangeKey(), from_a, to_a };
|
|
39
39
|
};
|
|
40
40
|
/* eslint-enable @typescript-eslint/naming-convention */
|
|
41
|
-
const filterSuffix = (o, suffix) => Object.fromEntries(Object.entries(o)
|
|
41
|
+
const filterSuffix = (o, suffix) => Object.fromEntries(Object.entries(o)
|
|
42
|
+
.filter(([key]) => !key.endsWith(suffix))
|
|
43
|
+
.map(([key, value]) => {
|
|
44
|
+
if (typeof value === 'string') {
|
|
45
|
+
return [key, encodeURIComponent(value)];
|
|
46
|
+
}
|
|
47
|
+
if (Array.isArray(value)) {
|
|
48
|
+
return [key, value.map(v => encodeURIComponent(v))];
|
|
49
|
+
}
|
|
50
|
+
return [key, value];
|
|
51
|
+
}));
|
|
42
52
|
const swapQueryParameters = (o) => {
|
|
43
53
|
Object.entries(o).forEach(([key, value]) => {
|
|
44
54
|
if (key.endsWith('_b')) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QueryServiceClient } from '@parca/client';
|
|
2
|
+
import { DateTimeRange } from '@parca/components';
|
|
3
|
+
import { QuerySelection } from '../ProfileSelector';
|
|
4
|
+
interface Props {
|
|
5
|
+
queryClient: QueryServiceClient;
|
|
6
|
+
selectQuery: (query: QuerySelection) => void;
|
|
7
|
+
enforcedProfileName: string;
|
|
8
|
+
timeRangeSelection: DateTimeRange;
|
|
9
|
+
querySelection: QuerySelection;
|
|
10
|
+
}
|
|
11
|
+
declare const QueryBrowser: ({ queryClient, enforcedProfileName, timeRangeSelection, selectQuery, querySelection, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default QueryBrowser;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Query } from '@parca/parser';
|
|
4
|
+
import MatchersInput from '../MatchersInput';
|
|
5
|
+
const QueryBrowser = ({ queryClient, enforcedProfileName, timeRangeSelection, selectQuery, querySelection, }) => {
|
|
6
|
+
const [queryExpressionString, setQueryExpressionString] = useState(querySelection.expression);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (enforcedProfileName !== '') {
|
|
9
|
+
const [q, changed] = Query.parse(querySelection.expression).setProfileName(enforcedProfileName);
|
|
10
|
+
if (changed) {
|
|
11
|
+
setQueryExpressionString(q.toString());
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
setQueryExpressionString(querySelection.expression);
|
|
16
|
+
}, [enforcedProfileName, querySelection.expression]);
|
|
17
|
+
const enforcedProfileNameQuery = () => {
|
|
18
|
+
const pq = Query.parse(queryExpressionString);
|
|
19
|
+
const [q] = pq.setProfileName(enforcedProfileName);
|
|
20
|
+
return q;
|
|
21
|
+
};
|
|
22
|
+
const setMatchersString = (matchers) => {
|
|
23
|
+
const newExpressionString = `${''}{${matchers}}`;
|
|
24
|
+
setQueryExpressionString(newExpressionString);
|
|
25
|
+
};
|
|
26
|
+
const setNewQueryExpression = (expr) => {
|
|
27
|
+
const query = enforcedProfileName !== '' ? enforcedProfileNameQuery() : Query.parse(expr);
|
|
28
|
+
const delta = query.profileType().delta;
|
|
29
|
+
const from = timeRangeSelection.getFromMs();
|
|
30
|
+
const to = timeRangeSelection.getToMs();
|
|
31
|
+
const mergeParams = delta
|
|
32
|
+
? {
|
|
33
|
+
mergeFrom: from,
|
|
34
|
+
mergeTo: to,
|
|
35
|
+
}
|
|
36
|
+
: {};
|
|
37
|
+
selectQuery({
|
|
38
|
+
expression: expr,
|
|
39
|
+
from,
|
|
40
|
+
to,
|
|
41
|
+
timeSelection: timeRangeSelection.getRangeKey(),
|
|
42
|
+
...mergeParams,
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const query = enforcedProfileName !== '' ? enforcedProfileNameQuery() : Query.parse(queryExpressionString);
|
|
46
|
+
const setQueryExpression = () => {
|
|
47
|
+
setNewQueryExpression(query.toString());
|
|
48
|
+
};
|
|
49
|
+
return (_jsx(_Fragment, { children: _jsx(MatchersInput, { queryClient: queryClient, setMatchersString: setMatchersString, runQuery: setQueryExpression, currentQuery: query }) }));
|
|
50
|
+
};
|
|
51
|
+
export default QueryBrowser;
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.335",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@parca/client": "^0.16.100",
|
|
7
|
-
"@parca/components": "^0.16.
|
|
7
|
+
"@parca/components": "^0.16.245",
|
|
8
8
|
"@parca/dynamicsize": "^0.16.60",
|
|
9
9
|
"@parca/hooks": "^0.0.38",
|
|
10
10
|
"@parca/parser": "^0.16.68",
|
|
11
|
-
"@parca/store": "^0.16.
|
|
12
|
-
"@parca/utilities": "^0.0.
|
|
11
|
+
"@parca/store": "^0.16.124",
|
|
12
|
+
"@parca/utilities": "^0.0.52",
|
|
13
13
|
"@tanstack/react-query": "^4.0.5",
|
|
14
14
|
"@types/react-beautiful-dnd": "^13.1.3",
|
|
15
15
|
"apache-arrow": "^12.0.0",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"access": "public",
|
|
51
51
|
"registry": "https://registry.npmjs.org/"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "fdf06a5203f54f1b5c7999520ae2f055f1f9dac7"
|
|
54
54
|
}
|
|
@@ -68,7 +68,19 @@ const filterSuffix = (
|
|
|
68
68
|
o: {[key: string]: string | string[] | undefined},
|
|
69
69
|
suffix: string
|
|
70
70
|
): {[key: string]: string | string[] | undefined} =>
|
|
71
|
-
Object.fromEntries(
|
|
71
|
+
Object.fromEntries(
|
|
72
|
+
Object.entries(o)
|
|
73
|
+
.filter(([key]) => !key.endsWith(suffix))
|
|
74
|
+
.map(([key, value]) => {
|
|
75
|
+
if (typeof value === 'string') {
|
|
76
|
+
return [key, encodeURIComponent(value)];
|
|
77
|
+
}
|
|
78
|
+
if (Array.isArray(value)) {
|
|
79
|
+
return [key, value.map(v => encodeURIComponent(v))];
|
|
80
|
+
}
|
|
81
|
+
return [key, value];
|
|
82
|
+
})
|
|
83
|
+
);
|
|
72
84
|
|
|
73
85
|
const swapQueryParameters = (o: {
|
|
74
86
|
[key: string]: string | string[] | undefined;
|