Skip to content

Commit 9350390

Browse files
authored
ref(aci): Add common components for monitor list views (#102842)
1 parent b313691 commit 9350390

21 files changed

+523
-444
lines changed

static/app/router/routes.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,6 +1675,7 @@ function buildRoutes(): RouteObject[] {
16751675
const monitorRoutes: SentryRouteObject = {
16761676
path: '/monitors/',
16771677
withOrgPath: true,
1678+
component: make(() => import('sentry/views/detectors/detectorViewContainer')),
16781679
children: [
16791680
...detectorRoutes.children!,
16801681
automationRoutes,

static/app/views/automations/list.spec.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
within,
1919
} from 'sentry-test/reactTestingLibrary';
2020

21+
import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
2122
import PageFiltersStore from 'sentry/stores/pageFiltersStore';
2223
import ProjectsStore from 'sentry/stores/projectsStore';
2324
import AutomationsList from 'sentry/views/automations/list';
@@ -394,7 +395,13 @@ describe('AutomationsList', () => {
394395
body: {},
395396
});
396397

397-
render(<AutomationsList />, {organization});
398+
render(
399+
// MonitorViewContainer provides PageFiltersContainer typically
400+
<PageFiltersContainer>
401+
<AutomationsList />
402+
</PageFiltersContainer>,
403+
{organization}
404+
);
398405
renderGlobalModal();
399406

400407
// Mock the filtered search results - this will be used when search is applied

static/app/views/automations/list.tsx

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {useCallback} from 'react';
22

33
import {LinkButton} from 'sentry/components/core/button/linkButton';
44
import {Flex} from 'sentry/components/core/layout';
5-
import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
65
import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter';
76
import Pagination from 'sentry/components/pagination';
87
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
@@ -80,44 +79,42 @@ export default function AutomationsList() {
8079

8180
return (
8281
<SentryDocumentTitle title={t('Alerts')}>
83-
<PageFiltersContainer>
84-
<ListLayout
85-
actions={<Actions />}
86-
title={t('Alerts')}
87-
description={t(
88-
'Alerts are triggered when issue changes state, is created, or passes a threshold. They perform external actions like sending notifications, creating tickets, or calling webhooks and integrations.'
89-
)}
90-
docsUrl="https://docs.sentry.io/product/automations/"
91-
>
92-
<TableHeader />
93-
<div>
94-
<VisuallyCompleteWithData
95-
hasData={(automations?.length ?? 0) > 0}
96-
id="AutomationsList-Table"
97-
isLoading={isLoading}
98-
>
99-
<AutomationListTable
100-
automations={automations ?? []}
101-
isPending={isLoading}
102-
isError={isError}
103-
isSuccess={isSuccess}
104-
sort={sort}
105-
queryCount={hitsInt > maxHitsInt ? `${maxHits}+` : hits}
106-
allResultsVisible={allResultsVisible()}
107-
/>
108-
</VisuallyCompleteWithData>
109-
<Pagination
110-
pageLinks={pageLinks}
111-
onCursor={newCursor => {
112-
navigate({
113-
pathname: location.pathname,
114-
query: {...location.query, cursor: newCursor},
115-
});
116-
}}
82+
<ListLayout
83+
actions={<Actions />}
84+
title={t('Alerts')}
85+
description={t(
86+
'Alerts are triggered when issue changes state, is created, or passes a threshold. They perform external actions like sending notifications, creating tickets, or calling webhooks and integrations.'
87+
)}
88+
docsUrl="https://docs.sentry.io/product/automations/"
89+
>
90+
<TableHeader />
91+
<div>
92+
<VisuallyCompleteWithData
93+
hasData={(automations?.length ?? 0) > 0}
94+
id="AutomationsList-Table"
95+
isLoading={isLoading}
96+
>
97+
<AutomationListTable
98+
automations={automations ?? []}
99+
isPending={isLoading}
100+
isError={isError}
101+
isSuccess={isSuccess}
102+
sort={sort}
103+
queryCount={hitsInt > maxHitsInt ? `${maxHits}+` : hits}
104+
allResultsVisible={allResultsVisible()}
117105
/>
118-
</div>
119-
</ListLayout>
120-
</PageFiltersContainer>
106+
</VisuallyCompleteWithData>
107+
<Pagination
108+
pageLinks={pageLinks}
109+
onCursor={newCursor => {
110+
navigate({
111+
pathname: location.pathname,
112+
query: {...location.query, cursor: newCursor},
113+
});
114+
}}
115+
/>
116+
</div>
117+
</ListLayout>
121118
</SentryDocumentTitle>
122119
);
123120
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
DetectorListRow,
3232
DetectorListRowSkeleton,
3333
} from 'sentry/views/detectors/components/detectorListTable/detectorListRow';
34-
import {DETECTOR_LIST_PAGE_LIMIT} from 'sentry/views/detectors/constants';
34+
import {DETECTOR_LIST_PAGE_LIMIT} from 'sentry/views/detectors/list/common/constants';
3535
import {
3636
useMonitorViewContext,
3737
type MonitorListAdditionalColumn,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import {Outlet} from 'react-router-dom';
2+
3+
import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
4+
import {useWorkflowEngineFeatureGate} from 'sentry/components/workflowEngine/useWorkflowEngineFeatureGate';
5+
6+
export default function DetectorViewContainer() {
7+
useWorkflowEngineFeatureGate({redirect: true});
8+
9+
return (
10+
<PageFiltersContainer>
11+
<Outlet />
12+
</PageFiltersContainer>
13+
);
14+
}

0 commit comments

Comments
 (0)