import {Component} from 'react'; import styled from '@emotion/styled'; import {openModal} from 'sentry/actionCreators/modal'; import Button from 'sentry/components/button'; import ButtonBar from 'sentry/components/buttonBar'; import {openConfirmModal} from 'sentry/components/confirm'; import CustomCommitsResolutionModal from 'sentry/components/customCommitsResolutionModal'; import CustomResolutionModal from 'sentry/components/customResolutionModal'; import DropdownMenuControl from 'sentry/components/dropdownMenuControl'; import type {MenuItemProps} from 'sentry/components/dropdownMenuItem'; import Tooltip from 'sentry/components/tooltip'; import {IconCheckmark, IconChevron} from 'sentry/icons'; import {t} from 'sentry/locale'; import { GroupStatusResolution, Organization, Release, ResolutionStatus, ResolutionStatusDetails, } from 'sentry/types'; import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent'; import {formatVersion} from 'sentry/utils/formatters'; import withOrganization from 'sentry/utils/withOrganization'; const defaultProps = { isResolved: false, isAutoResolved: false, confirmLabel: t('Resolve'), }; type Props = { hasRelease: boolean; onUpdate: (data: GroupStatusResolution) => void; orgSlug: string; organization: Organization; confirmMessage?: React.ReactNode; disableDropdown?: boolean; disableTooltip?: boolean; disabled?: boolean; hideIcon?: boolean; latestRelease?: Release; priority?: 'primary'; projectFetchError?: boolean; projectSlug?: string; shouldConfirm?: boolean; size?: 'xs' | 'sm'; } & Partial; class ResolveActions extends Component { static defaultProps = defaultProps; handleCommitResolution(statusDetails: ResolutionStatusDetails) { const {onUpdate} = this.props; onUpdate({ status: ResolutionStatus.RESOLVED, statusDetails, }); } handleAnotherExistingReleaseResolution(statusDetails: ResolutionStatusDetails) { const {organization, onUpdate} = this.props; onUpdate({ status: ResolutionStatus.RESOLVED, statusDetails, }); trackAdvancedAnalyticsEvent('resolve_issue', { organization, release: 'anotherExisting', }); } handleCurrentReleaseResolution = () => { const {onUpdate, organization, hasRelease, latestRelease} = this.props; hasRelease && onUpdate({ status: ResolutionStatus.RESOLVED, statusDetails: { inRelease: latestRelease ? latestRelease.version : 'latest', }, }); trackAdvancedAnalyticsEvent('resolve_issue', { organization, release: 'current', }); }; handleNextReleaseResolution = () => { const {onUpdate, organization, hasRelease} = this.props; hasRelease && onUpdate({ status: ResolutionStatus.RESOLVED, statusDetails: { inNextRelease: true, }, }); trackAdvancedAnalyticsEvent('resolve_issue', { organization, release: 'next', }); }; renderResolved() { const {isAutoResolved, onUpdate} = this.props; return (