123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- import styled from '@emotion/styled';
- import EmptyMessage from 'sentry/components/emptyMessage';
- import Link from 'sentry/components/links/link';
- import LoadingIndicator from 'sentry/components/loadingIndicator';
- import Panel from 'sentry/components/panels/panel';
- import {IconList} from 'sentry/icons';
- import {space} from 'sentry/styles/space';
- import type {DebugIdBundle, Project} from 'sentry/types';
- import useOrganization from 'sentry/utils/useOrganization';
- import {DebugIdBundleDeleteButton} from 'sentry/views/settings/projectSourceMaps/debugIdBundleDeleteButton';
- import {DebugIdBundleDetails} from 'sentry/views/settings/projectSourceMaps/debugIdBundleDetails';
- interface DebugIdBundleListProps {
- emptyMessage: React.ReactNode;
- isLoading: boolean;
- onDelete: (bundleId: string) => void;
- project: Project;
- debugIdBundles?: DebugIdBundle[];
- }
- export function DebugIdBundleList({
- isLoading,
- debugIdBundles,
- emptyMessage,
- onDelete,
- project,
- }: DebugIdBundleListProps) {
- const organization = useOrganization();
- if (isLoading) {
- return <LoadingIndicator />;
- }
- if (!debugIdBundles || debugIdBundles.length === 0) {
- return <EmptyMessage>{emptyMessage}</EmptyMessage>;
- }
- return (
- <List>
- {debugIdBundles.map(debugIdBundle => (
- <Item key={debugIdBundle.bundleId}>
- <ItemHeader>
- <ItemTitle
- to={`/settings/${organization.slug}/projects/${
- project.slug
- }/source-maps/artifact-bundles/${encodeURIComponent(
- debugIdBundle.bundleId
- )}`}
- >
- <IconList /> {debugIdBundle.bundleId}
- </ItemTitle>
- <DebugIdBundleDeleteButton
- onDelete={() => onDelete(debugIdBundle.bundleId)}
- />
- </ItemHeader>
- <ItemContent>
- <DebugIdBundleDetails debugIdBundle={debugIdBundle} />
- </ItemContent>
- </Item>
- ))}
- </List>
- );
- }
- const List = styled('div')`
- display: grid;
- grid-template-columns: 1fr;
- gap: ${space(2)};
- `;
- const Item = styled(Panel)`
- margin: 0;
- `;
- const ItemHeader = styled('div')`
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-size: ${p => p.theme.fontSizeMedium};
- border-bottom: 1px solid ${p => p.theme.border};
- line-height: 1;
- padding: ${space(1)} ${space(2)};
- `;
- const ItemTitle = styled(Link)`
- display: flex;
- align-items: center;
- gap: ${space(1)};
- `;
- const ItemContent = styled('div')`
- padding: ${space(1)} ${space(2)};
- `;
|