12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- 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 {Project} from 'sentry/types/project';
- import type {DebugIdBundle} from 'sentry/types/sourceMaps';
- 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)};
- `;
|