@parca/profile 0.12.34 → 0.13.0

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,22 @@
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.13.0](https://github.com/parca-dev/parca/compare/ui-v0.12.38...ui-v0.13.0) (2022-05-30)
7
+
8
+ ### Features
9
+
10
+ - useContainerDimensions hook for smooth chart resize ([3fe5670](https://github.com/parca-dev/parca/commit/3fe5670cb94e838d83e5cb10d453ee620c2dc3c1))
11
+
12
+ ## [0.12.36](https://github.com/parca-dev/parca/compare/ui-v0.12.35...ui-v0.12.36) (2022-05-06)
13
+
14
+ ## [0.12.36](https://github.com/parca-dev/parca/compare/ui-v0.12.35...ui-v0.12.36) (2022-05-06)
15
+
16
+ **Note:** Version bump only for package @parca/profile
17
+
18
+ ## 0.12.35 (2022-05-05)
19
+
20
+ **Note:** Version bump only for package @parca/profile
21
+
6
22
  ## [0.12.34](https://github.com/parca-dev/parca/compare/ui-v0.12.33...ui-v0.12.34) (2022-05-03)
7
23
 
8
24
  ## 0.12.31 (2022-05-02)
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.12.34",
3
+ "version": "0.13.0",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
- "@parca/client": "^0.12.30",
7
- "@parca/dynamicsize": "^0.12.0",
8
- "@parca/parser": "^0.12.26",
6
+ "@parca/client": "^0.13.0",
7
+ "@parca/dynamicsize": "^0.13.0",
8
+ "@parca/parser": "^0.13.0",
9
9
  "d3-scale": "^4.0.2"
10
10
  },
11
11
  "main": "src/index.tsx",
@@ -19,5 +19,5 @@
19
19
  "access": "public",
20
20
  "registry": "https://registry.npmjs.org/"
21
21
  },
22
- "gitHead": "e9d030a10251daf653a0ff0c79e4b41b924606d7"
22
+ "gitHead": "4d00bb1f08c62bc8c33285f6844a0a4386f31442"
23
23
  }
