@parca/profile 0.16.49 → 0.16.50

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,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.16.50](https://github.com/parca-dev/parca/compare/ui-v0.16.49...ui-v0.16.50) (2022-10-18)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
6
10
  ## [0.16.49](https://github.com/parca-dev/parca/compare/ui-v0.16.48...ui-v0.16.49) (2022-10-17)
7
11
 
8
12
  **Note:** Version bump only for package @parca/profile
@@ -38,7 +38,7 @@ import { useState, useEffect } from 'react';
38
38
  import { usePopper } from 'react-popper';
39
39
  import { getLastItem, valueFormatter } from '@parca/functions';
40
40
  import useIsShiftDown from '@parca/components/src/hooks/useIsShiftDown';
41
- import { hexifyAddress } from '../';
41
+ import { hexifyAddress, truncateString } from '../';
42
42
  var virtualElement = {
43
43
  getBoundingClientRect: function () {
44
44
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
@@ -87,7 +87,7 @@ var TooltipMetaInfo = function (_a) {
87
87
  };
88
88
  return (_jsxs(_Fragment, { children: [((_b = hoveringNode.meta.function) === null || _b === void 0 ? void 0 : _b.filename) !== undefined &&
89
89
  ((_c = hoveringNode.meta.function) === null || _c === void 0 ? void 0 : _c.filename) !== '' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "File" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: getTextForFile(hoveringNode) }, { children: _jsx("button", __assign({ className: "cursor-pointer text-left" }, { children: getTextForFile(hoveringNode) })) })) }))] })), ((_d = hoveringNode.meta.location) === null || _d === void 0 ? void 0 : _d.address) !== undefined &&
90
- ((_e = hoveringNode.meta.location) === null || _e === void 0 ? void 0 : _e.address) !== '0' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Address" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: ' 0x' + hoveringNode.meta.location.address.toString() }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: ' 0x' + hoveringNode.meta.location.address.toString() })) })) }))] })), hoveringNode.meta.mapping !== undefined && hoveringNode.meta.mapping.file !== '' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Binary" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: hoveringNode.meta.mapping.file }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: getLastItem(hoveringNode.meta.mapping.file) })) })) }))] })), hoveringNode.meta.mapping !== undefined && hoveringNode.meta.mapping.buildId !== '' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Build Id" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: hoveringNode.meta.mapping.buildId }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: getLastItem(hoveringNode.meta.mapping.buildId) })) })) }))] }))] }));
90
+ ((_e = hoveringNode.meta.location) === null || _e === void 0 ? void 0 : _e.address) !== '0' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Address" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: ' 0x' + hoveringNode.meta.location.address.toString() }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: ' 0x' + hoveringNode.meta.location.address.toString() })) })) }))] })), hoveringNode.meta.mapping !== undefined && hoveringNode.meta.mapping.file !== '' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Binary" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: hoveringNode.meta.mapping.file }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: getLastItem(hoveringNode.meta.mapping.file) })) })) }))] })), hoveringNode.meta.mapping !== undefined && hoveringNode.meta.mapping.buildId !== '' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Build Id" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: hoveringNode.meta.mapping.buildId }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: truncateString(getLastItem(hoveringNode.meta.mapping.buildId), 16) })) })) }))] }))] }));
91
91
  };
92
92
  var timeoutHandle = null;
93
93
  var GraphTooltipContent = function (_a) {
package/dist/utils.d.ts CHANGED
@@ -2,3 +2,4 @@ import { QueryRequest, QueryServiceClient } from '@parca/client';
2
2
  import { RpcMetadata } from '@protobuf-ts/runtime-rpc';
3
3
  export declare const hexifyAddress: (address?: string) => string;
4
4
  export declare const downloadPprof: (request: QueryRequest, queryClient: QueryServiceClient, metadata: RpcMetadata) => Promise<Blob>;
5
+ export declare const truncateString: (str: string, num: number) => string;
package/dist/utils.js CHANGED
@@ -81,3 +81,9 @@ export var downloadPprof = function (request, queryClient, metadata) { return __
81
81
  }
82
82
  });
83
83
  }); };
84
+ export var truncateString = function (str, num) {
85
+ if (str.length <= num) {
86
+ return str;
87
+ }
88
+ return str.slice(0, num) + '...';
89
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.16.49",
3
+ "version": "0.16.50",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@iconify/react": "^3.2.2",
@@ -31,5 +31,5 @@
31
31
  "access": "public",
32
32
  "registry": "https://registry.npmjs.org/"
33
33
  },
34
- "gitHead": "2d1d93e9e75a15dfe18875acc6924f8f2e16206f"
34
+ "gitHead": "5d06484489b4317175c47ac3a6070d40e0ebae76"
35
35
  }
@@ -18,7 +18,7 @@ import {usePopper} from 'react-popper';
18
18
  import {CallgraphNode, FlamegraphNode, FlamegraphRootNode} from '@parca/client';
19
19
  import {getLastItem, valueFormatter} from '@parca/functions';
20
20
  import useIsShiftDown from '@parca/components/src/hooks/useIsShiftDown';
21
- import {hexifyAddress} from '../';
21
+ import {hexifyAddress, truncateString} from '../';
22
22
 
23
23
  interface GraphTooltipProps {
24
24
  x: number;
@@ -130,7 +130,7 @@ const TooltipMetaInfo = ({
130
130
  <td className="w-4/5 break-all">
131
131
  <CopyToClipboard onCopy={onCopy} text={hoveringNode.meta.mapping.buildId}>
132
132
  <button className="cursor-pointer">
133
- {getLastItem(hoveringNode.meta.mapping.buildId)}
133
+ {truncateString(getLastItem(hoveringNode.meta.mapping.buildId) as string, 16)}
134
134
  </button>
135
135
  </CopyToClipboard>
136
136
  </td>
package/src/utils.ts CHANGED
@@ -42,3 +42,11 @@ export const downloadPprof = async (
42
42
  const blob = new Blob([response.report.pprof], {type: 'application/octet-stream'});
43
43
  return blob;
44
44
  };
45
+
46
+ export const truncateString = (str: string, num: number): string => {
47
+ if (str.length <= num) {
48
+ return str;
49
+ }
50
+
51
+ return str.slice(0, num) + '...';
52
+ };