Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface ComparisonMetric {
head: number;
icon: ReactNode;
key: string;
labelTooltip: string;
percentageChange: number;
title: string;
}
Expand All @@ -47,6 +48,7 @@ export function BuildComparisonMetricCards(props: BuildComparisonMetricCardsProp
key: 'install',
title: labels.installSizeLabel,
icon: <IconCode size="sm" />,
labelTooltip: labels.installSizeDescription,
head: size_metric_diff_item.head_install_size,
base: size_metric_diff_item.base_install_size,
diff:
Expand All @@ -63,6 +65,7 @@ export function BuildComparisonMetricCards(props: BuildComparisonMetricCardsProp
key: 'download',
title: labels.downloadSizeLabel,
icon: <IconDownload size="sm" />,
labelTooltip: labels.downloadSizeDescription,
head: size_metric_diff_item.head_download_size,
base: size_metric_diff_item.base_download_size,
diff:
Expand All @@ -88,7 +91,12 @@ export function BuildComparisonMetricCards(props: BuildComparisonMetricCardsProp
const {variant, icon} = getTrend(metric.diff);

return (
<MetricCard key={metric.key} icon={metric.icon} label={metric.title}>
<MetricCard
key={metric.key}
icon={metric.icon}
label={metric.title}
labelTooltip={metric.labelTooltip}
>
<Stack gap="xs">
<Flex align="end" gap="sm" wrap="wrap">
<Heading as="h3">{formatBytesBase10(metric.head)}</Heading>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type RequestError from 'sentry/utils/requestError/requestError';
import {useNavigate} from 'sentry/utils/useNavigate';
import useOrganization from 'sentry/utils/useOrganization';
import {useParams} from 'sentry/utils/useParams';
import {BuildComparisonMetricCards} from 'sentry/views/preprod/buildComparison/main/BuildComparisonMetricCards';
import {BuildComparisonMetricCards} from 'sentry/views/preprod/buildComparison/main/buildComparisonMetricCards';
import {SizeCompareItemDiffTable} from 'sentry/views/preprod/buildComparison/main/sizeCompareItemDiffTable';
import {SizeCompareSelectedBuilds} from 'sentry/views/preprod/buildComparison/main/sizeCompareSelectedBuilds';
import {BuildError} from 'sentry/views/preprod/components/buildError';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {useCallback} from 'react';
import {useSearchParams} from 'react-router-dom';
import styled from '@emotion/styled';

import {Alert} from '@sentry/scraps/alert';
Expand All @@ -13,6 +15,7 @@ import {t} from 'sentry/locale';
import type {UseApiQueryResult} from 'sentry/utils/queryClient';
import type RequestError from 'sentry/utils/requestError/requestError';
import {useQueryParamState} from 'sentry/utils/url/useQueryParamState';
import {BuildDetailsMetricCards} from 'sentry/views/preprod/buildDetails/main/buildDetailsMetricCards';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file name in commit has capital B (locally it's lower case B, not sure what's going on here)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I'm following this, all looks fine to me in the file diff.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait, I see the file change name, as long as everything renders locally with pnpm run dev-ui I think you should be fine

import {AppSizeInsights} from 'sentry/views/preprod/buildDetails/main/insights/appSizeInsights';
import {BuildError} from 'sentry/views/preprod/components/buildError';
import {BuildProcessing} from 'sentry/views/preprod/components/buildProcessing';
Expand Down Expand Up @@ -52,6 +55,12 @@ export function BuildDetailsMainContent(props: BuildDetailsMainContentProps) {
isError: isAppSizeError,
error: appSizeError,
} = appSizeQuery;
const [searchParams, setSearchParams] = useSearchParams();
const openInsightsSidebar = useCallback(() => {
const next = new URLSearchParams(searchParams);
next.set('insights', 'open');
setSearchParams(next);
}, [searchParams, setSearchParams]);

// If the main data fetch fails, this component will not be rendered
// so we don't handle 'isBuildDetailsError'.
Expand Down Expand Up @@ -107,13 +116,21 @@ export function BuildDetailsMainContent(props: BuildDetailsMainContentProps) {

if (isLoadingRequests) {
return (
<Stack gap="lg" width="100%">
<Flex width="100%" justify="between" align="center" gap="md">
<Placeholder width="92px" height="40px" />
<Placeholder style={{flex: 1}} height="40px" />
<Stack gap="xl" minHeight="700px" width="100%">
<Flex gap="lg" wrap="wrap">
<Placeholder style={{flex: 1}} height="100px" />
<Placeholder style={{flex: 1}} height="100px" />
<Placeholder style={{flex: 1}} height="100px" />
</Flex>
<Placeholder width="100%" height="540px" />
<Placeholder height="140px" />
<Stack gap="sm">
<Flex width="100%" justify="between" align="center" gap="md">
<Placeholder width="92px" height="40px" />
<Placeholder style={{flex: 1}} height="40px" />
</Flex>
<Placeholder width="100%" height="540px" />
<Placeholder height="140px" />
</Stack>
<Placeholder height="200px" />
</Stack>
);
}
Expand Down Expand Up @@ -204,7 +221,6 @@ export function BuildDetailsMainContent(props: BuildDetailsMainContentProps) {
appSizeData.insights && totalSize > 0
? processInsights(appSizeData.insights, totalSize)
: [];

const categoriesEnabled =
appSizeData.treemap.category_breakdown &&
Object.keys(appSizeData.treemap.category_breakdown).length > 0;
Expand Down Expand Up @@ -283,55 +299,63 @@ export function BuildDetailsMainContent(props: BuildDetailsMainContentProps) {
}

return (
<Flex direction="column" gap="sm" minHeight="700px" width="100%">
<Flex align="center" gap="md">
{categoriesEnabled && (
<SegmentedControl value={selectedContent} onChange={handleContentChange}>
<SegmentedControl.Item key="treemap" icon={<IconGrid />} />
<SegmentedControl.Item key="categories" icon={<IconGraphCircle />} />
</SegmentedControl>
)}
{selectedContent === 'treemap' && (
<InputGroup style={{flexGrow: 1}}>
<InputGroup.LeadingItems>
<IconSearch />
</InputGroup.LeadingItems>
<InputGroup.Input
placeholder="Search files"
value={searchQuery || ''}
onChange={e => setSearchQuery(e.target.value || undefined)}
/>
{searchQuery && (
<InputGroup.TrailingItems>
<Button
onClick={() => setSearchQuery(undefined)}
aria-label="Clear search"
borderless
size="zero"
>
<IconClose size="sm" />
</Button>
</InputGroup.TrailingItems>
)}
</InputGroup>
)}
</Flex>
<ChartContainer>{visualizationContent}</ChartContainer>
<Stack gap="xl" minHeight="700px" width="100%">
<BuildDetailsMetricCards
sizeInfo={sizeInfo}
processedInsights={processedInsights}
totalSize={totalSize}
platform={buildDetailsData?.app_info?.platform ?? null}
onOpenInsightsSidebar={openInsightsSidebar}
/>

<Stack gap="xl">
<Stack gap="sm">
<Flex align="center" gap="md">
{categoriesEnabled && (
<SegmentedControl value={selectedContent} onChange={handleContentChange}>
<SegmentedControl.Item key="treemap" icon={<IconGrid />} />
<SegmentedControl.Item key="categories" icon={<IconGraphCircle />} />
</SegmentedControl>
)}
{selectedContent === 'treemap' && (
<InputGroup style={{flexGrow: 1}}>
<InputGroup.LeadingItems>
<IconSearch />
</InputGroup.LeadingItems>
<InputGroup.Input
placeholder="Search files"
value={searchQuery || ''}
onChange={e => setSearchQuery(e.target.value || undefined)}
/>
{searchQuery && (
<InputGroup.TrailingItems>
<Button
onClick={() => setSearchQuery(undefined)}
aria-label="Clear search"
borderless
size="zero"
>
<IconClose size="sm" />
</Button>
</InputGroup.TrailingItems>
)}
</InputGroup>
)}
</Flex>
<ChartContainer>{visualizationContent}</ChartContainer>
{selectedContent === 'treemap' && appSizeData && (
<AppSizeLegend
root={appSizeData.treemap.root}
selectedCategories={selectedCategories}
onToggleCategory={handleToggleCategory}
/>
)}
<AppSizeInsights
processedInsights={processedInsights}
platform={validatedPlatform(buildDetailsData?.app_info?.platform)}
/>
</Stack>
</Flex>

<AppSizeInsights
processedInsights={processedInsights}
platform={validatedPlatform(buildDetailsData?.app_info?.platform)}
/>
</Stack>
);
}

Expand Down
Loading
Loading