|
@@ -1,7 +1,6 @@
|
|
|
import styled from '@emotion/styled';
|
|
|
|
|
|
-import {Button} from 'sentry/components/button';
|
|
|
-import ButtonBar from 'sentry/components/buttonBar';
|
|
|
+import {SegmentedControl} from 'sentry/components/segmentedControl';
|
|
|
import {t} from 'sentry/locale';
|
|
|
import space from 'sentry/styles/space';
|
|
|
import {
|
|
@@ -46,78 +45,62 @@ const CrashActions = ({
|
|
|
? false
|
|
|
: !!exception?.values?.find(value => value.rawStacktrace) || !!thread?.rawStacktrace;
|
|
|
|
|
|
- const notify = (options: NotifyOptions) => {
|
|
|
- if (onChange) {
|
|
|
- onChange(options);
|
|
|
- }
|
|
|
+ const setStackType = (type: STACK_TYPE) => {
|
|
|
+ onChange?.({stackType: type});
|
|
|
};
|
|
|
|
|
|
- const setStackType = (type: STACK_TYPE) => () => {
|
|
|
- notify({stackType: type});
|
|
|
+ const setStackView = (view: STACK_VIEW) => {
|
|
|
+ onChange?.({stackView: view});
|
|
|
};
|
|
|
-
|
|
|
- const setStackView = (view: STACK_VIEW) => () => {
|
|
|
- notify({stackView: view});
|
|
|
- };
|
|
|
-
|
|
|
- const getOriginalButtonLabel = () => {
|
|
|
- if (platform === 'javascript' || platform === 'node') {
|
|
|
- return t('Original');
|
|
|
- }
|
|
|
-
|
|
|
- return t('Symbolicated');
|
|
|
- };
|
|
|
-
|
|
|
- const getMinifiedButtonLabel = () => {
|
|
|
- if (platform === 'javascript' || platform === 'node') {
|
|
|
- return t('Minified');
|
|
|
- }
|
|
|
- return t('Unsymbolicated');
|
|
|
- };
|
|
|
-
|
|
|
return (
|
|
|
<ButtonGroupWrapper>
|
|
|
- <ButtonBar active={stackView} merged>
|
|
|
- {hasSystemFrames && (
|
|
|
- <Button
|
|
|
- barId={STACK_VIEW.APP}
|
|
|
- size="xs"
|
|
|
- onClick={setStackView(STACK_VIEW.APP)}
|
|
|
- title={
|
|
|
- hasHierarchicalGrouping
|
|
|
- ? t(
|
|
|
- 'The stack trace only shows application frames and frames responsible for grouping this issue'
|
|
|
- )
|
|
|
- : undefined
|
|
|
- }
|
|
|
- >
|
|
|
- {hasHierarchicalGrouping ? t('Most Relevant') : t('App Only')}
|
|
|
- </Button>
|
|
|
- )}
|
|
|
- <Button barId={STACK_VIEW.FULL} size="xs" onClick={setStackView(STACK_VIEW.FULL)}>
|
|
|
- {t('Full')}
|
|
|
- </Button>
|
|
|
- <Button barId={STACK_VIEW.RAW} onClick={setStackView(STACK_VIEW.RAW)} size="xs">
|
|
|
- {t('Raw')}
|
|
|
- </Button>
|
|
|
- </ButtonBar>
|
|
|
+ <SegmentedControl
|
|
|
+ aria-label={t('View')}
|
|
|
+ size="xs"
|
|
|
+ value={stackView}
|
|
|
+ onChange={setStackView}
|
|
|
+ >
|
|
|
+ {[
|
|
|
+ ...(hasSystemFrames
|
|
|
+ ? [
|
|
|
+ <SegmentedControl.Item
|
|
|
+ key={STACK_VIEW.APP}
|
|
|
+ tooltip={
|
|
|
+ hasHierarchicalGrouping &&
|
|
|
+ t(
|
|
|
+ 'The stack trace only shows application frames and frames responsible for grouping this issue'
|
|
|
+ )
|
|
|
+ }
|
|
|
+ >
|
|
|
+ {hasHierarchicalGrouping ? t('Most Relevant') : t('App Only')}
|
|
|
+ </SegmentedControl.Item>,
|
|
|
+ ]
|
|
|
+ : []),
|
|
|
+ <SegmentedControl.Item key={STACK_VIEW.FULL}>
|
|
|
+ {t('Full')}
|
|
|
+ </SegmentedControl.Item>,
|
|
|
+ <SegmentedControl.Item key={STACK_VIEW.RAW}>{t('Raw')}</SegmentedControl.Item>,
|
|
|
+ ]}
|
|
|
+ </SegmentedControl>
|
|
|
+
|
|
|
{hasMinified && (
|
|
|
- <ButtonBar active={stackType} merged>
|
|
|
- <Button
|
|
|
- barId={STACK_TYPE.ORIGINAL}
|
|
|
- size="xs"
|
|
|
- onClick={setStackType(STACK_TYPE.ORIGINAL)}
|
|
|
- >
|
|
|
- {getOriginalButtonLabel()}
|
|
|
- </Button>
|
|
|
- <Button
|
|
|
- barId={STACK_TYPE.MINIFIED}
|
|
|
- size="xs"
|
|
|
- onClick={setStackType(STACK_TYPE.MINIFIED)}
|
|
|
- >
|
|
|
- {getMinifiedButtonLabel()}
|
|
|
- </Button>
|
|
|
- </ButtonBar>
|
|
|
+ <SegmentedControl
|
|
|
+ aria-label={t('Type')}
|
|
|
+ size="xs"
|
|
|
+ value={stackType}
|
|
|
+ onChange={setStackType}
|
|
|
+ >
|
|
|
+ <SegmentedControl.Item key={STACK_TYPE.ORIGINAL}>
|
|
|
+ {platform === 'javascript' || platform === 'node'
|
|
|
+ ? t('Original')
|
|
|
+ : t('Symbolicated')}
|
|
|
+ </SegmentedControl.Item>
|
|
|
+ <SegmentedControl.Item key={STACK_TYPE.MINIFIED}>
|
|
|
+ {platform === 'javascript' || platform === 'node'
|
|
|
+ ? t('Minified')
|
|
|
+ : t('Unsymbolicated')}
|
|
|
+ </SegmentedControl.Item>
|
|
|
+ </SegmentedControl>
|
|
|
)}
|
|
|
</ButtonGroupWrapper>
|
|
|
);
|
|
@@ -126,12 +109,7 @@ const CrashActions = ({
|
|
|
export default CrashActions;
|
|
|
|
|
|
const ButtonGroupWrapper = styled('div')`
|
|
|
- display: flex;
|
|
|
- flex-wrap: wrap;
|
|
|
- > * {
|
|
|
- padding: ${space(0.5)} 0;
|
|
|
- }
|
|
|
- > *:not(:last-child) {
|
|
|
- margin-right: ${space(1)};
|
|
|
- }
|
|
|
+ display: grid;
|
|
|
+ grid-auto-flow: column;
|
|
|
+ gap: ${space(1)};
|
|
|
`;
|