index.tsx 24 KB

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