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
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import {useCallback, useMemo, useState, type ComponentProps} from 'react';
import styled from '@emotion/styled';
import {parseAsString, useQueryState} from 'nuqs';

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

import {LinkButton} from '@sentry/scraps/button';
import {Flex} from '@sentry/scraps/layout';
import {Heading, Text} from '@sentry/scraps/text';

import {hasEveryAccess} from 'sentry/components/acl/access';
import {LoadingError} from 'sentry/components/loadingError';
import {SimpleTable} from 'sentry/components/tables/simpleTable';
import {SelectAllHeaderCheckbox} from 'sentry/components/workflowEngine/ui/selectAllHeaderCheckbox';
import {IconSearch} from 'sentry/icons';
import {t} from 'sentry/locale';
import type {Automation} from 'sentry/types/workflowEngine/automations';
import type {Sort} from 'sentry/utils/discover/fields';
Expand All @@ -19,6 +25,7 @@ import {
AutomationListRowSkeleton,
} from 'sentry/views/automations/components/automationListTable/row';
import {AUTOMATION_LIST_PAGE_LIMIT} from 'sentry/views/automations/constants';
import {makeMonitorBasePathname} from 'sentry/views/detectors/pathnames';

type AutomationListTableProps = {
allResultsVisible: boolean;
Expand Down Expand Up @@ -85,7 +92,7 @@ export function AutomationListTable({
}: AutomationListTableProps) {
const organization = useOrganization();
const canEditAutomations = hasEveryAccess(['alerts:write'], {organization});

const [query] = useQueryState('query', parseAsString);
const [selected, setSelected] = useState(new Set<string>());

const togglePageSelected = (pageSelected: boolean) => {
Expand Down Expand Up @@ -173,7 +180,26 @@ export function AutomationListTable({
/>
)}
{isSuccess && automations.length === 0 && (
<SimpleTable.Empty>{t('No alerts found')}</SimpleTable.Empty>
<SimpleTable.Empty>
<StyledFlex gap="xl" direction="column" align="center">
<img src={NoAlertsImage} />
<Heading as="h3">{t('No alerts found.')}</Heading>
<Text align="center" variant="muted">
{t('Try out that same query on the Monitors page.')}
</Text>

<LinkButton
icon={<IconSearch />}
priority="primary"
to={{
pathname: makeMonitorBasePathname(organization.slug),
query: {query},
}}
>
{t('Search Monitors')}
</LinkButton>
</StyledFlex>
</SimpleTable.Empty>
)}
{isError && <LoadingError message={t('Error loading alerts')} />}
{isPending && <LoadingSkeletons />}
Expand All @@ -190,6 +216,10 @@ export function AutomationListTable({
);
}

const StyledFlex = styled(Flex)`
padding: ${p => p.theme.size.sm};
`;

const AutomationsSimpleTable = styled(SimpleTable)`
grid-template-columns: 1fr;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ import {css, type Theme} from '@emotion/react';
import styled from '@emotion/styled';
import {useQueryState} from 'nuqs';

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

import {Button} from '@sentry/scraps/button';
import {Container, Flex} from '@sentry/scraps/layout';
import {Heading, Text} from '@sentry/scraps/text';

import {
GridLineLabels,
Expand Down Expand Up @@ -242,7 +245,15 @@ export function DetectorListTable({
{isError && <SimpleTable.Empty>{t('Error loading monitors')}</SimpleTable.Empty>}
{isPending && <LoadingSkeletons />}
{isSuccess && detectors.length === 0 && (
<SimpleTable.Empty>{t('No monitors found')}</SimpleTable.Empty>
<SimpleTable.Empty>
<StyledFlex gap="xl" direction="column" align="center">
<img src={NoAlertsImage} />
<Heading as="h3">{t('No monitors found.')}</Heading>
<Text align="center" variant="muted">
{t("Sorry, we couldn't find what you were looking for.")}
</Text>
</StyledFlex>
</SimpleTable.Empty>
)}
{hasVisualization && (
<PositionedGridLineOverlay
Expand Down Expand Up @@ -504,6 +515,10 @@ const VisualizationHeaderContainer = styled(Container)`
grid-column: -3 / -1;
`;

const StyledFlex = styled(Flex)`
padding: ${p => p.theme.size.xs};
`;

const VisualizationExpandButton = styled('div')`
grid-row: 1;
grid-column: -1;
Expand Down
1 change: 1 addition & 0 deletions static/images/features/alerts-not-found.svg
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you run this through svgo (fastest way is through the svgo.dev playground) you can reduce the size by quite a bit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 will do.

as an aside, i'd have thought that is something part of the build system so public assets are always improved. maybe a thing we can bring up sometime?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that could be good to bring up for a frontend TSC, I think Evan has talked about such a thing before. Could also be part of the PR CI checks

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading