index.tsx 24 KB

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