Skip to content

Commit 8ecc921

Browse files
authored
feat(ui): Rename resolved in options, add analytics (#27192)
1 parent 7a13c6a commit 8ecc921

File tree

1 file changed

+54
-26
lines changed

1 file changed

+54
-26
lines changed

static/app/components/actions/resolve.tsx

Lines changed: 54 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ import Tooltip from 'app/components/tooltip';
99
import {IconCheckmark, IconChevron} from 'app/icons';
1010
import {t} from 'app/locale';
1111
import {
12+
Organization,
1213
Release,
1314
ResolutionStatus,
1415
ResolutionStatusDetails,
1516
UpdateResolutionStatus,
1617
} from 'app/types';
18+
import {trackAnalyticsEvent} from 'app/utils/analytics';
1719
import {formatVersion} from 'app/utils/formatters';
20+
import withOrganization from 'app/utils/withOrganization';
1821

1922
import ActionButton from './button';
2023
import MenuHeader from './menuHeader';
@@ -28,6 +31,7 @@ const defaultProps = {
2831
};
2932

3033
type Props = {
34+
organization: Organization;
3135
hasRelease: boolean;
3236
onUpdate: (data: UpdateResolutionStatus) => void;
3337
orgSlug: string;
@@ -39,18 +43,59 @@ type Props = {
3943
disableDropdown?: boolean;
4044
projectFetchError?: boolean;
4145
hasInbox?: boolean;
42-
} & typeof defaultProps;
46+
} & Partial<typeof defaultProps>;
4347

4448
class ResolveActions extends React.Component<Props> {
4549
static defaultProps = defaultProps;
4650

47-
onCustomResolution(statusDetails: ResolutionStatusDetails) {
48-
this.props.onUpdate({
51+
handleAnotherExistingReleaseResolution(statusDetails: ResolutionStatusDetails) {
52+
const {organization, onUpdate} = this.props;
53+
onUpdate({
4954
status: ResolutionStatus.RESOLVED,
5055
statusDetails,
5156
});
57+
trackAnalyticsEvent({
58+
eventKey: 'resolve_issue',
59+
eventName: 'Resolve Issue',
60+
release: 'anotherExisting',
61+
organization_id: organization.id,
62+
});
5263
}
5364

65+
handleCurrentReleaseResolution = () => {
66+
const {onUpdate, organization, hasRelease, latestRelease} = this.props;
67+
hasRelease &&
68+
onUpdate({
69+
status: ResolutionStatus.RESOLVED,
70+
statusDetails: {
71+
inRelease: latestRelease ? latestRelease.version : 'latest',
72+
},
73+
});
74+
trackAnalyticsEvent({
75+
eventKey: 'resolve_issue',
76+
eventName: 'Resolve Issue',
77+
release: 'current',
78+
organization_id: organization.id,
79+
});
80+
};
81+
82+
handleNextReleaseResolution = () => {
83+
const {onUpdate, organization, hasRelease} = this.props;
84+
hasRelease &&
85+
onUpdate({
86+
status: ResolutionStatus.RESOLVED,
87+
statusDetails: {
88+
inNextRelease: true,
89+
},
90+
});
91+
trackAnalyticsEvent({
92+
eventKey: 'resolve_issue',
93+
eventName: 'Resolve Issue',
94+
release: 'next',
95+
organization_id: organization.id,
96+
});
97+
};
98+
5499
renderResolved() {
55100
const {isAutoResolved, onUpdate} = this.props;
56101

@@ -81,7 +126,6 @@ class ResolveActions extends React.Component<Props> {
81126
isResolved,
82127
hasRelease,
83128
latestRelease,
84-
onUpdate,
85129
confirmMessage,
86130
shouldConfirm,
87131
disabled,
@@ -128,15 +172,7 @@ class ResolveActions extends React.Component<Props> {
128172
<MenuItemActionLink
129173
{...actionLinkProps}
130174
title={t('The next release')}
131-
onAction={() =>
132-
hasRelease &&
133-
onUpdate({
134-
status: ResolutionStatus.RESOLVED,
135-
statusDetails: {
136-
inNextRelease: true,
137-
},
138-
})
139-
}
175+
onAction={this.handleNextReleaseResolution}
140176
>
141177
<Tooltip disabled={hasRelease} title={actionTitle}>
142178
{t('The next release')}
@@ -146,15 +182,7 @@ class ResolveActions extends React.Component<Props> {
146182
<MenuItemActionLink
147183
{...actionLinkProps}
148184
title={t('The current release')}
149-
onAction={() =>
150-
hasRelease &&
151-
onUpdate({
152-
status: ResolutionStatus.RESOLVED,
153-
statusDetails: {
154-
inRelease: latestRelease ? latestRelease.version : 'latest',
155-
},
156-
})
157-
}
185+
onAction={this.handleCurrentReleaseResolution}
158186
>
159187
<Tooltip disabled={hasRelease} title={actionTitle}>
160188
{latestRelease
@@ -165,12 +193,12 @@ class ResolveActions extends React.Component<Props> {
165193

166194
<MenuItemActionLink
167195
{...actionLinkProps}
168-
title={t('Another version')}
196+
title={t('Another existing release')}
169197
onAction={() => hasRelease && this.openCustomReleaseModal()}
170198
shouldConfirm={false}
171199
>
172200
<Tooltip disabled={hasRelease} title={actionTitle}>
173-
{t('Another version\u2026')}
201+
{t('Another existing release')}
174202
</Tooltip>
175203
</MenuItemActionLink>
176204
</DropdownLink>
@@ -184,7 +212,7 @@ class ResolveActions extends React.Component<Props> {
184212
<CustomResolutionModal
185213
{...deps}
186214
onSelected={(statusDetails: ResolutionStatusDetails) =>
187-
this.onCustomResolution(statusDetails)
215+
this.handleAnotherExistingReleaseResolution(statusDetails)
188216
}
189217
orgSlug={orgSlug}
190218
projectSlug={projectSlug}
@@ -242,4 +270,4 @@ class ResolveActions extends React.Component<Props> {
242270
}
243271
}
244272

245-
export default ResolveActions;
273+
export default withOrganization(ResolveActions);

0 commit comments

Comments
 (0)