Skip to content

Commit 1c3eb56

Browse files
Merge pull request #2280 from KelvinTegelaar/dev
Dev
2 parents b4e6f5f + 3a4439d commit 1c3eb56

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

src/views/email-exchange/tools/MailTest.jsx

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1+
import { CButton, CSpinner } from '@coreui/react'
2+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
13
import React from 'react'
24
import { CippCallout, CippPageList } from 'src/components/layout'
35
import { cellBooleanFormatter, cellDateFormatter } from 'src/components/tables'
46
import { cellGenericFormatter } from 'src/components/tables/CellGenericFormat'
57
import { useGenericGetRequestQuery } from 'src/store/api/app'
68

79
const MailTest = () => {
8-
const { data: config, isSuccess } = useGenericGetRequestQuery({
10+
const configQuery = useGenericGetRequestQuery({
911
path: '/api/ExecMailTest',
1012
params: { Action: 'CheckConfig' },
1113
})
1214

15+
function handleConfigRetry() {
16+
configQuery.refetch()
17+
}
18+
1319
const columns = [
1420
{
1521
name: 'Received',
@@ -73,14 +79,33 @@ const MailTest = () => {
7379
]
7480
return (
7581
<div>
76-
{isSuccess && (
77-
<CippCallout color={config?.HasMailRead ? 'info' : 'warning'} dismissible={true}>
78-
{config?.HasMailRead &&
79-
'Mail Test Email: ' + config?.MailAddresses.filter((x) => x?.IsPrimary)[0]?.Address}
80-
{config?.HasMailRead == false && 'Permission Check: ' + config?.Message}
82+
{configQuery.isSuccess && (
83+
<CippCallout color={configQuery.data?.HasMailRead ? 'info' : 'warning'} dismissible={true}>
84+
{configQuery.data?.HasMailRead && (
85+
<>
86+
<b>Mail test email: </b>
87+
<a
88+
href={
89+
'mailto:' +
90+
configQuery.data?.MailAddresses.filter((x) => x?.IsPrimary)[0]?.Address
91+
}
92+
>
93+
{configQuery.data?.MailAddresses.filter((x) => x?.IsPrimary)[0]?.Address}
94+
</a>
95+
</>
96+
)}
97+
{configQuery.data?.HasMailRead == false && (
98+
<>
99+
Permission Check: {configQuery.data?.Message}{' '}
100+
<CButton size="sm" className="ms-2" onClick={() => handleConfigRetry()}>
101+
{configQuery.isLoading ? <CSpinner /> : <FontAwesomeIcon icon="sync" />} Retry
102+
</CButton>
103+
</>
104+
)}
81105
</CippCallout>
82106
)}
83-
{isSuccess && config?.HasMailRead === true && (
107+
{configQuery.isLoading && <CSpinner />}
108+
{configQuery.isSuccess && configQuery.data?.HasMailRead === true && (
84109
<CippPageList
85110
capabilities={{ allTenants: true, helpContext: 'https://google.com' }}
86111
title="Mail Test"

0 commit comments

Comments
 (0)