diff --git a/src/views/email-exchange/tools/MailTest.jsx b/src/views/email-exchange/tools/MailTest.jsx index bc98185de466..d433e658dba3 100644 --- a/src/views/email-exchange/tools/MailTest.jsx +++ b/src/views/email-exchange/tools/MailTest.jsx @@ -1,3 +1,5 @@ +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' @@ -5,11 +7,15 @@ 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', @@ -73,14 +79,33 @@ const MailTest = () => { ] return (
- {isSuccess && ( - - {config?.HasMailRead && - 'Mail Test Email: ' + config?.MailAddresses.filter((x) => x?.IsPrimary)[0]?.Address} - {config?.HasMailRead == false && 'Permission Check: ' + config?.Message} + {configQuery.isSuccess && ( + + {configQuery.data?.HasMailRead && ( + <> + Mail test email: + x?.IsPrimary)[0]?.Address + } + > + {configQuery.data?.MailAddresses.filter((x) => x?.IsPrimary)[0]?.Address} + + + )} + {configQuery.data?.HasMailRead == false && ( + <> + Permission Check: {configQuery.data?.Message}{' '} + handleConfigRetry()}> + {configQuery.isLoading ? : } Retry + + + )} )} - {isSuccess && config?.HasMailRead === true && ( + {configQuery.isLoading && } + {configQuery.isSuccess && configQuery.data?.HasMailRead === true && (