Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions static/app/views/alerts/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default function Create() {
const title = t('New Alert Rule');

return (
<Fragment>
<Layout.Page>
<SentryDocumentTitle title={title} projectSlug={project.slug} />
<Layout.Header>
<Layout.HeaderContent>
Expand Down Expand Up @@ -228,6 +228,6 @@ export default function Create() {
</Fragment>
)}
</Layout.Body>
</Fragment>
</Layout.Page>
);
}
4 changes: 2 additions & 2 deletions static/app/views/alerts/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function ProjectAlertsEditor() {
const {teams, isLoading: teamsLoading} = useUserTeams();

return (
<Fragment>
<Layout.Page>
<SentryDocumentTitle
title={title}
orgSlug={organization.slug}
Expand Down Expand Up @@ -133,6 +133,6 @@ export default function ProjectAlertsEditor() {
</Fragment>
)}
</Layout.Body>
</Fragment>
</Layout.Page>
);
}
66 changes: 35 additions & 31 deletions static/app/views/alerts/list/incidents/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,28 +263,30 @@ class IncidentsList extends DeprecatedAsyncComponent<

return (
<SentryDocumentTitle title={t('Alerts')} orgSlug={organization.slug}>
<PageFiltersContainer>
<AlertHeader activeTab="stream" />
<Layout.Body>
<Layout.Main width="full">
{!this.tryRenderOnboarding() && (
<Fragment>
<StyledAlert variant="info">
{t('This page only shows metric alerts.')}
</StyledAlert>
<FilterBar
location={location}
onChangeFilter={this.handleChangeFilter}
onChangeSearch={this.handleChangeSearch}
onChangeStatus={this.handleChangeStatus}
hasStatusFilters
/>
</Fragment>
)}
{this.renderList()}
</Layout.Main>
</Layout.Body>
</PageFiltersContainer>
<Layout.Page>
<PageFiltersContainer>
<AlertHeader activeTab="stream" />
<Layout.Body>
<Layout.Main width="full">
{!this.tryRenderOnboarding() && (
<Fragment>
<StyledAlert variant="info">
{t('This page only shows metric alerts.')}
</StyledAlert>
<FilterBar
location={location}
onChangeFilter={this.handleChangeFilter}
onChangeSearch={this.handleChangeSearch}
onChangeStatus={this.handleChangeStatus}
hasStatusFilters
/>
</Fragment>
)}
{this.renderList()}
</Layout.Main>
</Layout.Body>
</PageFiltersContainer>
</Layout.Page>
</SentryDocumentTitle>
);
}
Expand All @@ -303,15 +305,17 @@ export default function IncidentsListContainer() {
}, []);

const renderDisabled = () => (
<Layout.Body>
<Layout.Main width="full">
<Alert.Container>
<Alert variant="warning" showIcon={false}>
{t("You don't have access to this feature")}
</Alert>
</Alert.Container>
</Layout.Main>
</Layout.Body>
<Layout.Page>
<Layout.Body>
<Layout.Main width="full">
<Alert.Container>
<Alert variant="warning" showIcon={false}>
{t("You don't have access to this feature")}
</Alert>
</Alert.Container>
</Layout.Main>
</Layout.Body>
</Layout.Page>
);

