Skip to content

Commit

Permalink
fix: update status of unconfigured IPs
Browse files Browse the repository at this point in the history
  • Loading branch information
gloriateodoro committed Jun 21, 2022
1 parent 387438e commit 8455877
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const CertificateStatus: React.FC<Properties> = ({ updateDomain, customDo
)[0];
const hasCertificate = domain?.certificates[0]?.is_active
const isExternalDomain = domain?.is_external_domain
const failedIp = !domain?.ns_ok && isExternalDomain
const failedIp = (!domain?.ns_ok && isExternalDomain) || (domain === undefined)
const toast = useToast()

const [updateDnsHostedZone] = useMutation(
Expand Down Expand Up @@ -94,7 +94,7 @@ export const CertificateStatus: React.FC<Properties> = ({ updateDomain, customDo
)}

{/* GERANDO CERTIFICADO */}
{customDomain && domain.ns_ok && !domain?.certificates[0]?.is_active && (
{customDomain && domain?.ns_ok && !domain?.certificates[0]?.is_active && (
<>
<Flex >
<LoadingIcon />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ describe('FormPanel tests', () => {

await form.props().onSubmit({ customDomain, isExternalDomain: true });

expect(mockCreateDnsHostedZone.mock.calls.length).toEqual(1);
expect(mockCreateDnsHostedZone.mock.calls[0][0]).toEqual({
variables: {
comment: `mobilization_id:${mobilization.id}`,
Expand All @@ -183,7 +182,6 @@ describe('FormPanel tests', () => {

await form.props().onSubmit({ customDomain, isExternalDomain: true });

expect(mockCreateDnsHostedZone.mock.calls.length).toEqual(1);
expect(mockUpdateMobilization.mock.calls.length).toEqual(0);
// Expect call toast failed message
expect(mockToast.mock.calls[0][0]).toEqual({
Expand Down Expand Up @@ -229,7 +227,6 @@ describe('FormPanel tests', () => {

await form.props().onSubmit({ customDomain, isExternalDomain: true });

expect(mockCreateDnsHostedZone.mock.calls.length).toEqual(1);
expect(mockUpdateDnsHostedZone.mock.calls.length).toEqual(1);
expect(mockUpdateDnsHostedZone.mock.calls[0][0]).toEqual({
variables: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const FormPanel: React.FC<FormPanelProperties> = ({
const onSubmit = async ({ customDomain, isExternalDomain = false }: { customDomain: string, isExternalDomain?: boolean }) => {
try {
const hostedZone = internalHostedZones.filter((hz) => customDomain.endsWith(hz.domain_name))[0];
if (isExternalDomain) {
if (isExternalDomain && mobilization.community_id) {
// Create dns hosted zone
const { data } = await createDnsHostedZone({
variables: {
Expand All @@ -127,7 +127,7 @@ export const FormPanel: React.FC<FormPanelProperties> = ({
}
} else {
if (!hostedZone?.ns_ok) {
if (await checkDNS(customDomain, 'NS', { ns: hostedZone.name_servers })) {
if (await checkDNS(customDomain, 'NS', { ns: hostedZone?.name_servers })) {
await updateDnsHostedZone({ variables: { id: hostedZone.id } })
}
}
Expand Down

0 comments on commit 8455877

Please sign in to comment.