index.tsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import {browserHistory, RouteComponentProps} from 'react-router';
  2. import {t} from 'sentry/locale';
  3. import AsyncView from 'sentry/views/asyncView';
  4. import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
  5. import PermissionAlert from 'sentry/views/settings/project/permissionAlert';
  6. import KeySettings from 'sentry/views/settings/project/projectKeys/details/keySettings';
  7. import KeyStats from 'sentry/views/settings/project/projectKeys/details/keyStats';
  8. import {ProjectKey} from 'sentry/views/settings/project/projectKeys/types';
  9. type Props = RouteComponentProps<
  10. {
  11. keyId: string;
  12. orgId: string;
  13. projectId: string;
  14. },
  15. {}
  16. >;
  17. type State = {
  18. data: ProjectKey;
  19. } & AsyncView['state'];
  20. export default class ProjectKeyDetails extends AsyncView<Props, State> {
  21. getTitle() {
  22. return t('Key Details');
  23. }
  24. getEndpoints(): ReturnType<AsyncView['getEndpoints']> {
  25. const {keyId, orgId, projectId} = this.props.params;
  26. return [['data', `/projects/${orgId}/${projectId}/keys/${keyId}/`]];
  27. }
  28. handleRemove = () => {
  29. const {orgId, projectId} = this.props.params;
  30. browserHistory.push(`/${orgId}/${projectId}/settings/keys/`);
  31. };
  32. renderBody() {
  33. const {data} = this.state;
  34. const {params} = this.props;
  35. return (
  36. <div data-test-id="key-details">
  37. <SettingsPageHeader title={t('Key Details')} />
  38. <PermissionAlert />
  39. <KeyStats api={this.api} params={params} />
  40. <KeySettings
  41. api={this.api}
  42. params={params}
  43. data={data}
  44. onRemove={this.handleRemove}
  45. />
  46. </div>
  47. );
  48. }
  49. }