index.tsx 24 KB

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