|
@@ -4,16 +4,13 @@ import styled from '@emotion/styled';
|
|
|
|
|
|
import Feature from 'app/components/acl/feature';
|
|
|
import CreateAlertButton from 'app/components/createAlertButton';
|
|
|
+import * as Layout from 'app/components/layouts/thirds';
|
|
|
import ExternalLink from 'app/components/links/externalLink';
|
|
|
import List from 'app/components/list';
|
|
|
import ListItem from 'app/components/list/listItem';
|
|
|
-import PageHeading from 'app/components/pageHeading';
|
|
|
-import {PanelBody} from 'app/components/panels';
|
|
|
-import Placeholder from 'app/components/placeholder';
|
|
|
+import {Panel, PanelBody, PanelHeader} from 'app/components/panels';
|
|
|
import SentryDocumentTitle from 'app/components/sentryDocumentTitle';
|
|
|
-import Tag from 'app/components/tag';
|
|
|
import {t} from 'app/locale';
|
|
|
-import {PageContent, PageHeader} from 'app/styles/organization';
|
|
|
import space from 'app/styles/space';
|
|
|
import {Organization, Project} from 'app/types';
|
|
|
import BuilderBreadCrumbs from 'app/views/alerts/builder/builderBreadCrumbs';
|
|
@@ -25,7 +22,6 @@ import {
|
|
|
AlertWizardOptions,
|
|
|
AlertWizardPanelContent,
|
|
|
AlertWizardRuleTemplates,
|
|
|
- WebVitalAlertTypes,
|
|
|
} from './options';
|
|
|
import RadioPanelGroup from './radioPanelGroup';
|
|
|
|
|
@@ -94,101 +90,104 @@ class AlertWizard extends React.Component<Props, State> {
|
|
|
return (
|
|
|
<React.Fragment>
|
|
|
<SentryDocumentTitle title={title} projectSlug={projectId} />
|
|
|
- <PageContent>
|
|
|
- <Feature features={['organizations:alert-wizard']}>
|
|
|
- <BuilderBreadCrumbs
|
|
|
- hasMetricAlerts={hasMetricAlerts}
|
|
|
- orgSlug={organization.slug}
|
|
|
- projectSlug={projectId}
|
|
|
- title={t('Create Alert Rule')}
|
|
|
- />
|
|
|
- <StyledPageHeader>
|
|
|
- <PageHeading>{t('What should we alert you about?')}</PageHeading>
|
|
|
- </StyledPageHeader>
|
|
|
- <Styledh2>{t('Errors')}</Styledh2>
|
|
|
- <WizardBody>
|
|
|
- <WizardOptions>
|
|
|
- {AlertWizardOptions.map(({categoryHeading, options}, i) => (
|
|
|
- <OptionsWrapper key={categoryHeading}>
|
|
|
- {i > 0 && <Styledh2>{categoryHeading}</Styledh2>}
|
|
|
- <RadioPanelGroup
|
|
|
- choices={options.map(alertType => {
|
|
|
- return [
|
|
|
- alertType,
|
|
|
- AlertWizardAlertNames[alertType],
|
|
|
- ...(WebVitalAlertTypes.has(alertType)
|
|
|
- ? [<Tag key={alertType}>{t('Web Vital')}</Tag>]
|
|
|
- : []),
|
|
|
- ] as [AlertType, string, React.ReactNode];
|
|
|
- })}
|
|
|
- onChange={this.handleChangeAlertOption}
|
|
|
- value={alertOption}
|
|
|
- label="alert-option"
|
|
|
- />
|
|
|
- </OptionsWrapper>
|
|
|
- ))}
|
|
|
- </WizardOptions>
|
|
|
- <WizardPanel visible={!!panelContent && !!alertOption}>
|
|
|
- {panelContent && alertOption && (
|
|
|
+
|
|
|
+ <Feature features={['organizations:alert-wizard']}>
|
|
|
+ <Layout.Header>
|
|
|
+ <Layout.HeaderContent>
|
|
|
+ <BuilderBreadCrumbs
|
|
|
+ hasMetricAlerts={hasMetricAlerts}
|
|
|
+ orgSlug={organization.slug}
|
|
|
+ projectSlug={projectId}
|
|
|
+ title={t('Create Alert Rule')}
|
|
|
+ />
|
|
|
+ <Layout.Title>{t('What should we alert you about?')}</Layout.Title>
|
|
|
+ </Layout.HeaderContent>
|
|
|
+ </Layout.Header>
|
|
|
+ <StyledLayoutBody>
|
|
|
+ <Layout.Main fullWidth>
|
|
|
+ <WizardBody>
|
|
|
+ <WizardOptions>
|
|
|
+ <Styledh2>{t('Errors')}</Styledh2>
|
|
|
+ {AlertWizardOptions.map(({categoryHeading, options}, i) => (
|
|
|
+ <OptionsWrapper key={categoryHeading}>
|
|
|
+ {i > 0 && <Styledh2>{categoryHeading}</Styledh2>}
|
|
|
+ <RadioPanelGroup
|
|
|
+ choices={options.map(alertType => {
|
|
|
+ return [alertType, AlertWizardAlertNames[alertType]];
|
|
|
+ })}
|
|
|
+ onChange={this.handleChangeAlertOption}
|
|
|
+ value={alertOption}
|
|
|
+ label="alert-option"
|
|
|
+ />
|
|
|
+ </OptionsWrapper>
|
|
|
+ ))}
|
|
|
+ </WizardOptions>
|
|
|
+ <WizardPanel visible={!!panelContent && !!alertOption}>
|
|
|
<WizardPanelBody>
|
|
|
- <Styledh2>{AlertWizardAlertNames[alertOption]}</Styledh2>
|
|
|
- <PanelDescription>
|
|
|
- {panelContent.description}{' '}
|
|
|
- {panelContent.docsLink && (
|
|
|
- <ExternalLink href={panelContent.docsLink}>
|
|
|
- {t('Learn more')}
|
|
|
- </ExternalLink>
|
|
|
- )}
|
|
|
- </PanelDescription>
|
|
|
- <WizardBodyPlaceholder height="250px" />
|
|
|
- <ExampleHeader>{t('Examples')}</ExampleHeader>
|
|
|
- <List symbol="bullet">
|
|
|
- {panelContent.examples.map((example, i) => (
|
|
|
- <ExampleItem key={i}>{example}</ExampleItem>
|
|
|
- ))}
|
|
|
- </List>
|
|
|
+ {panelContent && alertOption && (
|
|
|
+ <div>
|
|
|
+ <PanelHeader>{AlertWizardAlertNames[alertOption]}</PanelHeader>
|
|
|
+ <PanelBody withPadding>
|
|
|
+ <PanelDescription>
|
|
|
+ {panelContent.description}{' '}
|
|
|
+ {panelContent.docsLink && (
|
|
|
+ <ExternalLink href={panelContent.docsLink}>
|
|
|
+ {t('Learn more')}
|
|
|
+ </ExternalLink>
|
|
|
+ )}
|
|
|
+ </PanelDescription>
|
|
|
+ <WizardImage src={panelContent.illustration} />
|
|
|
+ <ExampleHeader>{t('Examples')}</ExampleHeader>
|
|
|
+ <ExampleList symbol="bullet">
|
|
|
+ {panelContent.examples.map((example, i) => (
|
|
|
+ <ExampleItem key={i}>{example}</ExampleItem>
|
|
|
+ ))}
|
|
|
+ </ExampleList>
|
|
|
+ </PanelBody>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ <WizardButton>{this.renderCreateAlertButton()}</WizardButton>
|
|
|
</WizardPanelBody>
|
|
|
- )}
|
|
|
- {this.renderCreateAlertButton()}
|
|
|
- </WizardPanel>
|
|
|
- </WizardBody>
|
|
|
- </Feature>
|
|
|
- </PageContent>
|
|
|
+ </WizardPanel>
|
|
|
+ </WizardBody>
|
|
|
+ </Layout.Main>
|
|
|
+ </StyledLayoutBody>
|
|
|
+ </Feature>
|
|
|
</React.Fragment>
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const StyledPageHeader = styled(PageHeader)`
|
|
|
- margin-bottom: ${space(4)};
|
|
|
-`;
|
|
|
-
|
|
|
-const WizardBodyPlaceholder = styled(Placeholder)`
|
|
|
- background-color: ${p => p.theme.border};
|
|
|
- opacity: 0.6;
|
|
|
+const StyledLayoutBody = styled(Layout.Body)`
|
|
|
+ margin-bottom: -${space(3)};
|
|
|
`;
|
|
|
|
|
|
const Styledh2 = styled('h2')`
|
|
|
font-weight: normal;
|
|
|
- font-size: ${p => p.theme.fontSizeExtraLarge};
|
|
|
+ font-size: ${p => p.theme.fontSizeLarge};
|
|
|
margin-bottom: ${space(1)} !important;
|
|
|
`;
|
|
|
|
|
|
const WizardBody = styled('div')`
|
|
|
display: flex;
|
|
|
+ padding-top: ${space(1)};
|
|
|
`;
|
|
|
|
|
|
const WizardOptions = styled('div')`
|
|
|
flex: 3;
|
|
|
margin-right: ${space(3)};
|
|
|
- border-right: 1px solid ${p => p.theme.innerBorder};
|
|
|
padding-right: ${space(3)};
|
|
|
+ max-width: 300px;
|
|
|
+`;
|
|
|
+
|
|
|
+const WizardImage = styled('img')`
|
|
|
+ max-height: 300px;
|
|
|
`;
|
|
|
|
|
|
-const WizardPanel = styled('div')<{visible?: boolean}>`
|
|
|
+const WizardPanel = styled(Panel)<{visible?: boolean}>`
|
|
|
+ max-width: 700px;
|
|
|
position: sticky;
|
|
|
top: 20px;
|
|
|
- padding: 0;
|
|
|
flex: 5;
|
|
|
display: flex;
|
|
|
${p => !p.visible && 'visibility: hidden'};
|
|
@@ -209,19 +208,21 @@ const WizardPanel = styled('div')<{visible?: boolean}>`
|
|
|
}
|
|
|
`;
|
|
|
|
|
|
+const ExampleList = styled(List)`
|
|
|
+ margin-bottom: ${space(2)} !important;
|
|
|
+`;
|
|
|
+
|
|
|
const WizardPanelBody = styled(PanelBody)`
|
|
|
- margin-bottom: ${space(2)};
|
|
|
flex: 1;
|
|
|
min-width: 100%;
|
|
|
`;
|
|
|
|
|
|
-const PanelDescription = styled('div')`
|
|
|
- color: ${p => p.theme.subText};
|
|
|
+const PanelDescription = styled('p')`
|
|
|
margin-bottom: ${space(2)};
|
|
|
`;
|
|
|
|
|
|
const ExampleHeader = styled('div')`
|
|
|
- margin: ${space(2)} 0;
|
|
|
+ margin: 0 0 ${space(1)} 0;
|
|
|
font-size: ${p => p.theme.fontSizeLarge};
|
|
|
`;
|
|
|
|
|
@@ -237,4 +238,9 @@ const OptionsWrapper = styled('div')`
|
|
|
}
|
|
|
`;
|
|
|
|
|
|
+const WizardButton = styled('div')`
|
|
|
+ border-top: 1px solid ${p => p.theme.border};
|
|
|
+ padding: ${space(1.5)} ${space(1.5)} ${space(1.5)} ${space(1.5)};
|
|
|
+`;
|
|
|
+
|
|
|
export default AlertWizard;
|