import {Fragment} from 'react'; import type {PlainRoute, RouteComponentProps} from 'react-router'; import styled from '@emotion/styled'; import AlertLink from 'sentry/components/alertLink'; import {Button} from 'sentry/components/button'; import ExternalLink from 'sentry/components/links/externalLink'; import Link from 'sentry/components/links/link'; import LinkWithConfirmation from 'sentry/components/links/linkWithConfirmation'; import {PanelTable} from 'sentry/components/panels/panelTable'; import TextCopyInput from 'sentry/components/textCopyInput'; import {IconAdd, IconDelete} from 'sentry/icons'; import {t, tct} from 'sentry/locale'; import type {Organization} from 'sentry/types/organization'; import recreateRoute from 'sentry/utils/recreateRoute'; import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader'; import TextBlock from 'sentry/views/settings/components/text/textBlock'; import type {DeprecatedApiKey} from './types'; type Props = RouteComponentProps<{}, {}> & { /** * Busy differs from loading in that busy is a result of an action like removing */ busy: boolean; keys: DeprecatedApiKey[]; /** * Loading refers to fetching the API Keys */ loading: boolean; onAddApiKey: () => {}; onRemove: (id: DeprecatedApiKey['id']) => {}; organization: Organization; routes: PlainRoute[]; }; function OrganizationApiKeysList({ organization, params, routes, keys, busy, loading, onAddApiKey, onRemove, }: Props) { const hasKeys = Boolean(keys?.length); const action = ( ); return (
{tct( `API keys grant access to the [api:developer web API]. If you're looking to configure a Sentry client, you'll need a client key which is available in your project settings.`, { api: , } )} {tct( 'Until Sentry supports OAuth, you might want to switch to using [tokens:User Auth Tokens] instead.', { tokens: , } )} {keys?.map(({id, key, label}) => { const apiDetailsUrl = recreateRoute(`${id}/`, { params: {...params, orgId: organization.slug}, routes, }); return ( {label} {key} onRemove(id)} message={t('Are you sure you want to remove this API key?')} title={t('Remove API Key?')} > ); })}
); } const Cell = styled('div')` display: flex; align-items: center; `; export default OrganizationApiKeysList;