Skip to content

Commit

Permalink
Merge pull request #2280 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
KelvinTegelaar authored Mar 29, 2024
2 parents b4e6f5f + 3a4439d commit 1c3eb56
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 1c3eb56

Please sign in to comment.