@parca/profile 0.12.12 → 0.12.20
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 +12 -0
- package/package.json +3 -3
- package/src/ProfileView.tsx +2 -1
- package/src/TopTable.tsx +33 -20
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.12.20](https://github.com/parca-dev/parca/compare/ui-v0.12.19...ui-v0.12.20) (2022-04-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
10
|
+
## [0.12.14](https://github.com/parca-dev/parca/compare/ui-v0.12.13...ui-v0.12.14) (2022-04-06)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @parca/profile
|
|
13
|
+
|
|
14
|
+
## [0.12.13](https://github.com/parca-dev/parca/compare/ui-v0.12.12...ui-v0.12.13) (2022-04-05)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @parca/profile
|
|
17
|
+
|
|
6
18
|
## [0.12.12](https://github.com/parca-dev/parca/compare/ui-v0.12.11...ui-v0.12.12) (2022-04-05)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @parca/profile
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.20",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@parca/client": "^0.12.
|
|
6
|
+
"@parca/client": "^0.12.20",
|
|
7
7
|
"@parca/dynamicsize": "^0.12.0",
|
|
8
8
|
"@parca/parser": "^0.12.3",
|
|
9
9
|
"d3-scale": "^4.0.2"
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"access": "public",
|
|
20
20
|
"registry": "https://registry.npmjs.org/"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "72da90d95cc53eda749dbb5dd6b2ea24fe2e6ca2"
|
|
23
23
|
}
|
package/src/ProfileView.tsx
CHANGED
|
@@ -17,6 +17,7 @@ interface ProfileViewProps {
|
|
|
17
17
|
queryClient: QueryServiceClient;
|
|
18
18
|
profileSource: ProfileSource;
|
|
19
19
|
navigateTo?: NavigateFunction;
|
|
20
|
+
compare?: boolean;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export interface IQueryResult {
|
|
@@ -235,7 +236,7 @@ export const ProfileView = ({
|
|
|
235
236
|
</div>
|
|
236
237
|
</div>
|
|
237
238
|
|
|
238
|
-
<div className="flex space-x-4">
|
|
239
|
+
<div className="flex space-x-4 justify-between">
|
|
239
240
|
{currentView === 'icicle' && (
|
|
240
241
|
<div className="w-full">
|
|
241
242
|
<CalcWidth throttle={300} delay={2000}>
|
package/src/TopTable.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import * as parca_query_v1alpha1_query_pb from '@parca/client/src/parca/query/v1alpha1/query_pb';
|
|
10
10
|
import {getLastItem, valueFormatter} from '@parca/functions';
|
|
11
11
|
import {useGrpcMetadata} from '@parca/components';
|
|
12
|
+
import {useAppSelector, selectCompareMode} from '@parca/store';
|
|
12
13
|
|
|
13
14
|
import {ProfileSource} from './ProfileSource';
|
|
14
15
|
import './TopTable.styles.css';
|
|
@@ -138,6 +139,8 @@ export const TopTable = ({queryClient, profileSource}: ProfileViewProps): JSX.El
|
|
|
138
139
|
const {response, error} = useQuery(queryClient, profileSource);
|
|
139
140
|
const {items, requestSort, sortConfig} = useSortableData(response);
|
|
140
141
|
|
|
142
|
+
const compareMode = useAppSelector(selectCompareMode);
|
|
143
|
+
|
|
141
144
|
const unit = response?.toObject().top?.unit as string;
|
|
142
145
|
|
|
143
146
|
if (error != null) {
|
|
@@ -154,10 +157,18 @@ export const TopTable = ({queryClient, profileSource}: ProfileViewProps): JSX.El
|
|
|
154
157
|
return sortConfig.key === name ? sortConfig.direction : undefined;
|
|
155
158
|
};
|
|
156
159
|
|
|
160
|
+
const addPlusSign = (num: string) => {
|
|
161
|
+
if (num.charAt(0) === '0' || num.charAt(0) === '-') {
|
|
162
|
+
return num;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return `+${num}`;
|
|
166
|
+
};
|
|
167
|
+
|
|
157
168
|
return (
|
|
158
169
|
<>
|
|
159
170
|
<div className="w-full">
|
|
160
|
-
<table className="iciclegraph-table table-
|
|
171
|
+
<table className="iciclegraph-table table-fixed text-left w-full divide-y divide-gray-200 dark:divide-gray-700">
|
|
161
172
|
<thead className="bg-gray-50 dark:bg-gray-800">
|
|
162
173
|
<tr>
|
|
163
174
|
<th
|
|
@@ -170,7 +181,7 @@ export const TopTable = ({queryClient, profileSource}: ProfileViewProps): JSX.El
|
|
|
170
181
|
</span>
|
|
171
182
|
</th>
|
|
172
183
|
<th
|
|
173
|
-
className="text-
|
|
184
|
+
className="text-right text-sm cursor-pointer pt-2 pb-2 w-[150px]"
|
|
174
185
|
onClick={() => requestSort('flat')}
|
|
175
186
|
>
|
|
176
187
|
Flat
|
|
@@ -179,7 +190,7 @@ export const TopTable = ({queryClient, profileSource}: ProfileViewProps): JSX.El
|
|
|
179
190
|
</span>
|
|
180
191
|
</th>
|
|
181
192
|
<th
|
|
182
|
-
className="text-right text-sm cursor-pointer pt-2 pb-2 pr-2"
|
|
193
|
+
className="text-right text-sm cursor-pointer pt-2 pb-2 pr-2 w-[150px]"
|
|
183
194
|
onClick={() => requestSort('cumulative')}
|
|
184
195
|
>
|
|
185
196
|
Cumulative
|
|
@@ -189,32 +200,34 @@ export const TopTable = ({queryClient, profileSource}: ProfileViewProps): JSX.El
|
|
|
189
200
|
<Arrow direction={getClassNamesFor('cumulative')} />
|
|
190
201
|
</span>
|
|
191
202
|
</th>
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
<
|
|
199
|
-
|
|
200
|
-
|
|
203
|
+
{compareMode && (
|
|
204
|
+
<th
|
|
205
|
+
className="text-right text-sm cursor-pointer pt-2 pb-2 pr-2 w-[150px]"
|
|
206
|
+
onClick={() => requestSort('diff')}
|
|
207
|
+
>
|
|
208
|
+
Diff
|
|
209
|
+
<span className={`inline-block align-middle ml-2 ${getClassNamesFor('diff')}`}>
|
|
210
|
+
<Arrow direction={getClassNamesFor('diff')} />
|
|
211
|
+
</span>
|
|
212
|
+
</th>
|
|
213
|
+
)}
|
|
201
214
|
</tr>
|
|
202
215
|
</thead>
|
|
203
216
|
<tbody className="bg-white divide-y divide-gray-200 dark:bg-gray-900 dark:divide-gray-700">
|
|
204
217
|
{items?.map((report, index) => (
|
|
205
218
|
<tr key={index} className="hover:bg-[#62626212] dark:hover:bg-[#ffffff12]">
|
|
206
|
-
<td className="text-xs py-1.5 pl-2
|
|
207
|
-
|
|
208
|
-
</td>
|
|
209
|
-
<td className="text-xs min-w-[150px] max-w-[150px] py-1.5 text-right">
|
|
219
|
+
<td className="text-xs py-1.5 pl-2">{RowLabel(report.meta)}</td>
|
|
220
|
+
<td className="text-xs py-1.5 text-right">
|
|
210
221
|
{valueFormatter(report.flat, unit, 2)}
|
|
211
222
|
</td>
|
|
212
|
-
<td className="text-xs
|
|
223
|
+
<td className="text-xs py-1.5 text-right pr-2">
|
|
213
224
|
{valueFormatter(report.cumulative, unit, 2)}
|
|
214
225
|
</td>
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
226
|
+
{compareMode && (
|
|
227
|
+
<td className="text-xs py-1.5 text-right pr-2">
|
|
228
|
+
{addPlusSign(valueFormatter(report.diff, unit, 2))}
|
|
229
|
+
</td>
|
|
230
|
+
)}
|
|
218
231
|
</tr>
|
|
219
232
|
))}
|
|
220
233
|
</tbody>
|