|
@@ -1,4 +1,4 @@
|
|
|
-import {useCallback, useMemo, useState} from 'react';
|
|
|
+import {useCallback, useMemo} from 'react';
|
|
|
import {browserHistory} from 'react-router';
|
|
|
import styled from '@emotion/styled';
|
|
|
import {Location} from 'history';
|
|
@@ -6,13 +6,12 @@ import {Location} from 'history';
|
|
|
import {CompactSelect} from 'sentry/components/compactSelect';
|
|
|
import * as Layout from 'sentry/components/layouts/thirds';
|
|
|
import Pagination from 'sentry/components/pagination';
|
|
|
-import {FunctionsTable} from 'sentry/components/profiling/functionsTable';
|
|
|
import {ProfileEventsTable} from 'sentry/components/profiling/profileEventsTable';
|
|
|
+import {SuspectFunctionsTable} from 'sentry/components/profiling/suspectFunctions/suspectFunctionsTable';
|
|
|
import {mobile} from 'sentry/data/platformCategories';
|
|
|
import {t} from 'sentry/locale';
|
|
|
import space from 'sentry/styles/space';
|
|
|
import {PageFilters, Project} from 'sentry/types';
|
|
|
-import {useFunctions} from 'sentry/utils/profiling/hooks/useFunctions';
|
|
|
import {
|
|
|
formatSort,
|
|
|
useProfileEvents,
|
|
@@ -20,8 +19,6 @@ import {
|
|
|
import {decodeScalar} from 'sentry/utils/queryString';
|
|
|
import {ProfileCharts} from 'sentry/views/profiling/landing/profileCharts';
|
|
|
|
|
|
-const FUNCTIONS_CURSOR_NAME = 'functionsCursor';
|
|
|
-
|
|
|
interface ProfileSummaryContentProps {
|
|
|
location: Location;
|
|
|
project: Project;
|
|
@@ -41,16 +38,6 @@ function ProfileSummaryContent(props: ProfileSummaryContentProps) {
|
|
|
[props.location.query.cursor]
|
|
|
);
|
|
|
|
|
|
- const functionsCursor = useMemo(
|
|
|
- () => decodeScalar(props.location.query.functionsCursor),
|
|
|
- [props.location.query.functionsCursor]
|
|
|
- );
|
|
|
-
|
|
|
- const functionsSort = useMemo(
|
|
|
- () => decodeScalar(props.location.query.functionsSort, '-p99'),
|
|
|
- [props.location.query.functionsSort]
|
|
|
- );
|
|
|
-
|
|
|
const sort = formatSort<ProfilingFieldType>(
|
|
|
decodeScalar(props.location.query.sort),
|
|
|
fields,
|
|
@@ -69,27 +56,6 @@ function ProfileSummaryContent(props: ProfileSummaryContentProps) {
|
|
|
referrer: 'api.profiling.profile-summary-table',
|
|
|
});
|
|
|
|
|
|
- const [functionType, setFunctionType] = useState<'application' | 'system' | 'all'>(
|
|
|
- 'application'
|
|
|
- );
|
|
|
-
|
|
|
- const functionsQuery = useFunctions({
|
|
|
- cursor: functionsCursor,
|
|
|
- project: props.project,
|
|
|
- query: '', // TODO: This doesnt support the same filters
|
|
|
- selection: props.selection,
|
|
|
- transaction: props.transaction,
|
|
|
- sort: functionsSort,
|
|
|
- functionType,
|
|
|
- });
|
|
|
-
|
|
|
- const handleFunctionsCursor = useCallback((cursor, pathname, query) => {
|
|
|
- browserHistory.push({
|
|
|
- pathname,
|
|
|
- query: {...query, [FUNCTIONS_CURSOR_NAME]: cursor},
|
|
|
- });
|
|
|
- }, []);
|
|
|
-
|
|
|
const handleFilterChange = useCallback(
|
|
|
value => {
|
|
|
browserHistory.push({
|
|
@@ -126,42 +92,10 @@ function ProfileSummaryContent(props: ProfileSummaryContentProps) {
|
|
|
isLoading={profiles.status === 'loading'}
|
|
|
sort={sort}
|
|
|
/>
|
|
|
- <TableHeader>
|
|
|
- <CompactSelect
|
|
|
- triggerProps={{prefix: t('Suspect Functions'), size: 'xs'}}
|
|
|
- value={functionType}
|
|
|
- options={[
|
|
|
- {
|
|
|
- label: t('All'),
|
|
|
- value: 'all' as const,
|
|
|
- },
|
|
|
- {
|
|
|
- label: t('Application'),
|
|
|
- value: 'application' as const,
|
|
|
- },
|
|
|
- {
|
|
|
- label: t('System'),
|
|
|
- value: 'system' as const,
|
|
|
- },
|
|
|
- ]}
|
|
|
- onChange={({value}) => setFunctionType(value)}
|
|
|
- />
|
|
|
- <StyledPagination
|
|
|
- pageLinks={
|
|
|
- functionsQuery.isFetched ? functionsQuery.data?.[0]?.pageLinks : null
|
|
|
- }
|
|
|
- onCursor={handleFunctionsCursor}
|
|
|
- size="xs"
|
|
|
- />
|
|
|
- </TableHeader>
|
|
|
- <FunctionsTable
|
|
|
- error={functionsQuery.isError ? functionsQuery.error.message : null}
|
|
|
- isLoading={functionsQuery.isLoading}
|
|
|
- functions={
|
|
|
- functionsQuery.isFetched ? functionsQuery.data?.[0].functions ?? [] : []
|
|
|
- }
|
|
|
+ <SuspectFunctionsTable
|
|
|
project={props.project}
|
|
|
- sort={functionsSort}
|
|
|
+ transaction={props.transaction}
|
|
|
+ analyticsPageSource="profiling_transaction"
|
|
|
/>
|
|
|
</Layout.Main>
|
|
|
);
|