Skip to content

Commit 6bd61b7

Browse files
authored
feat(preprod): Add release notes and code signature errors to modal (#103005)
1 parent d605d42 commit 6bd61b7

File tree

3 files changed

+79
-33
lines changed

3 files changed

+79
-33
lines changed

static/app/views/preprod/buildDetails/sidebar/buildDetailsSidebarAppInfo.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,15 @@ export function BuildDetailsSidebarAppInfo(props: BuildDetailsSidebarAppInfoProp
130130
<IconLink />
131131
</InfoIcon>
132132
<Text>
133-
{props.projectId && props.appInfo.is_installable ? (
133+
{props.projectId ? (
134134
<InstallableLink
135135
onClick={() => {
136136
openInstallModal(props.projectId!, props.artifactId);
137137
}}
138138
>
139-
Installable
139+
Install
140140
</InstallableLink>
141-
) : (
142-
<Tooltip title={labels.installUnavailableTooltip}>
143-
Not Installable
144-
</Tooltip>
145-
)}
141+
) : null}
146142
</Text>
147143
</Flex>
148144
</Feature>

static/app/views/preprod/components/installModal.tsx

Lines changed: 75 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {QuietZoneQRCode} from 'sentry/components/quietZoneQRCode';
1212
import {IconClose} from 'sentry/icons/iconClose';
1313
import {t, tn} from 'sentry/locale';
1414
import {space} from 'sentry/styles/space';
15+
import {MarkedText} from 'sentry/utils/marked/markedText';
1516
import {useApiQuery} from 'sentry/utils/queryClient';
1617
import useOrganization from 'sentry/utils/useOrganization';
1718
import type {InstallDetailsApiResponse} from 'sentry/views/preprod/types/installDetailsTypes';
@@ -40,33 +41,71 @@ function InstallModal({projectId, artifactId, closeModal}: InstallModalProps) {
4041
}
4142
);
4243

44+
const header = (
45+
<Flex justify="center" align="center" width="100%" position="relative">
46+
<Heading as="h2">{t('Install App')}</Heading>
47+
<Container
48+
position="absolute"
49+
style={{top: '50%', right: 0, transform: 'translateY(-50%)'}}
50+
>
51+
<Button
52+
onClick={closeModal}
53+
priority="transparent"
54+
icon={<IconClose />}
55+
size="sm"
56+
aria-label={t('Close')}
57+
/>
58+
</Container>
59+
</Flex>
60+
);
61+
4362
if (isPending) {
4463
return (
45-
<Flex direction="column" align="center" gap="md" padding="3xl">
64+
<Flex direction="column" align="center" gap="xl">
65+
{header}
4666
<LoadingIndicator />
4767
<Text>{t('Loading install details...')}</Text>
4868
</Flex>
4969
);
5070
}
5171

52-
if (isError) {
72+
if (isError || !installDetails) {
5373
return (
54-
<Flex direction="column" align="center" gap="md" padding="3xl">
74+
<Flex direction="column" align="center" gap="xl">
75+
{header}
5576
<Text>{t('Error: %s', error?.message || 'Failed to fetch install details')}</Text>
5677
<Button onClick={() => refetch()}>{t('Retry')}</Button>
57-
<Button onClick={closeModal}>{t('Close')}</Button>
5878
</Flex>
5979
);
6080
}
6181

62-
if (!installDetails?.install_url) {
63-
const message = installDetails
64-
? t('No install download link available')
65-
: t('No install details available');
82+
if (!installDetails.install_url) {
83+
if (!installDetails.is_code_signature_valid) {
84+
let errors = null;
85+
if (
86+
installDetails.code_signature_errors &&
87+
installDetails.code_signature_errors.length > 0
88+
) {
89+
errors = (
90+
<CodeSignatureInfo>
91+
{installDetails.code_signature_errors.map(e => (
92+
<Text key={e}>{e}</Text>
93+
))}
94+
</CodeSignatureInfo>
95+
);
96+
}
97+
return (
98+
<Flex direction="column" align="center" gap="xl">
99+
{header}
100+
<Text>{'Code signature is invalid'}</Text>
101+
{errors}
102+
</Flex>
103+
);
104+
}
66105
return (
67-
<Flex direction="column" align="center" gap="md" padding="3xl">
68-
<Text>{message}</Text>
69-
<Button onClick={closeModal}>{t('Close')}</Button>
106+
<Flex direction="column" align="center" gap="xl">
107+
{header}
108+
<Text>{t('No install download link available')}</Text>
70109
</Flex>
71110
);
72111
}
@@ -90,21 +129,7 @@ function InstallModal({projectId, artifactId, closeModal}: InstallModalProps) {
90129
return (
91130
<Fragment>
92131
<Flex direction="column" align="center" gap="xl">
93-
<Flex justify="center" align="center" width="100%" position="relative">
94-
<Heading as="h2">{t('Install App')}</Heading>
95-
<Container
96-
position="absolute"
97-
style={{top: '50%', right: 0, transform: 'translateY(-50%)'}}
98-
>
99-
<Button
100-
onClick={closeModal}
101-
priority="transparent"
102-
icon={<IconClose />}
103-
size="sm"
104-
aria-label={t('Close')}
105-
/>
106-
</Container>
107-
</Flex>
132+
{header}
108133

109134
<Fragment>
110135
<Stack align="center" gap="md">
@@ -151,6 +176,14 @@ function InstallModal({projectId, artifactId, closeModal}: InstallModalProps) {
151176
{t('The install link will expire in 12 hours')}
152177
</Text>
153178
</Stack>
179+
{installDetails.release_notes && (
180+
<ReleaseNotesSection direction="column" gap="md">
181+
<Heading as="h3">{t('Release Notes')}</Heading>
182+
<ReleaseNotesContent>
183+
<MarkedText text={installDetails.release_notes} />
184+
</ReleaseNotesContent>
185+
</ReleaseNotesSection>
186+
)}
154187
</Fragment>
155188
</Flex>
156189
</Fragment>
@@ -163,6 +196,9 @@ export const CodeSignatureInfo = styled('div')`
163196
background: ${p => p.theme.backgroundSecondary};
164197
border-radius: ${space(1)};
165198
border: 1px solid ${p => p.theme.border};
199+
max-width: 100%;
200+
word-break: break-word;
201+
overflow-wrap: break-word;
166202
`;
167203

168204
const Divider = styled(Flex)`
@@ -190,6 +226,19 @@ const Divider = styled(Flex)`
190226
}
191227
`;
192228

229+
const ReleaseNotesSection = styled(Flex)`
230+
width: 100%;
231+
margin-top: ${p => p.theme.space.xl};
232+
`;
233+
234+
const ReleaseNotesContent = styled('div')`
235+
width: 100%;
236+
padding: ${p => p.theme.space.xl};
237+
background: ${p => p.theme.backgroundSecondary};
238+
border-radius: ${p => p.theme.space.md};
239+
border: 1px solid ${p => p.theme.border};
240+
`;
241+
193242
export function openInstallModal(projectId: string, artifactId: string) {
194243
openModal(
195244
({closeModal}) => (

static/app/views/preprod/types/installDetailsTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ export interface InstallDetailsApiResponse {
88
install_url?: string;
99
is_code_signature_valid?: boolean;
1010
profile_name?: string;
11+
release_notes?: string;
1112
}

0 commit comments

Comments
 (0)