Adds compatibility for skipped checks for server host reasons

This commit is contained in:
Alicia Sykes
2023-07-29 11:40:03 +01:00
parent dc651a7b1e
commit 7422d22538
2 changed files with 20 additions and 13 deletions

View File

@@ -167,6 +167,9 @@ p {
}
pre {
color: ${colors.danger};
&.info {
color: ${colors.warning};
}
}
`;
@@ -202,7 +205,9 @@ const jobNames = [
'sitemap',
'hsts',
'security-txt',
'social-tags',
'linked-pages',
'mail-server',
// 'whois',
'features',
'carbon',
@@ -360,7 +365,7 @@ const ProgressLoader = (props: { loadStatus: LoadingJob[], showModal: (err: Reac
}
};
const showErrorModal = (name: string, state: LoadingState, timeTaken: number | undefined, error: string) => {
const showErrorModal = (name: string, state: LoadingState, timeTaken: number | undefined, error: string, isInfo?: boolean) => {
const errorContent = (
<ErrorModalContent>
<Heading as="h3">Error Details for {name}</Heading>
@@ -368,7 +373,8 @@ const ProgressLoader = (props: { loadStatus: LoadingJob[], showModal: (err: Reac
The {name} job failed with an {state} state after {timeTaken} ms.
The server responded with the following error:
</p>
<pre>{error}</pre>
{ /* If isInfo == true, then add .info className to pre */}
<pre className={isInfo ? 'info' : 'error'}>{error}</pre>
</ErrorModalContent>
);
props.showModal(errorContent);
@@ -409,6 +415,7 @@ const ProgressLoader = (props: { loadStatus: LoadingJob[], showModal: (err: Reac
<i>{(timeTaken && state !== 'loading') ? ` Took ${timeTaken} ms` : '' }</i>
{ (retry && state !== 'success' && state !== 'loading') && <FailedJobActionButton onClick={retry}> Retry</FailedJobActionButton> }
{ (error && state === 'error') && <FailedJobActionButton onClick={() => showErrorModal(name, state, timeTaken, error)}> Show Error</FailedJobActionButton> }
{ (error && state === 'skipped') && <FailedJobActionButton onClick={() => showErrorModal(name, state, timeTaken, error, true)}> Show Reason</FailedJobActionButton> }
</li>
);
})