resolveActions.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import ResolveActions from 'sentry/components/actions/resolve';
  2. import {Organization} from 'sentry/types';
  3. import {ConfirmAction} from './utils';
  4. type Props = {
  5. anySelected: boolean;
  6. onShouldConfirm: (action: ConfirmAction) => boolean;
  7. onUpdate: (data?: any) => void;
  8. orgSlug: Organization['slug'];
  9. params: any;
  10. };
  11. function ResolveActionsContainer({
  12. params,
  13. orgSlug,
  14. anySelected,
  15. onShouldConfirm,
  16. onUpdate,
  17. }: Props) {
  18. const {
  19. hasReleases,
  20. latestRelease,
  21. projectId,
  22. confirm,
  23. label,
  24. loadingProjects,
  25. projectFetchError,
  26. } = params;
  27. // resolve requires a single project to be active in an org context
  28. // projectId is null when 0 or >1 projects are selected.
  29. const resolveDisabled = Boolean(!anySelected || projectFetchError);
  30. const resolveDropdownDisabled = Boolean(
  31. !anySelected || !projectId || loadingProjects || projectFetchError
  32. );
  33. return (
  34. <ResolveActions
  35. hasRelease={hasReleases}
  36. latestRelease={latestRelease}
  37. orgSlug={orgSlug}
  38. projectSlug={projectId}
  39. onUpdate={onUpdate}
  40. shouldConfirm={onShouldConfirm(ConfirmAction.RESOLVE)}
  41. confirmMessage={confirm('resolve', true)}
  42. confirmLabel={label('resolve')}
  43. disabled={resolveDisabled}
  44. disableDropdown={resolveDropdownDisabled}
  45. projectFetchError={projectFetchError}
  46. />
  47. );
  48. }
  49. export default ResolveActionsContainer;