Skip to content

Commit

Permalink
feat(issues): Split group statusDetails by status (#54128)
Browse files Browse the repository at this point in the history
  • Loading branch information
scttcper authored Aug 4, 2023
1 parent 388b444 commit de9c3ac
Show file tree
Hide file tree
Showing 21 changed files with 139 additions and 130 deletions.
6 changes: 3 additions & 3 deletions static/app/components/actions/archive.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from 'sentry-test/reactTestingLibrary';

import ArchiveActions from 'sentry/components/actions/archive';
import {ResolutionStatus} from 'sentry/types';
import {GroupStatus} from 'sentry/types';

describe('ArchiveActions', () => {
const onUpdate = jest.fn();
Expand All @@ -18,7 +18,7 @@ describe('ArchiveActions', () => {
render(<ArchiveActions onUpdate={onUpdate} />);
await userEvent.click(screen.getByRole('button', {name: 'Archive'}));
expect(onUpdate).toHaveBeenCalledWith({
status: ResolutionStatus.IGNORED,
status: GroupStatus.IGNORED,
statusDetails: {},
substatus: 'archived_until_escalating',
});
Expand Down Expand Up @@ -53,7 +53,7 @@ describe('ArchiveActions', () => {
await userEvent.click(screen.getByRole('button', {name: 'Confirm'}));

expect(onUpdate).toHaveBeenCalledWith({
status: ResolutionStatus.IGNORED,
status: GroupStatus.IGNORED,
statusDetails: {},
substatus: 'archived_until_escalating',
});
Expand Down
8 changes: 4 additions & 4 deletions static/app/components/actions/archive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {DropdownMenu, MenuItemProps} from 'sentry/components/dropdownMenu';
import ExternalLink from 'sentry/components/links/externalLink';
import {IconChevron} from 'sentry/icons';
import {t, tct} from 'sentry/locale';
import {GroupStatusResolution, GroupSubstatus, ResolutionStatus} from 'sentry/types';
import {GroupStatus, GroupStatusResolution, GroupSubstatus} from 'sentry/types';

interface ArchiveActionProps {
onUpdate: (params: GroupStatusResolution) => void;
Expand All @@ -22,12 +22,12 @@ interface ArchiveActionProps {
}

const ARCHIVE_UNTIL_ESCALATING: GroupStatusResolution = {
status: ResolutionStatus.IGNORED,
status: GroupStatus.IGNORED,
statusDetails: {},
substatus: GroupSubstatus.ARCHIVED_UNTIL_ESCALATING,
};
const ARCHIVE_FOREVER: GroupStatusResolution = {
status: ResolutionStatus.IGNORED,
status: GroupStatus.IGNORED,
statusDetails: {},
substatus: GroupSubstatus.ARCHIVED_FOREVER,
};
Expand Down Expand Up @@ -101,7 +101,7 @@ function ArchiveActions({
title={t('Change status to unresolved')}
onClick={() =>
onUpdate({
status: ResolutionStatus.UNRESOLVED,
status: GroupStatus.UNRESOLVED,
statusDetails: {},
substatus: GroupSubstatus.ONGOING,
})
Expand Down
12 changes: 6 additions & 6 deletions static/app/components/actions/ignore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import {Tooltip} from 'sentry/components/tooltip';
import {IconChevron} from 'sentry/icons';
import {t, tn} from 'sentry/locale';
import {
GroupStatus,
GroupStatusResolution,
GroupSubstatus,
ResolutionStatus,
ResolutionStatusDetails,
IgnoredStatusDetails,
SelectValue,
} from 'sentry/types';
import {getDuration} from 'sentry/utils/formatters';
Expand Down Expand Up @@ -53,14 +53,14 @@ export function getIgnoreActions({
'shouldConfirm' | 'confirmMessage' | 'confirmLabel' | 'onUpdate'
>) {
const onIgnore = (
statusDetails: ResolutionStatusDetails | undefined = {},
statusDetails: IgnoredStatusDetails | undefined = {},
{bypassConfirm} = {bypassConfirm: false}
) => {
openConfirmModal({
bypass: bypassConfirm || !shouldConfirm,
onConfirm: () =>
onUpdate({
status: ResolutionStatus.IGNORED,
status: GroupStatus.IGNORED,
statusDetails,
substatus: GroupSubstatus.ARCHIVED_UNTIL_CONDITION_MET,
}),
Expand All @@ -69,7 +69,7 @@ export function getIgnoreActions({
});
};

const onCustomIgnore = (statusDetails: ResolutionStatusDetails) => {
const onCustomIgnore = (statusDetails: IgnoredStatusDetails) => {
onIgnore(statusDetails, {bypassConfirm: true});
};

Expand Down Expand Up @@ -231,7 +231,7 @@ function IgnoreActions({
size="xs"
onClick={() =>
onUpdate({
status: ResolutionStatus.UNRESOLVED,
status: GroupStatus.UNRESOLVED,
statusDetails: {},
substatus: GroupSubstatus.ONGOING,
})
Expand Down
26 changes: 12 additions & 14 deletions static/app/components/actions/resolve.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import {IconChevron, IconReleases} from 'sentry/icons';
import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import {
GroupStatus,
GroupStatusResolution,
GroupSubstatus,
Project,
ResolutionStatus,
ResolutionStatusDetails,
ResolvedStatusDetails,
} from 'sentry/types';
import {trackAnalytics} from 'sentry/utils/analytics';
import {formatVersion, isSemverRelease} from 'sentry/utils/formatters';
Expand Down Expand Up @@ -84,19 +84,17 @@ function ResolveActions({
}: ResolveActionsProps) {
const organization = useOrganization();

function handleCommitResolution(statusDetails: ResolutionStatusDetails) {
function handleCommitResolution(statusDetails: ResolvedStatusDetails) {
onUpdate({
status: ResolutionStatus.RESOLVED,
status: GroupStatus.RESOLVED,
statusDetails,
substatus: null,
});
}

function handleAnotherExistingReleaseResolution(
statusDetails: ResolutionStatusDetails
) {
function handleAnotherExistingReleaseResolution(statusDetails: ResolvedStatusDetails) {
onUpdate({
status: ResolutionStatus.RESOLVED,
status: GroupStatus.RESOLVED,
statusDetails,
substatus: null,
});
Expand All @@ -109,7 +107,7 @@ function ResolveActions({
function handleCurrentReleaseResolution() {
if (hasRelease) {
onUpdate({
status: ResolutionStatus.RESOLVED,
status: GroupStatus.RESOLVED,
statusDetails: {
inRelease: latestRelease ? latestRelease.version : 'latest',
},
Expand All @@ -126,7 +124,7 @@ function ResolveActions({
function handleNextReleaseResolution() {
if (hasRelease) {
onUpdate({
status: ResolutionStatus.RESOLVED,
status: GroupStatus.RESOLVED,
statusDetails: {
inNextRelease: true,
},
Expand Down Expand Up @@ -158,7 +156,7 @@ function ResolveActions({
disabled={isAutoResolved}
onClick={() =>
onUpdate({
status: ResolutionStatus.UNRESOLVED,
status: GroupStatus.UNRESOLVED,
statusDetails: {},
substatus: GroupSubstatus.ONGOING,
})
Expand Down Expand Up @@ -262,7 +260,7 @@ function ResolveActions({
openModal(deps => (
<CustomCommitsResolutionModal
{...deps}
onSelected={(statusDetails: ResolutionStatusDetails) =>
onSelected={(statusDetails: ResolvedStatusDetails) =>
handleCommitResolution(statusDetails)
}
orgSlug={organization.slug}
Expand All @@ -275,7 +273,7 @@ function ResolveActions({
openModal(deps => (
<CustomResolutionModal
{...deps}
onSelected={(statusDetails: ResolutionStatusDetails) =>
onSelected={(statusDetails: ResolvedStatusDetails) =>
handleAnotherExistingReleaseResolution(statusDetails)
}
organization={organization}
Expand All @@ -301,7 +299,7 @@ function ResolveActions({
bypass: !shouldConfirm,
onConfirm: () =>
onUpdate({
status: ResolutionStatus.RESOLVED,
status: GroupStatus.RESOLVED,
statusDetails: {},
substatus: null,
}),
Expand Down
4 changes: 2 additions & 2 deletions static/app/components/archivedBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import Duration from 'sentry/components/duration';
import {BannerContainer, BannerSummary} from 'sentry/components/events/styles';
import ExternalLink from 'sentry/components/links/externalLink';
import {t} from 'sentry/locale';
import {Group, GroupSubstatus, Organization, ResolutionStatusDetails} from 'sentry/types';
import {Group, GroupSubstatus, IgnoredStatusDetails, Organization} from 'sentry/types';
import {trackAnalytics} from 'sentry/utils/analytics';

interface ArchivedBoxProps {
organization: Organization;
statusDetails: ResolutionStatusDetails;
statusDetails: IgnoredStatusDetails;
substatus: Group['substatus'];
}

Expand Down
4 changes: 2 additions & 2 deletions static/app/components/customCommitsResolutionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import TimeSince from 'sentry/components/timeSince';
import Version from 'sentry/components/version';
import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {Commit, ResolutionStatusDetails} from 'sentry/types';
import type {Commit, ResolvedStatusDetails} from 'sentry/types';

interface CustomCommitsResolutionModalProps extends ModalRenderProps {
onSelected: (x: ResolutionStatusDetails) => void;
onSelected: (x: ResolvedStatusDetails) => void;
orgSlug: string;
projectSlug?: string;
}
Expand Down
6 changes: 3 additions & 3 deletions static/app/components/customIgnoreCountModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ButtonBar from 'sentry/components/buttonBar';
import NumberField from 'sentry/components/forms/fields/numberField';
import SelectField from 'sentry/components/forms/fields/selectField';
import {t} from 'sentry/locale';
import {ResolutionStatusDetails, SelectValue} from 'sentry/types';
import {IgnoredStatusDetails, SelectValue} from 'sentry/types';

type CountNames = 'ignoreCount' | 'ignoreUserCount';
type WindowNames = 'ignoreWindow' | 'ignoreUserWindow';
Expand All @@ -15,7 +15,7 @@ type Props = ModalRenderProps & {
countLabel: string;
countName: CountNames;
label: string;
onSelected: (statusDetails: ResolutionStatusDetails) => void;
onSelected: (statusDetails: IgnoredStatusDetails) => void;
windowName: WindowNames;
windowOptions: SelectValue<number>[];
};
Expand All @@ -35,7 +35,7 @@ class CustomIgnoreCountModal extends Component<Props, State> {
const {count, window} = this.state;
const {countName, windowName} = this.props;

const statusDetails: ResolutionStatusDetails = {[countName]: count};
const statusDetails: IgnoredStatusDetails = {[countName]: count};
if (window) {
statusDetails[windowName] = window;
}
Expand Down
4 changes: 2 additions & 2 deletions static/app/components/customIgnoreDurationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import {Alert} from 'sentry/components/alert';
import {Button} from 'sentry/components/button';
import ButtonBar from 'sentry/components/buttonBar';
import {t} from 'sentry/locale';
import {ResolutionStatusDetails} from 'sentry/types';
import {IgnoredStatusDetails} from 'sentry/types';

const defaultProps = {
label: t('Ignore this issue until \u2026'),
};

type Props = ModalRenderProps & {
onSelected: (details: ResolutionStatusDetails) => void;
onSelected: (details: IgnoredStatusDetails) => void;
} & typeof defaultProps;

type State = {
Expand Down
15 changes: 6 additions & 9 deletions static/app/components/group/inboxBadges/statusBadge.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';

import {GroupStatusBadge} from 'sentry/components/group/inboxBadges/statusBadge';
import {GroupSubstatus, ResolutionStatus} from 'sentry/types';
import {GroupStatus, GroupSubstatus} from 'sentry/types';

describe('GroupStatusBadge', () => {
it('should display archived until escalating as a tooltip', async () => {
render(
<GroupStatusBadge
status={ResolutionStatus.IGNORED}
status={GroupStatus.IGNORED}
substatus={GroupSubstatus.ARCHIVED_UNTIL_ESCALATING}
/>
);
Expand All @@ -16,17 +16,14 @@ describe('GroupStatusBadge', () => {
});
it('should display new', () => {
render(
<GroupStatusBadge
status={ResolutionStatus.UNRESOLVED}
substatus={GroupSubstatus.NEW}
/>
<GroupStatusBadge status={GroupStatus.UNRESOLVED} substatus={GroupSubstatus.NEW} />
);
expect(screen.getByText('New')).toBeInTheDocument();
});
it('should display escalating', () => {
render(
<GroupStatusBadge
status={ResolutionStatus.UNRESOLVED}
status={GroupStatus.UNRESOLVED}
substatus={GroupSubstatus.ESCALATING}
/>
);
Expand All @@ -35,14 +32,14 @@ describe('GroupStatusBadge', () => {
it('should display regression', () => {
render(
<GroupStatusBadge
status={ResolutionStatus.UNRESOLVED}
status={GroupStatus.UNRESOLVED}
substatus={GroupSubstatus.REGRESSED}
/>
);
expect(screen.getByText('Regressed')).toBeInTheDocument();
});
it('should display resolved', () => {
render(<GroupStatusBadge status={ResolutionStatus.RESOLVED} />);
render(<GroupStatusBadge status={GroupStatus.RESOLVED} />);
expect(screen.getByText('Resolved')).toBeInTheDocument();
});
});
4 changes: 2 additions & 2 deletions static/app/components/mutedBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import Duration from 'sentry/components/duration';
import {BannerContainer, BannerSummary} from 'sentry/components/events/styles';
import {IconMute} from 'sentry/icons';
import {t} from 'sentry/locale';
import {ResolutionStatusDetails} from 'sentry/types';
import {IgnoredStatusDetails} from 'sentry/types';

type Props = {
statusDetails: ResolutionStatusDetails;
statusDetails: IgnoredStatusDetails;
};

function MutedBox({statusDetails}: Props) {
Expand Down
7 changes: 4 additions & 3 deletions static/app/components/resolutionBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ import {
GroupActivitySetByResolvedInRelease,
GroupActivityType,
Repository,
ResolutionStatusDetails,
ResolvedStatusDetails,
} from 'sentry/types';

type Props = {
projectId: string;
statusDetails: ResolutionStatusDetails;
// TODO(ts): This should be a union type `IgnoredStatusDetails | ResolvedStatusDetails`
statusDetails: ResolvedStatusDetails;
activities?: GroupActivity[];
};

function renderReason(
statusDetails: ResolutionStatusDetails,
statusDetails: ResolvedStatusDetails,
projectId: string,
activities: GroupActivity[]
) {
Expand Down
9 changes: 6 additions & 3 deletions static/app/components/stream/group.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {act, render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
import StreamGroup from 'sentry/components/stream/group';
import GroupStore from 'sentry/stores/groupStore';
import GuideStore from 'sentry/stores/guideStore';
import {Group, ResolutionStatus} from 'sentry/types';
import {GroupStatus, GroupStatusResolution, MarkReviewed} from 'sentry/types';
import {trackAnalytics} from 'sentry/utils/analytics';

jest.mock('sentry/utils/analytics');
Expand Down Expand Up @@ -61,7 +61,7 @@ describe('StreamGroup', function () {
);

expect(screen.getByTestId('group')).toHaveAttribute('data-test-reviewed', 'false');
const data: Partial<Group> = {inbox: false};
const data: MarkReviewed = {inbox: false};
act(() => GroupStore.onUpdate('1337', undefined, data));
act(() => GroupStore.onUpdateSuccess('1337', undefined, data));

Expand All @@ -77,7 +77,10 @@ describe('StreamGroup', function () {
});

expect(screen.queryByTestId('resolved-issue')).not.toBeInTheDocument();
const data: Partial<Group> = {status: ResolutionStatus.RESOLVED, statusDetails: {}};
const data: GroupStatusResolution = {
status: GroupStatus.RESOLVED,
statusDetails: {},
};
act(() => GroupStore.onUpdate('1337', undefined, data));
act(() => GroupStore.onUpdateSuccess('1337', undefined, data));
expect(screen.getByTestId('resolved-issue')).toBeInTheDocument();
Expand Down
Loading

0 comments on commit de9c3ac

Please sign in to comment.