Skip to content

Commit

Permalink
feat: disable sandwich view for diff page (#1693)
Browse files Browse the repository at this point in the history
* feat: hide sandwich view for diff page

* fix lint
  • Loading branch information
dogfrogfog authored Nov 9, 2022
1 parent d02a1e7 commit b47b441
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions packages/pyroscope-flamegraph/src/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ const Toolbar = React.memo(
/>
{!disableChangingDisplay && (
<ViewSection
flamegraphType={flamegraphType}
showMode={showMode}
view={view}
updateView={updateView}
Expand Down Expand Up @@ -387,10 +388,12 @@ function ViewSection({
view,
updateView,
showMode,
flamegraphType,
}: {
showMode: ReturnType<typeof useSizeMode>;
updateView: ProfileHeaderProps['updateView'];
view: ProfileHeaderProps['view'];
flamegraphType: ProfileHeaderProps['flamegraphType'];
}) {
const ViewSelect = (
<Select
Expand All @@ -404,7 +407,11 @@ function ViewSection({
<option value="table">Table</option>
<option value="both">Both</option>
<option value="flamegraph">Flame</option>
<option value="sandwich">Sandwich</option>
{flamegraphType === 'single' ? (
<option value="sandwich">Sandwich</option>
) : (
(null as ShamefulAny)
)}
</Select>
);

Expand Down Expand Up @@ -441,14 +448,16 @@ function ViewSection({
>
Flamegraph
</Button>
<Button
grouped
kind={kindByState('sandwich')}
iconNode={<SandwichIcon />}
onClick={() => updateView('sandwich')}
>
Sandwich
</Button>
{flamegraphType === 'single' ? (
<Button
grouped
kind={kindByState('sandwich')}
iconNode={<SandwichIcon />}
onClick={() => updateView('sandwich')}
>
Sandwich
</Button>
) : null}
</>
);

Expand Down

0 comments on commit b47b441

Please sign in to comment.