import {addErrorMessage, addSuccessMessage} from 'sentry/actionCreators/indicator'; import ApiForm from 'sentry/components/forms/apiForm'; import MultipleCheckbox from 'sentry/components/forms/controls/multipleCheckbox'; import TextareaField from 'sentry/components/forms/fields/textareaField'; import TextField from 'sentry/components/forms/fields/textField'; import FormField from 'sentry/components/forms/formField'; import LoadingError from 'sentry/components/loadingError'; import LoadingIndicator from 'sentry/components/loadingIndicator'; import Panel from 'sentry/components/panels/panel'; import PanelBody from 'sentry/components/panels/panelBody'; import PanelHeader from 'sentry/components/panels/panelHeader'; import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle'; import {API_ACCESS_SCOPES} from 'sentry/constants'; import {t} from 'sentry/locale'; import {useApiQuery} from 'sentry/utils/queryClient'; import {useNavigate} from 'sentry/utils/useNavigate'; import useOrganization from 'sentry/utils/useOrganization'; import {useParams} from 'sentry/utils/useParams'; import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader'; import type {DeprecatedApiKey} from './types'; type RouteParams = { apiKey: string; }; function OrganizationApiKeyDetails() { const organization = useOrganization(); const params = useParams(); const navigate = useNavigate(); const { data: apiKey, isPending, isError, refetch, } = useApiQuery( [`/organizations/${organization.slug}/api-keys/${params.apiKey}/`], { staleTime: 0, } ); const handleSubmitSuccess = () => { addSuccessMessage('Saved changes'); // Go back to API list navigate(`/settings/${organization.slug}/api-keys/`); }; const handleSubmitError = () => { addErrorMessage('Unable to save changes. Please try again.'); }; if (isError) { return ; } if (isPending) { return ; } return (
{t('API Key')} navigate(`/settings/${organization.slug}/api-keys/`)} > {({name, value, onChange}: any) => ( {API_ACCESS_SCOPES.map(scope => ( {scope} ))} )}
); } export default OrganizationApiKeyDetails;