Skip to content

Commit d4c66aa

Browse files
authored
1 parent 7b39044 commit d4c66aa

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

static/app/views/automations/components/automationListTable/index.tsx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import {useCallback, useMemo, useState, type ComponentProps} from 'react';
22
import styled from '@emotion/styled';
3+
import {parseAsString, useQueryState} from 'nuqs';
34

5+
import NoAlertsImage from 'sentry-images/features/alerts-not-found.svg';
6+
7+
import {LinkButton} from '@sentry/scraps/button';
48
import {Flex} from '@sentry/scraps/layout';
9+
import {Heading, Text} from '@sentry/scraps/text';
510

611
import {hasEveryAccess} from 'sentry/components/acl/access';
712
import {LoadingError} from 'sentry/components/loadingError';
813
import {SimpleTable} from 'sentry/components/tables/simpleTable';
914
import {SelectAllHeaderCheckbox} from 'sentry/components/workflowEngine/ui/selectAllHeaderCheckbox';
15+
import {IconSearch} from 'sentry/icons';
1016
import {t} from 'sentry/locale';
1117
import type {Automation} from 'sentry/types/workflowEngine/automations';
1218
import type {Sort} from 'sentry/utils/discover/fields';
@@ -19,6 +25,7 @@ import {
1925
AutomationListRowSkeleton,
2026
} from 'sentry/views/automations/components/automationListTable/row';
2127
import {AUTOMATION_LIST_PAGE_LIMIT} from 'sentry/views/automations/constants';
28+
import {makeMonitorBasePathname} from 'sentry/views/detectors/pathnames';
2229

2330
type AutomationListTableProps = {
2431
allResultsVisible: boolean;
@@ -85,7 +92,7 @@ export function AutomationListTable({
8592
}: AutomationListTableProps) {
8693
const organization = useOrganization();
8794
const canEditAutomations = hasEveryAccess(['alerts:write'], {organization});
88-
95+
const [query] = useQueryState('query', parseAsString);
8996
const [selected, setSelected] = useState(new Set<string>());
9097

9198
const togglePageSelected = (pageSelected: boolean) => {
@@ -173,7 +180,26 @@ export function AutomationListTable({
173180
/>
174181
)}
175182
{isSuccess && automations.length === 0 && (
176-
<SimpleTable.Empty>{t('No alerts found')}</SimpleTable.Empty>
183+
<SimpleTable.Empty>
184+
<StyledFlex gap="xl" direction="column" align="center">
185+
<img src={NoAlertsImage} />
186+
<Heading as="h3">{t('No alerts found.')}</Heading>
187+
<Text align="center" variant="muted">
188+
{t('Try out that same query on the Monitors page.')}
189+
</Text>
190+
191+
<LinkButton
192+
icon={<IconSearch />}
193+
priority="primary"
194+
to={{
195+
pathname: makeMonitorBasePathname(organization.slug),
196+
query: {query},
197+
}}
198+
>
199+
{t('Search Monitors')}
200+
</LinkButton>
201+
</StyledFlex>
202+
</SimpleTable.Empty>
177203
)}
178204
{isError && <LoadingError message={t('Error loading alerts')} />}
179205
{isPending && <LoadingSkeletons />}
@@ -190,6 +216,10 @@ export function AutomationListTable({
190216
);
191217
}
192218

219+
const StyledFlex = styled(Flex)`
220+
padding: ${p => p.theme.size.sm};
221+
`;
222+
193223
const AutomationsSimpleTable = styled(SimpleTable)`
194224
grid-template-columns: 1fr;
195225

static/app/views/detectors/components/detectorListTable/index.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ import {css, type Theme} from '@emotion/react';
1010
import styled from '@emotion/styled';
1111
import {useQueryState} from 'nuqs';
1212

13+
import NoAlertsImage from 'sentry-images/features/alerts-not-found.svg';
14+
1315
import {Button} from '@sentry/scraps/button';
1416
import {Container, Flex} from '@sentry/scraps/layout';
17+
import {Heading, Text} from '@sentry/scraps/text';
1518

1619
import {
1720
GridLineLabels,
@@ -242,7 +245,15 @@ export function DetectorListTable({
242245
{isError && <SimpleTable.Empty>{t('Error loading monitors')}</SimpleTable.Empty>}
243246
{isPending && <LoadingSkeletons />}
244247
{isSuccess && detectors.length === 0 && (
245-
<SimpleTable.Empty>{t('No monitors found')}</SimpleTable.Empty>
248+
<SimpleTable.Empty>
249+
<StyledFlex gap="xl" direction="column" align="center">
250+
<img src={NoAlertsImage} />
251+
<Heading as="h3">{t('No monitors found.')}</Heading>
252+
<Text align="center" variant="muted">
253+
{t("Sorry, we couldn't find what you were looking for.")}
254+
</Text>
255+
</StyledFlex>
256+
</SimpleTable.Empty>
246257
)}
247258
{hasVisualization && (
248259
<PositionedGridLineOverlay
@@ -504,6 +515,10 @@ const VisualizationHeaderContainer = styled(Container)`
504515
grid-column: -3 / -1;
505516
`;
506517

518+
const StyledFlex = styled(Flex)`
519+
padding: ${p => p.theme.size.xs};
520+
`;
521+
507522
const VisualizationExpandButton = styled('div')`
508523
grid-row: 1;
509524
grid-column: -1;

static/images/features/alerts-not-found.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)