return (
Expand Down
246 changes: 124 additions & 122 deletions static/app/views/alerts/list/rules/alertRulesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,132 +210,134 @@ export default function AlertRulesList() {
<Fragment>
<SentryDocumentTitle title={t('Alerts')} orgSlug={organization.slug} />

<PageFiltersContainer>
<AlertHeader activeTab="rules" />
<Layout.Body>
<Layout.Main width="full">
<DataConsentBanner source="alerts" />
{!hasMetricAlertsFeature && hasAnyMetricAlerts && (
<Alert.Container>
<Alert variant="danger">
Your metric alerts have been disabled. Upgrade your plan to re-enable
them.
</Alert>
</Alert.Container>
)}
<FilterBar
location={location}
onChangeFilter={handleChangeFilter}
onChangeSearch={handleChangeSearch}
onChangeAlertType={handleChangeType}
hasTypeFilter
/>
<StyledPanelTable
isLoading={isPending}
isEmpty={ruleList.length === 0 && !isError}
emptyMessage={t('No alert rules found for the current query.')}
headers={[
<StyledSortLink
key="name"
role="columnheader"
aria-sort={
sort.field === 'name'
? sort.asc
? 'ascending'
: 'descending'
: 'none'
}
to={{
pathname: location.pathname,
query: {
...currentQuery,
// sort by name should start by ascending on first click
asc: sort.field === 'name' && sort.asc ? undefined : '1',
sort: 'name',
},
}}
>
{t('Alert Rule')} {sort.field === 'name' ? sortArrow : null}
</StyledSortLink>,
<StyledSortLink
key="status"
role="columnheader"
aria-sort={
isAlertRuleSort ? (sort.asc ? 'ascending' : 'descending') : 'none'
}
to={{
pathname: location.pathname,
query: {
...currentQuery,
asc: isAlertRuleSort && !sort.asc ? '1' : undefined,
sort: ['incident_status', 'date_triggered'],
},
}}
>
{t('Status')} {isAlertRuleSort ? sortArrow : null}
</StyledSortLink>,
t('Project'),
t('Team'),
t('Actions'),
]}
>
{isError ? (
<StyledLoadingError
message={t('There was an error loading alerts.')}
onRetry={refetch}
/>
) : null}
<VisuallyCompleteWithData
id="AlertRules-Body"
hasData={ruleList.length > 0}
<Layout.Page>
<PageFiltersContainer>
<AlertHeader activeTab="rules" />
<Layout.Body>
<Layout.Main width="full">
<DataConsentBanner source="alerts" />
{!hasMetricAlertsFeature && hasAnyMetricAlerts && (
<Alert.Container>
<Alert variant="danger">
Your metric alerts have been disabled. Upgrade your plan to re-enable
them.
</Alert>
</Alert.Container>
)}
<FilterBar
location={location}
onChangeFilter={handleChangeFilter}
onChangeSearch={handleChangeSearch}
onChangeAlertType={handleChangeType}
hasTypeFilter
/>
<StyledPanelTable
isLoading={isPending}
isEmpty={ruleList.length === 0 && !isError}
emptyMessage={t('No alert rules found for the current query.')}
headers={[
<StyledSortLink
key="name"
role="columnheader"
aria-sort={
sort.field === 'name'
? sort.asc
? 'ascending'
: 'descending'
: 'none'
}
to={{
pathname: location.pathname,
query: {
...currentQuery,
// sort by name should start by ascending on first click
asc: sort.field === 'name' && sort.asc ? undefined : '1',
sort: 'name',
},
}}
>
{t('Alert Rule')} {sort.field === 'name' ? sortArrow : null}
</StyledSortLink>,
<StyledSortLink
key="status"
role="columnheader"
aria-sort={
isAlertRuleSort ? (sort.asc ? 'ascending' : 'descending') : 'none'
}
to={{
pathname: location.pathname,
query: {
...currentQuery,
asc: isAlertRuleSort && !sort.asc ? '1' : undefined,
sort: ['incident_status', 'date_triggered'],
},
}}
>
{t('Status')} {isAlertRuleSort ? sortArrow : null}
</StyledSortLink>,
t('Project'),
t('Team'),
t('Actions'),
]}
>
<Projects orgId={organization.slug} slugs={projectsFromResults}>
{({initiallyLoaded, projects}) =>
ruleList.map(rule => {
const isIssueAlertInstance = isIssueAlert(rule);
const keyPrefix = isIssueAlertInstance
? AlertRuleType.ISSUE
: rule.type === CombinedAlertType.UPTIME
? AlertRuleType.UPTIME
: AlertRuleType.METRIC;
{isError ? (
<StyledLoadingError
message={t('There was an error loading alerts.')}
onRetry={refetch}
/>
) : null}
<VisuallyCompleteWithData
id="AlertRules-Body"
hasData={ruleList.length > 0}
>
<Projects orgId={organization.slug} slugs={projectsFromResults}>
{({initiallyLoaded, projects}) =>
ruleList.map(rule => {
const isIssueAlertInstance = isIssueAlert(rule);
const keyPrefix = isIssueAlertInstance
? AlertRuleType.ISSUE
: rule.type === CombinedAlertType.UPTIME
? AlertRuleType.UPTIME
: AlertRuleType.METRIC;

return (
<RuleListRow
// Metric and issue alerts can have the same id
key={`${keyPrefix}-${rule.id}`}
projectsLoaded={initiallyLoaded}
projects={projects as Project[]}
rule={rule}
organization={organization}
onOwnerChange={handleOwnerChange}
onDelete={handleDeleteRule}
hasEditAccess={hasEditAccess}
hasMetricAlerts={hasMetricAlertsFeature}
/>
);
})
return (
<RuleListRow
// Metric and issue alerts can have the same id
key={`${keyPrefix}-${rule.id}`}
projectsLoaded={initiallyLoaded}
projects={projects as Project[]}
rule={rule}
organization={organization}
onOwnerChange={handleOwnerChange}
onDelete={handleDeleteRule}
hasEditAccess={hasEditAccess}
hasMetricAlerts={hasMetricAlertsFeature}
/>
);
})
}
</Projects>
</VisuallyCompleteWithData>
</StyledPanelTable>
<Pagination
pageLinks={ruleListPageLinks}
onCursor={(cursor, path, _direction) => {
let team = currentQuery.team;
// Keep team parameter, but empty to remove parameters
if (!team || team.length === 0) {
team = '';
}
</Projects>
</VisuallyCompleteWithData>
</StyledPanelTable>
<Pagination
pageLinks={ruleListPageLinks}
onCursor={(cursor, path, _direction) => {
let team = currentQuery.team;
// Keep team parameter, but empty to remove parameters
if (!team || team.length === 0) {
team = '';
}

navigate({
pathname: path,
query: {...currentQuery, team, cursor},
});
}}
/>
</Layout.Main>
</Layout.Body>
</PageFiltersContainer>
navigate({
pathname: path,
query: {...currentQuery, team, cursor},
});
}}
/>
</Layout.Main>
</Layout.Body>
</PageFiltersContainer>
</Layout.Page>
</Fragment>
);
}
Expand Down
Loading
Loading