Skip to content

Commit

Permalink
Merge pull request KelvinTegelaar#2279 from JohnDuprey/dev
Browse files Browse the repository at this point in the history
mail test tweaks
  • Loading branch information
JohnDuprey authored Mar 29, 2024
2 parents eb56d15 + 8c467df commit 3a4439d
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions src/views/email-exchange/tools/MailTest.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { CButton, CSpinner } from '@coreui/react'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import React from 'react'
import { CippCallout, CippPageList } from 'src/components/layout'
import { cellBooleanFormatter, cellDateFormatter } from 'src/components/tables'
import { cellGenericFormatter } from 'src/components/tables/CellGenericFormat'
import { useGenericGetRequestQuery } from 'src/store/api/app'

const MailTest = () => {
const { data: config, isSuccess } = useGenericGetRequestQuery({
const configQuery = useGenericGetRequestQuery({
path: '/api/ExecMailTest',
params: { Action: 'CheckConfig' },
})

function handleConfigRetry() {
configQuery.refetch()
}

const columns = [
{
name: 'Received',
Expand Down Expand Up @@ -73,14 +79,33 @@ const MailTest = () => {
]
return (
<div>
{isSuccess && (
<CippCallout color={config?.HasMailRead ? 'info' : 'warning'} dismissible={true}>
{config?.HasMailRead &&
'Mail Test Email: ' + config?.MailAddresses.filter((x) => x?.IsPrimary)[0]?.Address}
{config?.HasMailRead == false && 'Permission Check: ' + config?.Message}
{configQuery.isSuccess && (
<CippCallout color={configQuery.data?.HasMailRead ? 'info' : 'warning'} dismissible={true}>
{configQuery.data?.HasMailRead && (
<>
<b>Mail test email: </b>
<a
href={
'mailto:' +
configQuery.data?.MailAddresses.filter((x) => x?.IsPrimary)[0]?.Address
}
>
{configQuery.data?.MailAddresses.filter((x) => x?.IsPrimary)[0]?.Address}
</a>
</>
)}
{configQuery.data?.HasMailRead == false && (
<>
Permission Check: {configQuery.data?.Message}{' '}
<CButton size="sm" className="ms-2" onClick={() => handleConfigRetry()}>
{configQuery.isLoading ? <CSpinner /> : <FontAwesomeIcon icon="sync" />} Retry
</CButton>
</>
)}
</CippCallout>
)}
{isSuccess && config?.HasMailRead === true && (
{configQuery.isLoading && <CSpinner />}
{configQuery.isSuccess && configQuery.data?.HasMailRead === true && (
<CippPageList
capabilities={{ allTenants: true, helpContext: 'https://google.com' }}
title="Mail Test"
Expand Down

0 comments on commit 3a4439d

Please sign in to comment.