@parca/profile 0.16.237 → 0.16.239
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/Callgraph/index.js +2 -2
- package/dist/MetricsGraph/index.js +4 -4
- package/dist/ProfileExplorer/ProfileExplorerCompare.js +1 -1
- package/dist/ProfileExplorer/ProfileExplorerSingle.js +1 -1
- package/dist/ProfileIcicleGraph/index.js +2 -2
- package/dist/ProfileView/index.js +3 -1
- package/dist/SourceView/Highlighter.d.ts +2 -2
- package/dist/SourceView/Highlighter.js +9 -3
- package/dist/SourceView/index.js +1 -1
- package/dist/SourceView/lang-detector/ext-to-lang.json +800 -0
- package/dist/SourceView/lang-detector/index.d.ts +1 -0
- package/dist/SourceView/lang-detector/index.js +29 -0
- package/dist/Table/index.js +3 -3
- package/dist/TopTable/index.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/src/Callgraph/index.tsx +2 -1
- package/src/MetricsGraph/index.tsx +5 -5
- package/src/ProfileExplorer/ProfileExplorerCompare.tsx +11 -13
- package/src/ProfileExplorer/ProfileExplorerSingle.tsx +8 -10
- package/src/ProfileIcicleGraph/index.tsx +4 -2
- package/src/ProfileView/index.tsx +4 -2
- package/src/SourceView/Highlighter.tsx +16 -4
- package/src/SourceView/index.tsx +1 -0
- package/src/SourceView/lang-detector/ext-to-lang.json +800 -0
- package/src/SourceView/lang-detector/index.ts +33 -0
- package/src/Table/index.tsx +3 -3
- package/src/TopTable/index.tsx +2 -1
- package/typings.d.ts +1 -0
|
@@ -0,0 +1,33 @@
|
|
|
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 * as hljsLangs from 'react-syntax-highlighter/dist/esm/languages/hljs';
|
|
15
|
+
|
|
16
|
+
import _extLangMap from './ext-to-lang.json';
|
|
17
|
+
|
|
18
|
+
const extLangMap = _extLangMap as Record<string, string[]>;
|
|
19
|
+
|
|
20
|
+
export const langaugeFromFile = (file: string): string => {
|
|
21
|
+
const extension = file.split('.').pop() ?? '';
|
|
22
|
+
if (extLangMap[extension] == null) {
|
|
23
|
+
return 'text';
|
|
24
|
+
}
|
|
25
|
+
const langs: string[] = extLangMap[extension];
|
|
26
|
+
for (const lang of langs) {
|
|
27
|
+
// eslint-disable-next-line import/namespace
|
|
28
|
+
if (hljsLangs[lang] != null) {
|
|
29
|
+
return lang;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return 'text';
|
|
33
|
+
};
|
package/src/Table/index.tsx
CHANGED
|
@@ -206,8 +206,8 @@ export const Table = React.memo(function Table({
|
|
|
206
206
|
};
|
|
207
207
|
}, [compareMode]);
|
|
208
208
|
|
|
209
|
-
if (loading) return
|
|
210
|
-
if (data === undefined) return
|
|
209
|
+
if (loading) return <div className="mx-auto text-center">Loading...</div>;
|
|
210
|
+
if (data === undefined) return <div className="mx-auto text-center">Profile has no samples</div>;
|
|
211
211
|
|
|
212
212
|
const table = tableFromIPC(data);
|
|
213
213
|
const flatColumn = table.getChild('flat');
|
|
@@ -215,7 +215,7 @@ export const Table = React.memo(function Table({
|
|
|
215
215
|
const cumulativeColumn = table.getChild('cumulative');
|
|
216
216
|
const cumulativeDiffColumn = table.getChild('cumulative_diff');
|
|
217
217
|
|
|
218
|
-
if (table.numRows === 0) return
|
|
218
|
+
if (table.numRows === 0) return <div className="mx-auto text-center">Profile has no samples</div>;
|
|
219
219
|
|
|
220
220
|
const rows: row[] = [];
|
|
221
221
|
// TODO: Figure out how to only read the data of the columns we need for the virtualized table
|
package/src/TopTable/index.tsx
CHANGED
|
@@ -222,7 +222,8 @@ export const TopTable = React.memo(function TopTable({
|
|
|
222
222
|
|
|
223
223
|
const total = top != null ? top.list.length : 0;
|
|
224
224
|
|
|
225
|
-
if (total === 0 && !loading)
|
|
225
|
+
if (total === 0 && !loading)
|
|
226
|
+
return <div className="mx-auto text-center">Profile has no samples</div>;
|
|
226
227
|
|
|
227
228
|
return (
|
|
228
229
|
<div className="relative">
|
package/typings.d.ts
CHANGED