Skip to content

chore(prevent): Repo token table polish #97538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import GridEditable, {type GridColumnHeader} from 'sentry/components/tables/gridEditable';
import GridEditable, {
COL_WIDTH_UNDEFINED,
type GridColumnHeader,
} from 'sentry/components/tables/gridEditable';
import {t} from 'sentry/locale';
import type {Sort} from 'sentry/utils/discover/fields';
import {renderTableBody} from 'sentry/views/codecov/tokens/repoTokenTable/tableBody';
Expand All @@ -9,7 +12,7 @@ type RepoTokenTableResponse = {
token: string;
};

export type Row = Pick<RepoTokenTableResponse, 'name' | 'token'>;
export type Row = RepoTokenTableResponse;
export type Column = GridColumnHeader<'name' | 'token' | 'regenerateToken'>;

type ValidField = (typeof SORTABLE_FIELDS)[number];
Expand All @@ -23,8 +26,8 @@ export type ValidSort = Sort & {
};

const COLUMNS_ORDER: Column[] = [
{key: 'name', name: t('Repository Name'), width: 400},
{key: 'token', name: t('Token'), width: 350},
{key: 'name', name: t('Repository Name'), width: COL_WIDTH_UNDEFINED},
{key: 'token', name: t('Token'), width: COL_WIDTH_UNDEFINED},
{key: 'regenerateToken', name: '', width: 100},
];

Expand Down
38 changes: 16 additions & 22 deletions static/app/views/codecov/tokens/tokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import styled from '@emotion/styled';
import {useCodecovContext} from 'sentry/components/codecov/context/codecovContext';
import {IntegratedOrgSelector} from 'sentry/components/codecov/integratedOrgSelector/integratedOrgSelector';
import {integratedOrgIdToName} from 'sentry/components/codecov/integratedOrgSelector/utils';
import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
import {Flex} from 'sentry/components/core/layout/flex';
import {Text} from 'sentry/components/core/text';
import Pagination from 'sentry/components/pagination';
import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import {t, tct} from 'sentry/locale';
import type {Integration} from 'sentry/types/integrations';
import {useApiQuery} from 'sentry/utils/queryClient';
import {decodeSorts} from 'sentry/utils/queryString';
Expand Down Expand Up @@ -72,36 +72,30 @@ export default function TokensPage() {
);

return (
<LayoutGap>
<PageFilterBar condensed>
<IntegratedOrgSelector />
</PageFilterBar>
<Flex direction="column" gap="xl" maxWidth="1000px">
<IntegratedOrgSelector />
<HeaderValue>{t('Repository tokens')}</HeaderValue>
<p>
{t('View the list of tokens created for your repositories in')}{' '}
<strong>{integratedOrgIdToName(integratedOrgId, integrations)}</strong>.{' '}
{t("Use them for uploading reports to all Sentry Prevent's features.")}
</p>
<Text>
{tct(
`View the list of tokens created for your repositories in [org]. Use them for uploading reports to all Sentry Prevent's features.`,
{
org: <Text bold>{integratedOrgIdToName(integratedOrgId, integrations)}</Text>,
}
)}
</Text>
<RepoTokenTable response={response} sort={sorts[0]} />
{/* We don't need to use the pageLinks prop because Codecov handles pagination using our own cursor implementation. But we need to
put a dummy value here because otherwise the component wouldn't render. */}
<StyledPagination pageLinks="showComponent" onCursor={handleCursor} />
</LayoutGap>
</Flex>
);
}

const LayoutGap = styled('div')`
display: grid;
gap: ${space(1)};
max-width: 1000px;
`;

const HeaderValue = styled('div')`
margin-top: ${space(4)};
font-size: ${p => p.theme.headerFontSize};
font-size: ${p => p.theme.fontSize['2xl']};
font-weight: ${p => p.theme.fontWeight.bold};
`;

const StyledPagination = styled(Pagination)`
margin-top: 0px;
margin: 0px;
`;
Loading