Skip to content

Commit 73e11fe

Browse files
committed
add empty states for the detector and workflow list views
1 parent 9761c41 commit 73e11fe

File tree

2 files changed

+41
-9
lines changed
  • static/app/views
    • automations/components/automationListTable
    • detectors/components/detectorListTable

2 files changed

+41
-9
lines changed

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

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import styled from '@emotion/styled';
33

44
import NoAlertsImage from 'sentry-images/features/alerts-not-found.svg';
55

6-
import {Button} from '@sentry/scraps/button';
6+
import {LinkButton} from '@sentry/scraps/button';
77
import {Flex} from '@sentry/scraps/layout';
88
import {Text} from '@sentry/scraps/text';
99

@@ -15,6 +15,7 @@ import {IconSearch} from 'sentry/icons';
1515
import {t} from 'sentry/locale';
1616
import type {Automation} from 'sentry/types/workflowEngine/automations';
1717
import type {Sort} from 'sentry/utils/discover/fields';
18+
import {decodeScalar} from 'sentry/utils/queryString';
1819
import {useLocation} from 'sentry/utils/useLocation';
1920
import {useNavigate} from 'sentry/utils/useNavigate';
2021
import {useOrganization} from 'sentry/utils/useOrganization';
@@ -24,6 +25,7 @@ import {
2425
AutomationListRowSkeleton,
2526
} from 'sentry/views/automations/components/automationListTable/row';
2627
import {AUTOMATION_LIST_PAGE_LIMIT} from 'sentry/views/automations/constants';
28+
import {makeMonitorBasePathname} from 'sentry/views/detectors/pathnames';
2729

2830
type AutomationListTableProps = {
2931
allResultsVisible: boolean;
@@ -88,6 +90,7 @@ export function AutomationListTable({
8890
queryCount,
8991
allResultsVisible,
9092
}: AutomationListTableProps) {
93+
const location = useLocation();
9194
const organization = useOrganization();
9295
const canEditAutomations = hasEveryAccess(['alerts:write'], {organization});
9396

@@ -178,17 +181,27 @@ export function AutomationListTable({
178181
/>
179182
)}
180183
{isSuccess && automations.length === 0 && (
181-
{/* TODO - pull this out so it's on it's own */}
182184
<SimpleTable.Empty>
183-
{/* TODO - Gap 16px, padding 56px */}
184-
<Flex direction="column" align="center">
185+
<StyledFlex gap="xl" direction="column" align="center">
185186
<img src={NoAlertsImage} />
186187
<Text as="h5">{t('No alerts found.')}</Text>
187-
<Text>{t('Looking for a monitor? Try looking on the monitors page')}</Text>
188-
<Button icon={<IconSearch />} priority="primary">
188+
<Text align="center" variant="muted">
189+
{t('Looking for a monitor? Try looking on the monitors page')}
190+
</Text>
191+
192+
<LinkButton
193+
icon={<IconSearch />}
194+
priority="primary"
195+
to={{
196+
pathname: makeMonitorBasePathname(organization.slug),
197+
query: {
198+
query: decodeScalar(location.query?.query),
199+
},
200+
}}
201+
>
189202
{t('Search Monitors')}
190-
</Button>
191-
</Flex>
203+
</LinkButton>
204+
</StyledFlex>
192205
</SimpleTable.Empty>
193206
)}
194207
{isError && <LoadingError message={t('Error loading alerts')} />}
@@ -206,6 +219,10 @@ export function AutomationListTable({
206219
);
207220
}
208221

222+
const StyledFlex = styled(Flex)`
223+
padding: 56px;
224+
`;
225+
209226
const AutomationsSimpleTable = styled(SimpleTable)`
210227
grid-template-columns: 1fr;
211228

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 {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+
<Text as="h5">{t('No monitors found.')}</Text>
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
@@ -505,6 +516,10 @@ const VisualizationHeaderContainer = styled(Container)`
505516
grid-column: -3 / -1;
506517
`;
507518

519+
const StyledFlex = styled(Flex)`
520+
padding: 56px;
521+
`;
522+
508523
const VisualizationExpandButton = styled('div')`
509524
grid-row: 1;
510525
grid-column: -1;

0 commit comments

Comments
 (0)