@parca/profile 0.9.1 → 0.9.2
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 +4 -0
- package/package.json +2 -2
- package/src/ProfileView.tsx +19 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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.9.2](https://github.com/parca-dev/parca/compare/ui-v0.9.1...ui-v0.9.2) (2022-02-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
6
10
|
## [0.9.1](https://github.com/parca-dev/parca/compare/ui-v0.9.0...ui-v0.9.1) (2022-02-21)
|
|
7
11
|
|
|
8
12
|
## [0.8.2](https://github.com/parca-dev/parca/compare/ui-v0.8.1...ui-v0.8.2) (2022-02-14)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@parca/client": "^0.9.1",
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"access": "public",
|
|
20
20
|
"registry": "https://registry.npmjs.org/"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "544d4819ace2db4570e2780876108636860ff0d2"
|
|
23
23
|
}
|
package/src/ProfileView.tsx
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import React, {useEffect, useState} from 'react';
|
|
2
|
-
import {useRouter} from 'next/router';
|
|
3
|
-
|
|
4
2
|
import {CalcWidth} from '@parca/dynamicsize';
|
|
3
|
+
import {parseParams} from '@parca/functions';
|
|
4
|
+
import {QueryRequest, QueryResponse, QueryServiceClient, ServiceError} from '@parca/client';
|
|
5
|
+
import Button from '@parca/web/src/components/ui/Button';
|
|
6
|
+
import * as parca_query_v1alpha1_query_pb from '@parca/client/src/parca/query/v1alpha1/query_pb';
|
|
7
|
+
|
|
5
8
|
import ProfileIcicleGraph from './ProfileIcicleGraph';
|
|
6
9
|
import {ProfileSource} from './ProfileSource';
|
|
7
|
-
import {QueryRequest, QueryResponse, QueryServiceClient, ServiceError} from '@parca/client';
|
|
8
10
|
import Card from '../../../app/web/src/components/ui/Card';
|
|
9
|
-
import Button from '@parca/web/src/components/ui/Button';
|
|
10
11
|
import TopTable from './TopTable';
|
|
11
|
-
import * as parca_query_v1alpha1_query_pb from '@parca/client/src/parca/query/v1alpha1/query_pb';
|
|
12
12
|
|
|
13
13
|
import './ProfileView.styles.css';
|
|
14
14
|
|
|
15
|
+
type NavigateFunction = (path: string, queryParams: any) => void;
|
|
16
|
+
|
|
15
17
|
interface ProfileViewProps {
|
|
16
18
|
queryClient: QueryServiceClient;
|
|
17
19
|
profileSource: ProfileSource;
|
|
20
|
+
navigateTo?: NavigateFunction;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
export interface IQueryResult {
|
|
@@ -55,9 +58,13 @@ export const useQuery = (
|
|
|
55
58
|
return result;
|
|
56
59
|
};
|
|
57
60
|
|
|
58
|
-
export const ProfileView = ({
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
export const ProfileView = ({
|
|
62
|
+
queryClient,
|
|
63
|
+
profileSource,
|
|
64
|
+
navigateTo,
|
|
65
|
+
}: ProfileViewProps): JSX.Element => {
|
|
66
|
+
const router = parseParams(window.location.search);
|
|
67
|
+
const currentViewFromURL = router.currentProfileView as string;
|
|
61
68
|
const [curPath, setCurPath] = useState<string[]>([]);
|
|
62
69
|
const {response, error} = useQuery(queryClient, profileSource);
|
|
63
70
|
const [currentView, setCurrentView] = useState<string | undefined>(currentViewFromURL);
|
|
@@ -141,14 +148,12 @@ export const ProfileView = ({queryClient, profileSource}: ProfileViewProps): JSX
|
|
|
141
148
|
}
|
|
142
149
|
};
|
|
143
150
|
|
|
144
|
-
const queryParams = router.query;
|
|
145
|
-
|
|
146
151
|
const switchProfileView = (view: string) => {
|
|
152
|
+
if (!navigateTo) return;
|
|
153
|
+
|
|
147
154
|
setCurrentView(view);
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
query: {...queryParams, ...{currentProfileView: view}},
|
|
151
|
-
});
|
|
155
|
+
|
|
156
|
+
navigateTo('/', {...router, ...{currentProfileView: view}});
|
|
152
157
|
};
|
|
153
158
|
|
|
154
159
|
return (
|