Skip to content

Commit 60cf36f

Browse files
authored
feat(aci): Various table fixes and improvements (#94361)
- Fix automation links - Better sizing for connected detector table when connected button is hidden - Use TitleCell for detector links and remove line-height: 1 - Show a dash for unassigned monitors
1 parent 9084a23 commit 60cf36f

File tree

7 files changed

+40
-101
lines changed

7 files changed

+40
-101
lines changed

static/app/components/workflowEngine/gridCell/automationTitleCell.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {TitleCell} from 'sentry/components/workflowEngine/gridCell/titleCell';
22
import type {Automation} from 'sentry/types/workflowEngine/automations';
33
import useOrganization from 'sentry/utils/useOrganization';
4-
import {makeMonitorDetailsPathname} from 'sentry/views/detectors/pathnames';
4+
import {makeAutomationDetailsPathname} from 'sentry/views/automations/pathnames';
55

66
interface Props {
77
automation: Automation;
@@ -13,7 +13,7 @@ export default function AutomationTitleCell({automation}: Props) {
1313
return (
1414
<TitleCell
1515
name={automation.name}
16-
link={makeMonitorDetailsPathname(organization.slug, automation.id)}
16+
link={makeAutomationDetailsPathname(organization.slug, automation.id)}
1717
systemCreated={!automation.createdBy}
1818
/>
1919
);

static/app/components/workflowEngine/gridCell/titleCell.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,4 @@ const DetailsWrapper = styled('div')`
7373
align-items: center;
7474
color: ${p => p.theme.subText};
7575
white-space: nowrap;
76-
line-height: 1.2;
77-
78-
@media (min-width: ${p => p.theme.breakpoints.xlarge}) {
79-
line-height: 1;
80-
}
8176
`;

static/app/views/automations/components/connectedMonitorsList.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,26 +83,34 @@ const Container = styled('div')`
8383
`;
8484

8585
const SimpleTableWithColumns = styled(SimpleTable)`
86-
grid-template-columns: 1fr auto auto auto 140px;
86+
grid-template-columns: 1fr 100px auto auto auto;
87+
88+
/*
89+
The connected column can be added/removed depending on props, so in order to
90+
have a constant width we have an auto grid column and set the width here.
91+
*/
92+
.connected {
93+
width: 140px;
94+
}
8795
8896
@container (max-width: ${p => p.theme.breakpoints.medium}) {
89-
grid-template-columns: 1fr auto auto 140px;
97+
grid-template-columns: 1fr 100px auto auto;
9098
9199
.last-issue {
92100
display: none;
93101
}
94102
}
95103
96104
@container (max-width: ${p => p.theme.breakpoints.small}) {
97-
grid-template-columns: 1fr auto 140px;
105+
grid-template-columns: 1fr 100px auto;
98106
99107
.owner {
100108
display: none;
101109
}
102110
}
103111
104112
@container (max-width: ${p => p.theme.breakpoints.xsmall}) {
105-
grid-template-columns: 1fr 140px;
113+
grid-template-columns: 1fr 100px;
106114
107115
.type {
108116
display: none;

static/app/views/detectors/components/connectedAutomationList.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,7 @@ export function ConnectedAutomationsList({
8787
<SimpleTable.HeaderCell name="action-filters">
8888
{t('Actions')}
8989
</SimpleTable.HeaderCell>
90-
{canEdit && (
91-
<SimpleTable.HeaderCell name="connected">
92-
{t('Connected')}
93-
</SimpleTable.HeaderCell>
94-
)}
90+
{canEdit && <SimpleTable.HeaderCell name="connected" />}
9591
</SimpleTable.Header>
9692
{isLoading && <Skeletons canEdit={canEdit} />}
9793
{isError && <LoadingError />}
@@ -114,7 +110,7 @@ export function ConnectedAutomationsList({
114110
<ActionCell actions={getAutomationActions(automation)} />
115111
</SimpleTable.RowCell>
116112
{canEdit && (
117-
<SimpleTable.RowCell name="connected">
113+
<SimpleTable.RowCell name="connected" justify="flex-end">
118114
<Button onClick={() => toggleConnected?.(automation.id)} size="sm">
119115
{connectedAutomationIds?.has(automation.id)
120116
? t('Disconnect')

static/app/views/detectors/components/detectorLink.tsx

Lines changed: 23 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ import {css} from '@emotion/react';
33
import styled from '@emotion/styled';
44

55
import ProjectBadge from 'sentry/components/idBadge/projectBadge';
6-
import Link from 'sentry/components/links/link';
7-
import {IconSentry} from 'sentry/icons';
6+
import {TitleCell} from 'sentry/components/workflowEngine/gridCell/titleCell';
87
import {t} from 'sentry/locale';
9-
import {space} from 'sentry/styles/space';
108
import type {DataCondition} from 'sentry/types/workflowEngine/dataConditions';
119
import {
1210
DataConditionType,
@@ -170,81 +168,32 @@ export function DetectorLink({detector, className}: DetectorLinkProps) {
170168
const project = useProjectFromId({project_id: detector.projectId});
171169

172170
return (
173-
<StyledLink
174-
to={makeMonitorDetailsPathname(org.slug, detector.id)}
171+
<TitleCell
175172
className={className}
176-
>
177-
<Name>
178-
<NameText>{detector.name}</NameText>
179-
{!detector.createdBy && <CreatedBySentryIcon size="xs" color="subText" />}
180-
{detector.disabled && <span>&mdash; Disabled</span>}
181-
</Name>
182-
<DetailsWrapper>
183-
{project && (
184-
<StyledProjectBadge
185-
css={css`
186-
&& img {
187-
box-shadow: none;
188-
}
189-
`}
190-
project={project}
191-
avatarSize={16}
192-
disableLink
193-
/>
194-
)}
195-
<Details detector={detector} />
196-
</DetailsWrapper>
197-
</StyledLink>
173+
name={detector.name}
174+
link={makeMonitorDetailsPathname(org.slug, detector.id)}
175+
systemCreated={!detector.createdBy}
176+
details={
177+
<Fragment>
178+
{project && (
179+
<StyledProjectBadge
180+
css={css`
181+
&& img {
182+
box-shadow: none;
183+
}
184+
`}
185+
project={project}
186+
avatarSize={16}
187+
disableLink
188+
/>
189+
)}
190+
<Details detector={detector} />
191+
</Fragment>
192+
}
193+
/>
198194
);
199195
}
200196

201-
const Name = styled('div')`
202-
color: ${p => p.theme.textColor};
203-
display: flex;
204-
align-items: center;
205-
gap: ${space(0.5)};
206-
`;
207-
208-
const NameText = styled('span')`
209-
font-weight: ${p => p.theme.fontWeightBold};
210-
${p => p.theme.overflowEllipsis};
211-
width: auto;
212-
`;
213-
214-
const CreatedBySentryIcon = styled(IconSentry)`
215-
flex-shrink: 0;
216-
`;
217-
218-
const StyledLink = styled(Link)`
219-
display: flex;
220-
flex-direction: column;
221-
justify-content: center;
222-
gap: ${space(0.5)};
223-
flex: 1;
224-
overflow: hidden;
225-
226-
&:hover {
227-
${Name} {
228-
text-decoration: underline;
229-
}
230-
}
231-
`;
232-
233-
const DetailsWrapper = styled('div')`
234-
display: inline-grid;
235-
grid-auto-flow: column dense;
236-
gap: ${space(0.75)};
237-
justify-content: start;
238-
align-items: center;
239-
color: ${p => p.theme.subText};
240-
white-space: nowrap;
241-
line-height: 1.2;
242-
243-
@media (min-width: ${p => p.theme.breakpoints.xlarge}) {
244-
line-height: 1;
245-
}
246-
`;
247-
248197
const StyledProjectBadge = styled(ProjectBadge)`
249198
color: ${p => p.theme.subText};
250199
`;

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import styled from '@emotion/styled';
22

33
import {ActorAvatar} from 'sentry/components/core/avatar/actorAvatar';
4-
import {Tooltip} from 'sentry/components/core/tooltip';
5-
import {IconSentry} from 'sentry/icons';
6-
import {t} from 'sentry/locale';
74
import {parseActorIdentifier} from 'sentry/utils/parseActorIdentifier';
85

96
type DetectorAssigneeCellProps = {
@@ -16,11 +13,7 @@ function AssigneeContent({assignee}: {assignee: string | null}) {
1613
const actor = parseActorIdentifier(assignee);
1714

1815
if (!actor) {
19-
return (
20-
<Tooltip title={t('Sentry')}>
21-
<IconSentry size="lg" data-test-id="assignee-sentry" />
22-
</Tooltip>
23-
);
16+
return '—';
2417
}
2518

2619
return <ActorAvatar actor={actor} size={24} />;

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ describe('DetectorsList', function () {
9595
expect(within(row).getByText('Detector 1')).toBeInTheDocument();
9696
// Type
9797
expect(within(row).getByText('Metric')).toBeInTheDocument();
98-
// Assignee should be Sentry because owner is null
99-
expect(within(row).getByTestId('assignee-sentry')).toBeInTheDocument();
10098

10199
// Details under name
102100
expect(within(row).getByText('production')).toBeInTheDocument();

0 commit comments

Comments
 (0)