releaseComparison.tsx 713 B

1234567891011121314151617181920212223242526
  1. import {defined} from 'sentry/utils';
  2. import {MutableSearch} from 'sentry/utils/tokenizeSearch';
  3. export function appendReleaseFilters(
  4. query: MutableSearch,
  5. primaryRelease: string | undefined,
  6. secondaryRelease?: string
  7. ) {
  8. let queryString: string = query.formatString();
  9. if (
  10. defined(primaryRelease) &&
  11. defined(secondaryRelease) &&
  12. primaryRelease !== secondaryRelease
  13. ) {
  14. queryString = query
  15. .copy()
  16. .addStringFilter(`release:[${primaryRelease},${secondaryRelease}]`)
  17. .formatString();
  18. } else if (defined(primaryRelease)) {
  19. queryString = query
  20. .copy()
  21. .addStringFilter(`release:${primaryRelease}`)
  22. .formatString();
  23. }
  24. return queryString;
  25. }