@@ -521,9 +521,9 @@ export default function IcicleGraph({
521
521
  />
522
522
  <svg
523
523
  className="font-robotoMono"
524
- width={width}
525
- height={height}
526
524
  onMouseMove={onMouseMove}
525
+ viewBox={`0 0 ${width} ${height}`}
526
+ preserveAspectRatio="xMinYMid"
527
527
  ref={svg}
528
528
  >
529
529
  <g ref={ref}>
@@ -1,5 +1,6 @@
1
1
  import {Flamegraph} from '@parca/client';
2
2
  import {useAppSelector, selectCompareMode} from '@parca/store';
3
+ import {useContainerDimensions} from '@parca/dynamicsize';
3
4
 
4
5
  import DiffLegend from './components/DiffLegend';
5
6
  import IcicleGraph from './IcicleGraph';
@@ -13,7 +14,6 @@ interface ProfileIcicleGraphProps {
13
14
  }
14
15
 
15
16
  const ProfileIcicleGraph = ({
16
- width,
17
17
  graph,
18
18
  curPath,
19
19
  setNewCurPath,
@@ -25,16 +25,20 @@ const ProfileIcicleGraph = ({
25
25
  const total = graph.total;
26
26
  if (parseFloat(total) === 0) return <>Profile has no samples</>;
27
27
 
28
+ const {ref, dimensions} = useContainerDimensions();
29
+
28
30
  return (
29
31
  <>
30
32
  {compareMode && <DiffLegend />}
31
- <IcicleGraph
32
- width={width}
33
- graph={graph}
34
- curPath={curPath}
35
- setCurPath={setNewCurPath}
36
- sampleUnit={sampleUnit}
37
- />
33
+ <div ref={ref}>
34
+ <IcicleGraph
35
+ width={dimensions?.width}
36
+ graph={graph}
37
+ curPath={curPath}
38
+ setCurPath={setNewCurPath}
39
+ sampleUnit={sampleUnit}
40
+ />
41
+ </div>
38
42
  </>
39
43
  );
40
44
  };
@@ -1,10 +1,7 @@
1
1
  import React, {useEffect, useState} from 'react';
2
- import {CalcWidth} from '@parca/dynamicsize';
3
2
  import {parseParams} from '@parca/functions';
4
- import {QueryServiceClient, QueryResponse, QueryRequest_ReportType} from '@parca/client';
5
- import {RpcError} from '@protobuf-ts/runtime-rpc';
6
- import {Button, Card, useGrpcMetadata} from '@parca/components';
7
- import * as parca_query_v1alpha1_query_pb from '@parca/client/src/parca/query/v1alpha1/query_pb';
3
+ import {QueryServiceClient, QueryRequest_ReportType} from '@parca/client';
4
+ import {Button, Card, useGrpcMetadata, useParcaTheme} from '@parca/components';
8
5
 
9
6
  import ProfileIcicleGraph from './ProfileIcicleGraph';
10
7
  import {ProfileSource} from './ProfileSource';
@@ -47,6 +44,7 @@ export const ProfileView = ({
47
44
  );
48
45
  const [currentView, setCurrentView] = useState<string | undefined>(currentViewFromURL);
49
46
  const metadata = useGrpcMetadata();
47
+ const {loader} = useParcaTheme();
50
48
 
51
49
  useEffect(() => {
52
50
  let showLoaderTimeout;
@@ -62,39 +60,7 @@ export const ProfileView = ({
62
60
  }, [isLoading]);
63
61
 
64
62
  if (isLoaderVisible) {
65
- return (
66
- <div
67
- style={{
68
- display: 'flex',
69
- justifyContent: 'center',
70
- alignItems: 'center',
71
- height: 'inherit',
72
- marginTop: 100,
73
- }}
74
- >
75
- <svg
76
- className="animate-spin -ml-1 mr-3 h-5 w-5"
77
- xmlns="http://www.w3.org/2000/svg"
78
- fill="none"
79
- viewBox="0 0 24 24"
80
- >
81
- <circle
82
- className="opacity-25"
83
- cx="12"
84
- cy="12"
85
- r="10"
86
- stroke="currentColor"
87
- strokeWidth="4"
88
- ></circle>
89
- <path
90
- className="opacity-75"
91
- fill="currentColor"
92
- d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
93
- ></path>
94
- </svg>
95
- <span>Loading...</span>
96
- </div>
97
- );
63
+ return <>{loader}</>;
98
64
  }
99
65
 
100
66
  if (error !== null) {
@@ -203,14 +169,12 @@ export const ProfileView = ({
203
169
  response !== null &&
204
170
  response.report.oneofKind === 'flamegraph' && (
205
171
  <div className="w-full">
206
- <CalcWidth throttle={300} delay={2000}>
207
- <ProfileIcicleGraph
208
- curPath={curPath}
209
- setNewCurPath={setNewCurPath}
210
- graph={response.report.flamegraph}
211
- sampleUnit={sampleUnit}
212
- />
213
- </CalcWidth>
172
+ <ProfileIcicleGraph
173
+ curPath={curPath}
174
+ setNewCurPath={setNewCurPath}
175
+ graph={response.report.flamegraph}
176
+ sampleUnit={sampleUnit}
177
+ />
214
178
  </div>
215
179
  )}
216
180
 
@@ -235,18 +199,16 @@ export const ProfileView = ({
235
199
  </div>
236
200
 
237
201
  <div className="w-1/2">
238
- <CalcWidth throttle={300} delay={2000}>
239
- <ProfileIcicleGraph
240
- curPath={curPath}
241
- setNewCurPath={setNewCurPath}
242
- graph={
243
- response?.report.oneofKind === 'flamegraph'
244
- ? response.report.flamegraph
245
- : undefined
246
- }
247
- sampleUnit={sampleUnit}
248
- />
249
- </CalcWidth>
202
+ <ProfileIcicleGraph
203
+ curPath={curPath}
204
+ setNewCurPath={setNewCurPath}
205
+ graph={
206
+ response?.report.oneofKind === 'flamegraph'
207
+ ? response.report.flamegraph
208
+ : undefined
209
+ }
210
+ sampleUnit={sampleUnit}
211
+ />
250
212
  </div>
251
213
  </>
252
214
  )}