mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
FSL-1.0-Apache-2.0 grants us the code, not the name. "Sentry" is Functional Software's trademark, so every place the running app says it to a user -- page titles, onboarding, empty states, toasts, settings copy, the self-hosted footer -- now says Sentinel. Attribution is the other half of the deal and stays untouched: upstream copyright headers, LICENSE, NOTICE. So does anything where the mark is a fact rather than a brand -- @sentry/* packages, sentry-cli, the wizard and bundler plugins, docs.sentry.io, the whole gettingStartedDocs tree. Renaming those would leave instructions that no longer work. Nothing structural moved. No import, identifier, route path, feature flag, API field or test id changed; the diff is 312 lines in and 312 out. Colocated specs were updated in lockstep with the copy they assert. Marketing and community links point at hanzo.ai, only where a real page exists to point at. Co-authored-by: Hanzo Dev <[email protected]>
132 lines
4.5 KiB
TypeScript
132 lines
4.5 KiB
TypeScript
import {Component} from 'react';
|
|
import {browserHistory} from 'react-router';
|
|
|
|
import ApiForm from 'sentry/components/forms/apiForm';
|
|
import TextField from 'sentry/components/forms/fields/textField';
|
|
import ExternalLink from 'sentry/components/links/externalLink';
|
|
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 {t, tct} from 'sentry/locale';
|
|
import type {NewInternalAppApiToken, Permissions} from 'sentry/types';
|
|
import getDynamicText from 'sentry/utils/getDynamicText';
|
|
import {normalizeUrl} from 'sentry/utils/withDomainRequired';
|
|
import NewTokenHandler from 'sentry/views/settings/components/newTokenHandler';
|
|
import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
|
|
import TextBlock from 'sentry/views/settings/components/text/textBlock';
|
|
import PermissionSelection from 'sentry/views/settings/organizationDeveloperSettings/permissionSelection';
|
|
|
|
const API_INDEX_ROUTE = '/settings/account/api/auth-tokens/';
|
|
type State = {
|
|
name: string | null;
|
|
newToken: NewInternalAppApiToken | null;
|
|
permissions: Permissions;
|
|
};
|
|
|
|
export default class ApiNewToken extends Component<{}, State> {
|
|
constructor(props: {}) {
|
|
super(props);
|
|
this.state = {
|
|
name: null,
|
|
permissions: {
|
|
Event: 'no-access',
|
|
Team: 'no-access',
|
|
Member: 'no-access',
|
|
Project: 'no-access',
|
|
Release: 'no-access',
|
|
Organization: 'no-access',
|
|
},
|
|
newToken: null,
|
|
};
|
|
}
|
|
|
|
onCancel = () => {
|
|
browserHistory.push(normalizeUrl(API_INDEX_ROUTE));
|
|
};
|
|
|
|
handleGoBack = () => {
|
|
browserHistory.push(normalizeUrl(API_INDEX_ROUTE));
|
|
};
|
|
|
|
render() {
|
|
const {permissions, newToken} = this.state;
|
|
|
|
return (
|
|
<SentryDocumentTitle title={t('Create User Auth Token')}>
|
|
<div>
|
|
<SettingsPageHeader title={t('Create New User Auth Token')} />
|
|
<TextBlock>
|
|
{t(
|
|
"Authentication tokens allow you to perform actions against the Sentinel API on behalf of your account. They're the easiest way to get started using the API."
|
|
)}
|
|
</TextBlock>
|
|
<TextBlock>
|
|
{tct(
|
|
'For more information on how to use the web API, see our [link:documentation].',
|
|
{
|
|
link: <ExternalLink href="https://docs.sentry.io/api/" />,
|
|
}
|
|
)}
|
|
</TextBlock>
|
|
{newToken !== null ? (
|
|
<NewTokenHandler
|
|
token={
|
|
getDynamicText({value: newToken.token, fixed: 'CI_AUTH_TOKEN'}) ||
|
|
'CI_AUTH_TOKEN'
|
|
}
|
|
handleGoBack={this.handleGoBack}
|
|
/>
|
|
) : (
|
|
<div>
|
|
<ApiForm
|
|
apiMethod="POST"
|
|
apiEndpoint="/api-tokens/"
|
|
initialData={{scopes: [], name: ''}}
|
|
onSubmitSuccess={response => {
|
|
this.setState({newToken: response});
|
|
}}
|
|
onCancel={this.onCancel}
|
|
footerStyle={{
|
|
marginTop: 0,
|
|
paddingRight: 20,
|
|
}}
|
|
submitDisabled={Object.values(permissions).every(
|
|
value => value === 'no-access'
|
|
)}
|
|
submitLabel={t('Create Token')}
|
|
>
|
|
<Panel>
|
|
<PanelHeader>{t('General')}</PanelHeader>
|
|
<PanelBody>
|
|
<TextField
|
|
name="name"
|
|
label={t('Name')}
|
|
help={t('A name to help you identify this token.')}
|
|
onChange={value => {
|
|
this.setState({name: value});
|
|
}}
|
|
/>
|
|
</PanelBody>
|
|
</Panel>
|
|
<Panel>
|
|
<PanelHeader>{t('Permissions')}</PanelHeader>
|
|
<PanelBody>
|
|
<PermissionSelection
|
|
appPublished={false}
|
|
permissions={permissions}
|
|
onChange={value => {
|
|
this.setState({permissions: value});
|
|
}}
|
|
/>
|
|
</PanelBody>
|
|
</Panel>
|
|
</ApiForm>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</SentryDocumentTitle>
|
|
);
|
|
}
|
|
}
|