@parca/profile 0.16.412 → 0.16.414
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 +8 -0
- package/dist/MatchersInput/index.d.ts.map +1 -1
- package/dist/MatchersInput/index.js +22 -22
- package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts.map +1 -1
- package/dist/ProfileExplorer/ProfileExplorerCompare.js +1 -1
- package/dist/ProfileExplorer/ProfileExplorerSingle.d.ts.map +1 -1
- package/dist/ProfileExplorer/ProfileExplorerSingle.js +1 -1
- package/dist/ProfileExplorer/index.d.ts.map +1 -1
- package/dist/ProfileExplorer/index.js +3 -1
- package/dist/ProfileMetricsGraph/index.d.ts +4 -3
- package/dist/ProfileMetricsGraph/index.d.ts.map +1 -1
- package/dist/ProfileMetricsGraph/index.js +9 -23
- package/dist/ProfileSelector/index.d.ts +3 -1
- package/dist/ProfileSelector/index.d.ts.map +1 -1
- package/dist/ProfileSelector/index.js +39 -6
- package/dist/ProfileSelector/useAutoQuerySelector.d.ts.map +1 -1
- package/dist/ProfileSelector/useAutoQuerySelector.js +6 -0
- package/dist/styles.css +1 -1
- package/dist/useGrpcQuery/index.d.ts +2 -1
- package/dist/useGrpcQuery/index.d.ts.map +1 -1
- package/dist/useGrpcQuery/index.js +2 -1
- package/dist/useSumBy.d.ts +11 -0
- package/dist/useSumBy.d.ts.map +1 -0
- package/dist/{ProfileMetricsGraph/useSumBy.js → useSumBy.js} +13 -12
- package/package.json +2 -2
- package/src/MatchersInput/index.tsx +23 -25
- package/src/ProfileExplorer/ProfileExplorerCompare.tsx +2 -0
- package/src/ProfileExplorer/ProfileExplorerSingle.tsx +1 -0
- package/src/ProfileExplorer/index.tsx +4 -0
- package/src/ProfileMetricsGraph/index.tsx +8 -42
- package/src/ProfileSelector/index.tsx +78 -4
- package/src/ProfileSelector/useAutoQuerySelector.ts +9 -1
- package/src/useGrpcQuery/index.ts +3 -1
- package/src/{ProfileMetricsGraph/useSumBy.ts → useSumBy.ts} +29 -16
- package/dist/ProfileMetricsGraph/Toolbar/index.d.ts +0 -9
- package/dist/ProfileMetricsGraph/Toolbar/index.d.ts.map +0 -1
- package/dist/ProfileMetricsGraph/Toolbar/index.js +0 -29
- package/dist/ProfileMetricsGraph/useSumBy.d.ts +0 -4
- package/dist/ProfileMetricsGraph/useSumBy.d.ts.map +0 -1
- package/src/ProfileMetricsGraph/Toolbar/index.tsx +0 -94
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
// Copyright 2022 The Parca Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
|
|
14
|
-
import {ReactNode, useId, useMemo, useState} from 'react';
|
|
15
|
-
|
|
16
|
-
import {Icon} from '@iconify/react';
|
|
17
|
-
import Draggable from 'react-draggable';
|
|
18
|
-
import Select from 'react-select';
|
|
19
|
-
|
|
20
|
-
import {IconButton} from '@parca/components';
|
|
21
|
-
|
|
22
|
-
interface Props {
|
|
23
|
-
sumBy: string[];
|
|
24
|
-
setSumBy: (sumBy: string[]) => void;
|
|
25
|
-
labels: string[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const Toolbar = ({sumBy, setSumBy, labels}: Props): ReactNode => {
|
|
29
|
-
const [collapsed, setCollapsed] = useState<boolean>(false);
|
|
30
|
-
const [isDragging, setIsDragging] = useState<boolean>(false);
|
|
31
|
-
const idWithColon = useId();
|
|
32
|
-
const id = useMemo(() => idWithColon.replace(/[^a-zA-Z0-9]/g, ''), [idWithColon]);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<Draggable
|
|
36
|
-
handle={`#${id}`}
|
|
37
|
-
onStart={() => setIsDragging(true)}
|
|
38
|
-
onStop={() => setIsDragging(false)}
|
|
39
|
-
bounds="parent"
|
|
40
|
-
defaultPosition={{x: 96, y: 4}}
|
|
41
|
-
>
|
|
42
|
-
<div className="absolute rounded-full bg-gray-100 dark:bg-gray-800 z-10 text-xs">
|
|
43
|
-
<div className="flex items-center h-14 gap-4 py-1 px-3">
|
|
44
|
-
<Icon
|
|
45
|
-
icon="radix-icons:drag-handle-dots-2"
|
|
46
|
-
height={20}
|
|
47
|
-
className={isDragging ? 'cursor-grabbing' : 'cursor-grab'}
|
|
48
|
-
id={id}
|
|
49
|
-
/>
|
|
50
|
-
{!collapsed ? (
|
|
51
|
-
<div className="flex gap-2 items-center mr-4">
|
|
52
|
-
<span>Sum by</span>
|
|
53
|
-
<Select
|
|
54
|
-
defaultValue={[]}
|
|
55
|
-
isMulti
|
|
56
|
-
name="colors"
|
|
57
|
-
options={labels.map(label => ({label, value: label}))}
|
|
58
|
-
className="parca-select-container min-w-60"
|
|
59
|
-
classNamePrefix="parca-select"
|
|
60
|
-
value={sumBy.map(sumBy => ({label: sumBy, value: sumBy}))}
|
|
61
|
-
onChange={selectedOptions => {
|
|
62
|
-
setSumBy(selectedOptions.map(option => option.value));
|
|
63
|
-
}}
|
|
64
|
-
placeholder="Labels..."
|
|
65
|
-
styles={{
|
|
66
|
-
indicatorSeparator: () => ({display: 'none'}),
|
|
67
|
-
}}
|
|
68
|
-
/>
|
|
69
|
-
</div>
|
|
70
|
-
) : null}
|
|
71
|
-
<div className="relative">
|
|
72
|
-
<IconButton
|
|
73
|
-
icon={
|
|
74
|
-
<Icon
|
|
75
|
-
icon={
|
|
76
|
-
collapsed ? 'iconamoon:arrow-right-2-light' : 'iconamoon:arrow-left-2-light'
|
|
77
|
-
}
|
|
78
|
-
height={24}
|
|
79
|
-
/>
|
|
80
|
-
}
|
|
81
|
-
onClick={() => setCollapsed(!collapsed)}
|
|
82
|
-
className="hover:bg-gray-200 dark:hover:bg-gray-700 rounded-full p-1"
|
|
83
|
-
/>
|
|
84
|
-
{collapsed && sumBy.length > 0 ? (
|
|
85
|
-
<div className="rounded-full bg-indigo-600 dark:bg-indigo-500 absolute text-xs h-4 w-4 flex items-center justify-center -top-3 -right-3 text-white text-[10px]">
|
|
86
|
-
{sumBy.length}
|
|
87
|
-
</div>
|
|
88
|
-
) : null}
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
</div>
|
|
92
|
-
</Draggable>
|
|
93
|
-
);
|
|
94
|
-
};
|