index.tsx 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. import {Fragment} from 'react';
  2. import {forceCheck} from 'react-lazyload';
  3. import type {RouteComponentProps} from 'react-router';
  4. import styled from '@emotion/styled';
  5. import pick from 'lodash/pick';
  6. import {fetchTagValues} from 'sentry/actionCreators/tags';
  7. import type {Client} from 'sentry/api';
  8. import {Alert} from 'sentry/components/alert';
  9. import GuideAnchor from 'sentry/components/assistant/guideAnchor';
  10. import EmptyMessage from 'sentry/components/emptyMessage';
  11. import FloatingFeedbackWidget from 'sentry/components/feedback/widget/floatingFeedbackWidget';
  12. import * as Layout from 'sentry/components/layouts/thirds';
  13. import ExternalLink from 'sentry/components/links/externalLink';
  14. import LoadingIndicator from 'sentry/components/loadingIndicator';
  15. import NoProjectMessage from 'sentry/components/noProjectMessage';
  16. import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
  17. import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter';
  18. import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
  19. import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
  20. import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter';
  21. import Pagination from 'sentry/components/pagination';
  22. import Panel from 'sentry/components/panels/panel';
  23. import SmartSearchBar from 'sentry/components/smartSearchBar';
  24. import {ItemType} from 'sentry/components/smartSearchBar/types';
  25. import {getRelativeSummary} from 'sentry/components/timeRangeSelector/utils';
  26. import {DEFAULT_STATS_PERIOD} from 'sentry/constants';
  27. import {ALL_ACCESS_PROJECTS} from 'sentry/constants/pageFilters';
  28. import {releaseHealth} from 'sentry/data/platformCategories';
  29. import {IconSearch} from 'sentry/icons';
  30. import {t} from 'sentry/locale';
  31. import ProjectsStore from 'sentry/stores/projectsStore';
  32. import {space} from 'sentry/styles/space';
  33. import type {Organization, PageFilters, Project, Release, Tag} from 'sentry/types';
  34. import {ReleaseStatus} from 'sentry/types';
  35. import {trackAnalytics} from 'sentry/utils/analytics';
  36. import {SEMVER_TAGS} from 'sentry/utils/discover/fields';
  37. import Projects from 'sentry/utils/projects';
  38. import routeTitleGen from 'sentry/utils/routeTitle';
  39. import withApi from 'sentry/utils/withApi';
  40. import withOrganization from 'sentry/utils/withOrganization';
  41. import withPageFilters from 'sentry/utils/withPageFilters';
  42. import withProjects from 'sentry/utils/withProjects';
  43. import DeprecatedAsyncView from 'sentry/views/deprecatedAsyncView';
  44. import Header from '../components/header';
  45. import ReleaseFeedbackBanner from '../components/releaseFeedbackBanner';
  46. import ReleaseArchivedNotice from '../detail/overview/releaseArchivedNotice';
  47. import {isMobileRelease} from '../utils';
  48. import {fetchThresholdStatuses} from '../utils/fetchThresholdStatus';
  49. import type {
  50. Threshold,
  51. ThresholdQuery,
  52. ThresholdStatus,
  53. ThresholdStatusesQuery,
  54. } from '../utils/types';
  55. import ReleaseCard from './releaseCard';
  56. import ReleasesAdoptionChart from './releasesAdoptionChart';
  57. import ReleasesDisplayOptions, {ReleasesDisplayOption} from './releasesDisplayOptions';
  58. import ReleasesPromo from './releasesPromo';
  59. import ReleasesRequest from './releasesRequest';
  60. import ReleasesSortOptions, {ReleasesSortOption} from './releasesSortOptions';
  61. import ReleasesStatusOptions, {ReleasesStatusOption} from './releasesStatusOptions';
  62. type RouteParams = {
  63. orgId: string;
  64. };
  65. type Props = RouteComponentProps<RouteParams, {}> & {
  66. api: Client;
  67. organization: Organization;
  68. projects: Project[];
  69. selection: PageFilters;
  70. };
  71. type State = {
  72. releases: Release[];
  73. thresholds: Threshold[];
  74. thresholdStatuses?: {[key: string]: ThresholdStatus[]};
  75. } & DeprecatedAsyncView['state'];
  76. class ReleasesList extends DeprecatedAsyncView<Props, State> {
  77. shouldReload = true;
  78. shouldRenderBadRequests = true;
  79. hasV2ReleaseUIEnabled =
  80. this.props.organization.features.includes('releases-v2-internal') ||
  81. this.props.organization.features.includes('releases-v2') ||
  82. this.props.organization.features.includes('releases-v2-st');
  83. getTitle() {
  84. return routeTitleGen(t('Releases'), this.props.organization.slug, false);
  85. }
  86. getEndpoints(): ReturnType<DeprecatedAsyncView['getEndpoints']> {
  87. const {organization, location, selection} = this.props;
  88. const {statsPeriod} = location.query;
  89. const activeSort = this.getSort();
  90. const activeStatus = this.getStatus();
  91. const query = {
  92. ...pick(location.query, ['project', 'environment', 'cursor', 'query', 'sort']),
  93. summaryStatsPeriod: statsPeriod,
  94. per_page: 20,
  95. flatten: activeSort === ReleasesSortOption.DATE ? 0 : 1,
  96. adoptionStages: 1,
  97. status:
  98. activeStatus === ReleasesStatusOption.ARCHIVED
  99. ? ReleaseStatus.ARCHIVED
  100. : ReleaseStatus.ACTIVE,
  101. };
  102. const endpoints: ReturnType<DeprecatedAsyncView['getEndpoints']> = [
  103. [
  104. 'releases', // stateKey
  105. `/organizations/${organization.slug}/releases/`, // endpoint
  106. {query}, // params
  107. {disableEntireQuery: true}, // options - prevent cursor from being passed into query
  108. ],
  109. ];
  110. if (this.hasV2ReleaseUIEnabled) {
  111. // prefetch all thresholds so we know whether to expect a threshold or not
  112. const thresholdQuery: ThresholdQuery = {};
  113. if (selection.projects.length) {
  114. thresholdQuery.project = selection.projects;
  115. } else {
  116. thresholdQuery.project = [ALL_ACCESS_PROJECTS];
  117. }
  118. if (selection.environments.length) {
  119. thresholdQuery.environment = selection.environments;
  120. }
  121. endpoints.push([
  122. 'thresholds',
  123. `/organizations/${organization.slug}/release-thresholds/`,
  124. {query: thresholdQuery},
  125. {disableEntireQuery: true}, // options to prevent cursor from being passed
  126. ]);
  127. }
  128. return endpoints;
  129. }
  130. componentDidUpdate(prevProps: Props, prevState: State) {
  131. super.componentDidUpdate(prevProps, prevState);
  132. if (prevState.releases !== this.state.releases) {
  133. /**
  134. * Manually trigger checking for elements in viewport.
  135. * Helpful when LazyLoad components enter the viewport without resize or scroll events,
  136. * https://github.com/twobin/react-lazyload#forcecheck
  137. *
  138. * HealthStatsCharts are being rendered only when they are scrolled into viewport.
  139. * This is how we re-check them without scrolling once releases change as this view
  140. * uses shouldReload=true and there is no reloading happening.
  141. */
  142. forceCheck();
  143. if (this.hasV2ReleaseUIEnabled) {
  144. // Refetch new threshold statuses if new releases are fetched
  145. this.fetchThresholdStatuses();
  146. }
  147. }
  148. }
  149. fetchThresholdStatuses() {
  150. const {selection, organization, api} = this.props;
  151. const {releases} = this.state;
  152. if (releases.length < 1) {
  153. return;
  154. }
  155. // Grab earliest release and latest release - then fetch all statuses within
  156. const fuzzSec = 30;
  157. const initialRelease = releases[0];
  158. let start = new Date(new Date(initialRelease.dateCreated).getTime() - fuzzSec * 1000);
  159. let end = new Date(new Date(initialRelease.dateCreated).getTime() + fuzzSec * 1000);
  160. const releaseVersions: string[] = [];
  161. releases.forEach(release => {
  162. const created = new Date(release.dateCreated);
  163. if (created < start) {
  164. start = created;
  165. }
  166. if (created > end) {
  167. end = created;
  168. }
  169. releaseVersions.push(release.version);
  170. });
  171. const query: ThresholdStatusesQuery = {
  172. start: start.toISOString(),
  173. end: end.toISOString(),
  174. release: releaseVersions,
  175. };
  176. if (selection.projects.length) {
  177. query.projectSlug = this.getSelectedProjectSlugs();
  178. }
  179. if (selection.environments.length) {
  180. query.environment = selection.environments;
  181. }
  182. fetchThresholdStatuses(organization, api, query).then(thresholdStatuses => {
  183. this.setState({thresholdStatuses});
  184. });
  185. }
  186. getQuery() {
  187. const {query} = this.props.location.query;
  188. return typeof query === 'string' ? query : undefined;
  189. }
  190. getSort(): ReleasesSortOption {
  191. const {environments} = this.props.selection;
  192. const {sort} = this.props.location.query;
  193. // Require 1 environment for date adopted
  194. if (sort === ReleasesSortOption.ADOPTION && environments.length !== 1) {
  195. return ReleasesSortOption.DATE;
  196. }
  197. const sortExists = Object.values(ReleasesSortOption).includes(sort);
  198. if (sortExists) {
  199. return sort;
  200. }
  201. return ReleasesSortOption.DATE;
  202. }
  203. getDisplay(): ReleasesDisplayOption {
  204. const {display} = this.props.location.query;
  205. switch (display) {
  206. case ReleasesDisplayOption.USERS:
  207. return ReleasesDisplayOption.USERS;
  208. default:
  209. return ReleasesDisplayOption.SESSIONS;
  210. }
  211. }
  212. getStatus(): ReleasesStatusOption {
  213. const {status} = this.props.location.query;
  214. switch (status) {
  215. case ReleasesStatusOption.ARCHIVED:
  216. return ReleasesStatusOption.ARCHIVED;
  217. default:
  218. return ReleasesStatusOption.ACTIVE;
  219. }
  220. }
  221. getSelectedProject(): Project | undefined {
  222. const {selection, projects} = this.props;
  223. const selectedProjectId =
  224. selection.projects && selection.projects.length === 1 && selection.projects[0];
  225. return projects?.find(p => p.id === `${selectedProjectId}`);
  226. }
  227. getSelectedProjectSlugs(): string[] {
  228. const {selection, projects} = this.props;
  229. const projIdSet = new Set(selection.projects);
  230. return projects.reduce((result: string[], proj) => {
  231. if (projIdSet.has(Number(proj.id))) {
  232. result.push(proj.slug);
  233. }
  234. return result;
  235. }, []);
  236. }
  237. get projectHasSessions() {
  238. return this.getSelectedProject()?.hasSessions ?? null;
  239. }
  240. getThresholdsForRelease(release: Release): Threshold[] {
  241. if (!this.hasV2ReleaseUIEnabled) {
  242. return [];
  243. }
  244. const {thresholds} = this.state;
  245. const lastDeploy = release.lastDeploy;
  246. const projectSlugs = release.projects.map(p => p.slug);
  247. return thresholds.filter(
  248. threshold =>
  249. projectSlugs.includes(threshold.project.slug) &&
  250. lastDeploy?.environment === threshold.environment?.name
  251. );
  252. }
  253. handleSearch = (query: string) => {
  254. const {location, router} = this.props;
  255. router.push({
  256. ...location,
  257. query: {...location.query, cursor: undefined, query},
  258. });
  259. };
  260. handleSortBy = (sort: string) => {
  261. const {location, router} = this.props;
  262. router.push({
  263. ...location,
  264. query: {...location.query, cursor: undefined, sort},
  265. });
  266. };
  267. handleDisplay = (display: string) => {
  268. const {location, router} = this.props;
  269. let sort = location.query.sort;
  270. if (
  271. sort === ReleasesSortOption.USERS_24_HOURS &&
  272. display === ReleasesDisplayOption.SESSIONS
  273. ) {
  274. sort = ReleasesSortOption.SESSIONS_24_HOURS;
  275. } else if (
  276. sort === ReleasesSortOption.SESSIONS_24_HOURS &&
  277. display === ReleasesDisplayOption.USERS
  278. ) {
  279. sort = ReleasesSortOption.USERS_24_HOURS;
  280. } else if (
  281. sort === ReleasesSortOption.CRASH_FREE_USERS &&
  282. display === ReleasesDisplayOption.SESSIONS
  283. ) {
  284. sort = ReleasesSortOption.CRASH_FREE_SESSIONS;
  285. } else if (
  286. sort === ReleasesSortOption.CRASH_FREE_SESSIONS &&
  287. display === ReleasesDisplayOption.USERS
  288. ) {
  289. sort = ReleasesSortOption.CRASH_FREE_USERS;
  290. }
  291. router.push({
  292. ...location,
  293. query: {...location.query, cursor: undefined, display, sort},
  294. });
  295. };
  296. handleStatus = (status: string) => {
  297. const {location, router} = this.props;
  298. router.push({
  299. ...location,
  300. query: {...location.query, cursor: undefined, status},
  301. });
  302. };
  303. trackAddReleaseHealth = () => {
  304. const {organization, selection} = this.props;
  305. if (organization.id && selection.projects[0]) {
  306. trackAnalytics('releases_list.click_add_release_health', {
  307. organization,
  308. project_id: selection.projects[0],
  309. });
  310. }
  311. };
  312. tagValueLoader = (key: string, search: string) => {
  313. const {location, organization} = this.props;
  314. const {project: projectId} = location.query;
  315. return fetchTagValues({
  316. api: this.api,
  317. orgSlug: organization.slug,
  318. tagKey: key,
  319. search,
  320. projectIds: projectId ? [projectId] : undefined,
  321. endpointParams: location.query,
  322. });
  323. };
  324. getTagValues = async (tag: Tag, currentQuery: string): Promise<string[]> => {
  325. const values = await this.tagValueLoader(tag.key, currentQuery);
  326. return values.map(({value}) => value);
  327. };
  328. shouldShowLoadingIndicator() {
  329. const {loading, releases, reloading} = this.state;
  330. return (loading && !reloading) || (loading && !releases?.length);
  331. }
  332. renderLoading() {
  333. return this.renderBody();
  334. }
  335. renderError() {
  336. return this.renderBody();
  337. }
  338. get shouldShowQuickstart() {
  339. const {releases} = this.state;
  340. const selectedProject = this.getSelectedProject();
  341. const hasReleasesSetup = selectedProject?.features.includes('releases');
  342. return !releases?.length && !hasReleasesSetup && selectedProject;
  343. }
  344. renderEmptyMessage() {
  345. const {location} = this.props;
  346. const {statsPeriod, start, end} = location.query;
  347. const searchQuery = this.getQuery();
  348. const activeSort = this.getSort();
  349. const activeStatus = this.getStatus();
  350. const selectedPeriod =
  351. !!start && !!end
  352. ? t('time range')
  353. : getRelativeSummary(statsPeriod || DEFAULT_STATS_PERIOD).toLowerCase();
  354. if (searchQuery && searchQuery.length) {
  355. return (
  356. <Panel>
  357. <EmptyMessage icon={<IconSearch size="xl" />} size="large">{`${t(
  358. 'There are no releases that match'
  359. )}: '${searchQuery}'.`}</EmptyMessage>
  360. </Panel>
  361. );
  362. }
  363. if (activeSort === ReleasesSortOption.USERS_24_HOURS) {
  364. return (
  365. <Panel>
  366. <EmptyMessage icon={<IconSearch size="xl" />} size="large">
  367. {t(
  368. 'There are no releases with active user data (users in the last 24 hours).'
  369. )}
  370. </EmptyMessage>
  371. </Panel>
  372. );
  373. }
  374. if (activeSort === ReleasesSortOption.SESSIONS_24_HOURS) {
  375. return (
  376. <Panel>
  377. <EmptyMessage icon={<IconSearch size="xl" />} size="large">
  378. {t(
  379. 'There are no releases with active session data (sessions in the last 24 hours).'
  380. )}
  381. </EmptyMessage>
  382. </Panel>
  383. );
  384. }
  385. if (
  386. activeSort === ReleasesSortOption.BUILD ||
  387. activeSort === ReleasesSortOption.SEMVER
  388. ) {
  389. return (
  390. <Panel>
  391. <EmptyMessage icon={<IconSearch size="xl" />} size="large">
  392. {t('There are no releases with semantic versioning.')}
  393. </EmptyMessage>
  394. </Panel>
  395. );
  396. }
  397. if (activeSort !== ReleasesSortOption.DATE) {
  398. return (
  399. <Panel>
  400. <EmptyMessage icon={<IconSearch size="xl" />} size="large">
  401. {`${t('There are no releases with data in the')} ${selectedPeriod}.`}
  402. </EmptyMessage>
  403. </Panel>
  404. );
  405. }
  406. if (activeStatus === ReleasesStatusOption.ARCHIVED) {
  407. return (
  408. <Panel>
  409. <EmptyMessage icon={<IconSearch size="xl" />} size="large">
  410. {t('There are no archived releases.')}
  411. </EmptyMessage>
  412. </Panel>
  413. );
  414. }
  415. return (
  416. <Panel>
  417. <EmptyMessage icon={<IconSearch size="xl" />} size="large">
  418. {`${t('There are no releases with data in the')} ${selectedPeriod}.`}
  419. </EmptyMessage>
  420. </Panel>
  421. );
  422. }
  423. renderHealthCta() {
  424. const {organization} = this.props;
  425. const {releases} = this.state;
  426. const selectedProject = this.getSelectedProject();
  427. if (!selectedProject || this.projectHasSessions !== false || !releases?.length) {
  428. return null;
  429. }
  430. return (
  431. <Projects orgId={organization.slug} slugs={[selectedProject.slug]}>
  432. {({projects, initiallyLoaded, fetchError}) => {
  433. const project = projects && projects.length === 1 && projects[0];
  434. const projectCanHaveReleases =
  435. project && project.platform && releaseHealth.includes(project.platform);
  436. if (!initiallyLoaded || fetchError || !projectCanHaveReleases) {
  437. return null;
  438. }
  439. return (
  440. <Alert type="info" showIcon>
  441. <AlertText>
  442. <div>
  443. {t(
  444. 'To track user adoption, crash rates, session data and more, add Release Health to your current setup.'
  445. )}
  446. </div>
  447. <ExternalLink
  448. href="https://docs.sentry.io/product/releases/setup/#release-health"
  449. onClick={this.trackAddReleaseHealth}
  450. >
  451. {t('Add Release Health')}
  452. </ExternalLink>
  453. </AlertText>
  454. </Alert>
  455. );
  456. }}
  457. </Projects>
  458. );
  459. }
  460. renderInnerBody(
  461. activeDisplay: ReleasesDisplayOption,
  462. showReleaseAdoptionStages: boolean
  463. ) {
  464. const {location, selection, organization, router} = this.props;
  465. const {releases, reloading, releasesPageLinks, thresholdStatuses} = this.state;
  466. const selectedProject = this.getSelectedProject();
  467. const hasReleasesSetup = selectedProject?.features.includes('releases');
  468. if (this.shouldShowLoadingIndicator()) {
  469. return <LoadingIndicator />;
  470. }
  471. if (!releases?.length && hasReleasesSetup) {
  472. return this.renderEmptyMessage();
  473. }
  474. if (this.shouldShowQuickstart) {
  475. return <ReleasesPromo organization={organization} project={selectedProject!} />;
  476. }
  477. return (
  478. <ReleasesRequest
  479. releases={releases.map(({version}) => version)}
  480. organization={organization}
  481. selection={selection}
  482. location={location}
  483. display={[this.getDisplay()]}
  484. releasesReloading={reloading}
  485. healthStatsPeriod={location.query.healthStatsPeriod}
  486. >
  487. {({isHealthLoading, getHealthData}) => {
  488. const singleProjectSelected =
  489. selection.projects?.length === 1 &&
  490. selection.projects[0] !== ALL_ACCESS_PROJECTS;
  491. // TODO: project specific chart should live on the project details page.
  492. const isMobileProject =
  493. selectedProject?.platform && isMobileRelease(selectedProject.platform);
  494. return (
  495. <Fragment>
  496. {singleProjectSelected && this.projectHasSessions && isMobileProject && (
  497. <ReleasesAdoptionChart
  498. organization={organization}
  499. selection={selection}
  500. location={location}
  501. router={router}
  502. activeDisplay={activeDisplay}
  503. />
  504. )}
  505. {releases.map((release, index) => (
  506. <ReleaseCard
  507. key={`${release.projects[0].slug}-${release.version}`}
  508. activeDisplay={activeDisplay}
  509. release={release}
  510. organization={organization}
  511. location={location}
  512. selection={selection}
  513. reloading={reloading}
  514. showHealthPlaceholders={isHealthLoading}
  515. isTopRelease={index === 0}
  516. getHealthData={getHealthData}
  517. showReleaseAdoptionStages={showReleaseAdoptionStages}
  518. thresholds={this.getThresholdsForRelease(release)}
  519. thresholdStatuses={thresholdStatuses || {}}
  520. />
  521. ))}
  522. <Pagination pageLinks={releasesPageLinks} />
  523. </Fragment>
  524. );
  525. }}
  526. </ReleasesRequest>
  527. );
  528. }
  529. renderBody() {
  530. const {organization, selection, router} = this.props;
  531. const {releases, reloading, error} = this.state;
  532. const activeSort = this.getSort();
  533. const activeStatus = this.getStatus();
  534. const activeDisplay = this.getDisplay();
  535. const hasAnyMobileProject = selection.projects
  536. .map(id => `${id}`)
  537. .map(ProjectsStore.getById)
  538. .some(project => project?.platform && isMobileRelease(project.platform));
  539. const showReleaseAdoptionStages =
  540. hasAnyMobileProject && selection.environments.length === 1;
  541. const hasReleasesSetup = releases && releases.length > 0;
  542. return (
  543. <PageFiltersContainer showAbsolute={false}>
  544. <NoProjectMessage organization={organization}>
  545. <Header
  546. router={router}
  547. hasV2ReleaseUIEnabled={this.hasV2ReleaseUIEnabled}
  548. organization={organization}
  549. />
  550. <Layout.Body>
  551. <Layout.Main fullWidth>
  552. {organization.features.includes('releases-v2-banner') && (
  553. <ReleaseFeedbackBanner />
  554. )}
  555. {this.renderHealthCta()}
  556. <ReleasesPageFilterBar condensed>
  557. <GuideAnchor target="release_projects">
  558. <ProjectPageFilter />
  559. </GuideAnchor>
  560. <EnvironmentPageFilter />
  561. <DatePageFilter
  562. disallowArbitraryRelativeRanges
  563. menuFooterMessage={t(
  564. 'Changing this date range will recalculate the release metrics.'
  565. )}
  566. />
  567. </ReleasesPageFilterBar>
  568. {this.shouldShowQuickstart ? null : (
  569. <SortAndFilterWrapper>
  570. <GuideAnchor
  571. target="releases_search"
  572. position="bottom"
  573. disabled={!hasReleasesSetup}
  574. >
  575. <StyledSmartSearchBar
  576. searchSource="releases"
  577. query={this.getQuery()}
  578. placeholder={t('Search by version, build, package, or stage')}
  579. hasRecentSearches={false}
  580. supportedTags={{
  581. ...SEMVER_TAGS,
  582. release: {
  583. key: 'release',
  584. name: 'release',
  585. },
  586. }}
  587. maxMenuHeight={500}
  588. supportedTagType={ItemType.PROPERTY}
  589. onSearch={this.handleSearch}
  590. onGetTagValues={this.getTagValues}
  591. />
  592. </GuideAnchor>
  593. <ReleasesStatusOptions
  594. selected={activeStatus}
  595. onSelect={this.handleStatus}
  596. />
  597. <ReleasesSortOptions
  598. selected={activeSort}
  599. selectedDisplay={activeDisplay}
  600. onSelect={this.handleSortBy}
  601. environments={selection.environments}
  602. />
  603. <ReleasesDisplayOptions
  604. selected={activeDisplay}
  605. onSelect={this.handleDisplay}
  606. />
  607. </SortAndFilterWrapper>
  608. )}
  609. {!reloading &&
  610. activeStatus === ReleasesStatusOption.ARCHIVED &&
  611. !!releases?.length && <ReleaseArchivedNotice multi />}
  612. {error
  613. ? super.renderError()
  614. : this.renderInnerBody(activeDisplay, showReleaseAdoptionStages)}
  615. <FloatingFeedbackWidget />
  616. </Layout.Main>
  617. </Layout.Body>
  618. </NoProjectMessage>
  619. </PageFiltersContainer>
  620. );
  621. }
  622. }
  623. const AlertText = styled('div')`
  624. display: flex;
  625. align-items: flex-start;
  626. justify-content: flex-start;
  627. gap: ${space(2)};
  628. > *:nth-child(1) {
  629. flex: 1;
  630. }
  631. flex-direction: column;
  632. @media (min-width: ${p => p.theme.breakpoints.medium}) {
  633. flex-direction: row;
  634. }
  635. `;
  636. const ReleasesPageFilterBar = styled(PageFilterBar)`
  637. margin-bottom: ${space(2)};
  638. `;
  639. const SortAndFilterWrapper = styled('div')`
  640. display: grid;
  641. grid-template-columns: 1fr repeat(3, max-content);
  642. gap: ${space(2)};
  643. margin-bottom: ${space(2)};
  644. @media (max-width: ${p => p.theme.breakpoints.medium}) {
  645. grid-template-columns: repeat(3, 1fr);
  646. & > div {
  647. width: auto;
  648. }
  649. }
  650. @media (max-width: ${p => p.theme.breakpoints.small}) {
  651. grid-template-columns: minmax(0, 1fr);
  652. }
  653. `;
  654. const StyledSmartSearchBar = styled(SmartSearchBar)`
  655. @media (max-width: ${p => p.theme.breakpoints.medium}) {
  656. grid-column: 1 / -1;
  657. }
  658. `;
  659. export default withApi(withProjects(withOrganization(withPageFilters(ReleasesList))));