|
@@ -2,6 +2,7 @@ import {Fragment} from 'react';
|
|
|
import {browserHistory} from 'react-router';
|
|
|
import styled from '@emotion/styled';
|
|
|
import {PlatformIcon} from 'platformicons';
|
|
|
+import {PLATFORM_TO_ICON} from 'platformicons/build/platformIcon';
|
|
|
|
|
|
import GridEditable, {
|
|
|
COL_WIDTH_UNDEFINED,
|
|
@@ -14,6 +15,7 @@ import {space} from 'sentry/styles/space';
|
|
|
import {decodeScalar} from 'sentry/utils/queryString';
|
|
|
import {useLocation} from 'sentry/utils/useLocation';
|
|
|
import {RESOURCE_THROUGHPUT_UNIT} from 'sentry/views/performance/browser/resources';
|
|
|
+import {FONT_FILE_EXTENSIONS} from 'sentry/views/performance/browser/resources/shared/constants';
|
|
|
import {ValidSort} from 'sentry/views/performance/browser/resources/utils/useResourceSort';
|
|
|
import {useResourcesQuery} from 'sentry/views/performance/browser/resources/utils/useResourcesQuery';
|
|
|
import {DurationCell} from 'sentry/views/starfish/components/tableCells/durationCell';
|
|
@@ -33,7 +35,6 @@ const {
|
|
|
HTTP_RESPONSE_CONTENT_LENGTH,
|
|
|
PROJECT_ID,
|
|
|
SPAN_GROUP,
|
|
|
- FILE_EXTENSION,
|
|
|
} = SpanMetricsField;
|
|
|
|
|
|
const {TIME_SPENT_PERCENTAGE} = SpanFunction;
|
|
@@ -103,22 +104,28 @@ function ResourceTable({sort, defaultResourceTypes}: Props) {
|
|
|
|
|
|
const renderBodyCell = (col: Column, row: Row) => {
|
|
|
const {key} = col;
|
|
|
- const getIcon = (spanOp: string, fileExtension: string) => {
|
|
|
+ const getIcon = (
|
|
|
+ spanOp: string,
|
|
|
+ fileExtension: string
|
|
|
+ ): keyof typeof PLATFORM_TO_ICON | 'unknown' => {
|
|
|
if (spanOp === 'resource.script') {
|
|
|
return 'javascript';
|
|
|
}
|
|
|
if (fileExtension === 'css') {
|
|
|
return 'css';
|
|
|
}
|
|
|
+ if (FONT_FILE_EXTENSIONS.includes(fileExtension)) {
|
|
|
+ return 'font';
|
|
|
+ }
|
|
|
return 'unknown';
|
|
|
};
|
|
|
|
|
|
if (key === SPAN_DESCRIPTION) {
|
|
|
+ const fileExtension = row[SPAN_DESCRIPTION].split('.').pop() || '';
|
|
|
+
|
|
|
return (
|
|
|
<DescriptionWrapper>
|
|
|
- <PlatformIcon
|
|
|
- platform={getIcon(row[SPAN_OP], row[FILE_EXTENSION]) || 'unknown'}
|
|
|
- />
|
|
|
+ <PlatformIcon platform={getIcon(row[SPAN_OP], fileExtension) || 'unknown'} />
|
|
|
<SpanDescriptionCell
|
|
|
moduleName={ModuleName.HTTP}
|
|
|
projectId={row[PROJECT_ID]}
|
|
@@ -146,7 +153,7 @@ function ResourceTable({sort, defaultResourceTypes}: Props) {
|
|
|
if (fileExtension === 'css') {
|
|
|
return <span>{t('Stylesheet')}</span>;
|
|
|
}
|
|
|
- if (['woff', 'woff2', 'ttf', 'otf', 'eot'].includes(fileExtension)) {
|
|
|
+ if (FONT_FILE_EXTENSIONS.includes(fileExtension)) {
|
|
|
return <span>{t('Font')}</span>;
|
|
|
}
|
|
|
return <span>{spanOp}</span>;
|