Skip to content

Commit a346f6d

Browse files
committed
feat(sanity): add release error indicators to ReleasesOverview
1 parent 2fa184c commit a346f6d

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

packages/sanity/src/core/releases/i18n/resources.ts

+3
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ const releasesLocaleStrings = {
143143

144144
/** Title text when error during release update */
145145
'failed-edit-title': 'Failed to save changes',
146+
/** Title text displayed for releases that failed to publish */
147+
'failed-publish-title': 'Failed to publish',
148+
146149
/**The text that will be shown in the footer to indicate the time the release was archived */
147150
'footer.status.archived': 'Archived',
148151
/**The text that will be shown in the footer to indicate the time the release was created */

packages/sanity/src/core/releases/tool/overview/ReleasesOverviewColumnDefs.tsx

+29-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import {LockIcon} from '@sanity/icons'
1+
import {ErrorOutlineIcon, LockIcon} from '@sanity/icons'
22
import {Flex, Text} from '@sanity/ui'
33
import {type TFunction} from 'i18next'
4+
import {Fragment} from 'react'
45

6+
import {ToneIcon} from '../../../../ui-components/toneIcon/ToneIcon'
7+
import {Tooltip} from '../../../../ui-components/tooltip/Tooltip'
58
import {RelativeTime} from '../../../components'
69
import {getPublishDateFromRelease, isReleaseScheduledOrScheduling} from '../../util/util'
710
import {Headers} from '../components/Table/TableHeader'
@@ -88,10 +91,34 @@ export const releasesOverviewColumnDefs: (
8891
)
8992
},
9093
},
94+
{
95+
id: 'error',
96+
sorting: false,
97+
width: 40,
98+
header: () => <Fragment />,
99+
cell: ({datum: {error, state}, cellProps}) => (
100+
<Flex
101+
{...cellProps}
102+
align="center"
103+
paddingX={2}
104+
paddingY={3}
105+
sizing="border"
106+
data-testid="error-indicator"
107+
>
108+
{typeof error !== 'undefined' && state === 'active' && (
109+
<Tooltip content={<Text size={1}>{t('failed-publish-title')}</Text>} portal>
110+
<Text size={1}>
111+
<ToneIcon icon={ErrorOutlineIcon} tone="critical" />
112+
</Text>
113+
</Tooltip>
114+
)}
115+
</Flex>
116+
),
117+
},
91118
{
92119
id: 'documentCount',
93120
sorting: false,
94-
width: 100,
121+
width: 120,
95122
header: ({headerProps}) => (
96123
<Flex {...headerProps} paddingY={3} sizing="border">
97124
<Headers.BasicHeader text="" />

packages/sanity/src/core/releases/tool/overview/__tests__/ReleasesOverview.test.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,11 @@ describe('ReleasesOverview', () => {
305305
within(scheduledReleaseRow).getByTestId('release-lock-icon')
306306
})
307307

308+
it('shows error indicator next to active releases in error state', () => {
309+
const row = screen.getAllByTestId('table-row')[4]
310+
within(row).getByTestId('error-indicator')
311+
})
312+
308313
it('allows for switching between history modes', () => {
309314
expect(screen.getByText('Open').closest('button')).not.toBeDisabled()
310315
expect(screen.getByText('Archived').closest('button')).not.toBeDisabled()

0 commit comments

Comments
 (0)