import {Fragment, useCallback} from 'react'; import { addErrorMessage, addLoadingMessage, addSuccessMessage, } from 'sentry/actionCreators/indicator'; import Access from 'sentry/components/acl/access'; import {Button} from 'sentry/components/button'; import Confirm from 'sentry/components/confirm'; import DateTime from 'sentry/components/dateTime'; import FieldGroup from 'sentry/components/forms/fieldGroup'; import BooleanField from 'sentry/components/forms/fields/booleanField'; import TextField from 'sentry/components/forms/fields/textField'; import Form from 'sentry/components/forms/form'; import Panel from 'sentry/components/panels/panel'; import PanelAlert from 'sentry/components/panels/panelAlert'; import PanelBody from 'sentry/components/panels/panelBody'; import PanelHeader from 'sentry/components/panels/panelHeader'; import {t} from 'sentry/locale'; import type {Organization, Project, ProjectKey} from 'sentry/types'; import useApi from 'sentry/utils/useApi'; import KeyRateLimitsForm from 'sentry/views/settings/project/projectKeys/details/keyRateLimitsForm'; import {LoaderSettings} from 'sentry/views/settings/project/projectKeys/details/loaderSettings'; import ProjectKeyCredentials from 'sentry/views/settings/project/projectKeys/projectKeyCredentials'; type Props = { data: ProjectKey; onRemove: () => void; organization: Organization; params: { keyId: string; projectId: string; }; project: Project; updateData: (data: ProjectKey) => void; }; export function KeySettings({ onRemove, organization, project, params, data, updateData, }: Props) { const api = useApi(); const {keyId, projectId} = params; const apiEndpoint = `/projects/${organization.slug}/${projectId}/keys/${keyId}/`; const handleRemove = useCallback(async () => { addLoadingMessage(t('Revoking key\u2026')); try { await api.requestPromise( `/projects/${organization.slug}/${projectId}/keys/${keyId}/`, { method: 'DELETE', } ); onRemove(); addSuccessMessage(t('Revoked key')); } catch (_err) { addErrorMessage(t('Unable to revoke key')); } }, [organization, api, onRemove, keyId, projectId]); return ( {({hasAccess}) => (
{t('Details')}
{t('JavaScript Loader Script')} {t( 'Note that it can take a few minutes until changed options are live.' )} {t('Credentials')} {t( 'Your credentials are coupled to a public and secret key. Different clients will require different credentials, so make sure you check the documentation before plugging things in.' )}
)}
{({hasAccess}) => ( {t('Revoke Key')}
)}
); }