Skip to content

Commit

Permalink
feat(zimbra): intialize diagnostics page
Browse files Browse the repository at this point in the history
ref: MANAGER-16089

Signed-off-by: Tristan WAGNER <[email protected]>
  • Loading branch information
tristanwagner committed Dec 2, 2024
1 parent ea823d6 commit 3df33fd
Show file tree
Hide file tree
Showing 23 changed files with 800 additions and 246 deletions.
4 changes: 2 additions & 2 deletions packages/manager/apps/zimbra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"vitest": "^2.1.2"
},
"regions": [
"CA",
"EU"
"EU",
"CA"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"zimbra_dashboard_domains_add": "Ajouter un domaine",
"zimbra_dashboard_domains_edit": "Configuration du domaine",
"zimbra_dashboard_domains_delete": "Supprimer un domaine",
"zimbra_dashboard_domains_diagnostic": "Diagnostique",
"zimbra_dashboard_domains_diagnostics": "Diagnostiques",
"zimbra_dashboard_email_accounts": "Compte email",
"zimbra_dashboard_email_accounts_add": "Créer un compte email",
"zimbra_dashboard_email_accounts_edit": "Modifier le compte",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"zimbra_domains_add_domain_title": "Ajouter un domaine",
"zimbra_domains_datagrid_account_label": "Nombre de comptes",
"zimbra_domains_datagrid_diagnostic_label": "Diagnostique",
"zimbra_domains_datagrid_diagnostic_configuration_ok": "Configuration OK",
"zimbra_domains_datagrid_diagnostic_tooltip_title": "Diagnostic {{ diagType }}",
"zimbra_domains_datagrid_domain_label": "Domaine",
"zimbra_domains_datagrid_organization_label": "Organisation",
"zimbra_domains_datagrid_status_label": "Statut",
"zimbra_domains_datagrid_account_number": "Nombre de comptes",
"zimbra_domains_tooltip_configure": "Configurer",
"zimbra_domains_tooltip_delete": "Supprimer",
"zimbra_domains_tooltip_diagnostics": "Diagnostiques",
"zimbra_domains_tooltip_need_organization": "Veuillez d'abord configurer une organisation"
}
Original file line number Diff line number Diff line change
@@ -1,37 +1,19 @@
{
"zimbra_domain_modal_diagnostic_guide": "guide",
"zimbra_domain_modal_diagnostic_srv_title": "Diagnostique SRV",
"zimbra_domain_modal_diagnostic_srv_content_header": "Pour faciliter la configuration des boites mails sur vos terminaux, veuillez ajouter cette configuration à votre DNS (consulter notre <guide/>)",
"zimbra_domain_modal_diagnostic_srv_content_header_ovh_hosted_domain_part1": "La configuration SRV permet la configuration automatique de vos boites mails sur vos clients de messagerie.",
"zimbra_domain_modal_diagnostic_srv_content_header_ovh_hosted_domain_part2": "Votre domaine est hébergé chez OVH Cloud, nous allons procéder à la configuration de votre champ SRV.",
"zimbra_domain_modal_diagnostic_srv_domain": "Domaine",
"zimbra_domain_modal_diagnostic_fields": "Champs",
"zimbra_domain_modal_diagnostic_srv_action_validate": "Valider",
"zimbra_domain_modal_diagnostic_srv_action_cancel": "Annuler",
"zimbra_domain_modal_diagnostic_srv_action_close": "Fermer",
"zimbra_domain_modal_diagnostic_field_subdomain": "Sous domaine :",
"zimbra_domain_modal_diagnostic_field_priority": "Priorité :",
"zimbra_domain_modal_diagnostic_field_weight": "Poids :",
"zimbra_domain_modal_diagnostic_field_port": "Port :",
"zimbra_domain_modal_diagnostic_field_target": "Cible :",
"zimbra_domain_modal_diagnostic_mx_title": "Diagnostique MX",
"zimbra_domain_modal_diagnostic_mx_content_header_part1": "La configuration de l'enregistrement MX permet de recevoir vos emails dans vos boites mail.",
"zimbra_domain_modal_diagnostic_mx_content_header_part2": "Votre domaine n'étant pas géré par OVH Cloud, cette action doit être effectuée manuellement.",
"zimbra_domain_modal_diagnostic_mx_content_header_part3": "Veuillez créer les champs MX sur ce domaine en donnant les mêmes informations que ci-dessous.",
"zimbra_domain_modal_diagnostic_mx_content_header_ovh_hosted_domain_part1": "La configuration de l'enregistrement MX permet de recevoir vos emails dans vos boites mail.",
"zimbra_domain_modal_diagnostic_mx_content_header_ovh_hosted_domain_part2": "Votre domaine étant hébergé chez OVH Cloud, nous allons effectuer la configuration pour vous.",
"zimbra_domain_modal_diagnostic_mx_content_header_ovh_hosted_domain_part3": "Souhaitez-vous commencer à recevoir les mails du domaine <strong>{{domain}}</strong> sur ce service ?",
"zimbra_domain_modal_diagnostic_mx_content_footer": "En cas de problème, consultez la documentation de votre fournisseur de domaine.",
"zimbra_domain_modal_diagnostic_mx_action_validate": "Confirmer",
"zimbra_domain_modal_diagnostic_mx_action_test": "Tester",
"zimbra_domain_modal_diagnostic_mx_action_cancel": "Annuler",
"zimbra_domain_modal_diagnostic_mx_action_close": "Fermer",
"zimbra_domain_modal_diagnostic_spf_title": "Diagnostique SPF",
"zimbra_domain_modal_diagnostic_spf_content_header": "Si le domaine n'est pas géré par le même identifiant client que le service Exchange ou si votre domaine n'est pas hébergé chez OVHcloud, la configuration automatique n'est pas possible. Veuillez créer le champ SPF sur ce domaine manuellement en donnant les mêmes informations que ci-dessous.",
"zimbra_domain_modal_diagnostic_spf_content_header_ovh_hosted_domain_part1": "SPF permet de valider qu'OVHCloud est un émetteur légitime de mails avec votre nom de domaine.",
"zimbra_domain_modal_diagnostic_spf_content_header_ovh_hosted_domain_part2": "Votre domaine étant hébergé chez OVHCloud, nous pouvons procéder à la configuration automatique.",
"zimbra_domain_modal_diagnostic_spf_content_header_ovh_hosted_domain_part3": "Souhaitez-vous effectuer la configuration ?",
"zimbra_domain_modal_diagnostic_spf_action_cancel": "Annuler",
"zimbra_domain_modal_diagnostic_spf_action_close": "Fermer",
"zimbra_domain_modal_diagnostic_spf_action_validate": "Ok"
"zimbra_domain_diagnostic_cta_back": "Retour aux domaines",
"zimbra_domain_diagnostic_cta_refresh": "Rafraîchir les diagnostiques",
"zimbra_domain_diagnostic_status": "Statut :",
"zimbra_domain_diagnostic_status_ok": "Configuration OK",
"zimbra_domain_diagnostic_status_error": "Erreur de configuration",
"zimbra_domain_diagnostic_status_updating": "En cours de configuration",
"zimbra_domain_diagnostic_status_to_configure": "Pas configuré",
"zimbra_domain_diagnostic_status_disabled": "Désactivé",
"zimbra_domain_diagnostic_type": "Type :",
"zimbra_domain_diagnostic_access_guide": "Accéder au guide",
"zimbra_domain_diagnostic_subtitle": "Diagnostiques du domaine {{domain}}",
"zimbra_domain_diagnostic_field_host": "Nom/Hôte :",
"zimbra_domain_diagnostic_field_subdomain": "Sous domaine :",
"zimbra_domain_diagnostic_field_priority": "Priorité :",
"zimbra_domain_diagnostic_field_weight": "Poids :",
"zimbra_domain_diagnostic_field_port": "Port :",
"zimbra_domain_diagnostic_field_target": "Cible :"
}
34 changes: 33 additions & 1 deletion packages/manager/apps/zimbra/src/api/_mock_/domain.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DomainType } from '@/api/domain';
import { DiagnosticResponse, DomainType } from '@/api/domain';
import { ResourceStatus } from '@/api/api.type';

export const domainDetailMock: DomainType = {
Expand Down Expand Up @@ -118,3 +118,35 @@ export const domainsMock: DomainType[] = [
];

export const domainZone: string[] = ['test.fr', 'mydomain.fr', 'domain.fr'];

export const domainDiagnosticMock = {
diagnostic: {
dkim: {
errorCode: 'INCORRECT_CNAME_RECORD',
errorMessage: 'string',
recordsFound: ['string'],
status: 'ERROR',
},
errorCode: 'DNS_TIMEOUT',
errorMessage: 'string',
mx: {
errorCode: 'MISSING_VALID_MX_RECORD',
errorMessage: 'string',
recordsFound: [
{
priority: 0,
target: 'string',
},
],
status: 'ERROR',
},
spf: {
recordFound: 'string',
status: 'OK',
},
status: 'ERROR',
},
domainId: '19386dad-2e50-4000-8838-d6c283317e01',
domainName: 'string',
id: '19386dad-2e50-4000-86d3-0698199f4a01',
} as DiagnosticResponse;
19 changes: 19 additions & 0 deletions packages/manager/apps/zimbra/src/api/domain/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { fetchIcebergV2, v2, v6 } from '@ovh-ux/manager-core-api';
import { DomainBodyParamsType, DomainType } from './type';
import { getApiPath } from '../utils/apiPath';
import { domainDiagnosticMock } from '../_mock_';

// GET

Expand Down Expand Up @@ -36,6 +37,24 @@ export const getZimbraPlatformDomainDetail = async (
return data;
};

export const getZimbraPlatformDomainDiagnostic = async (
platformId: string,
domainId: string,
mock = true,
) => {
if (mock) {
return new Promise((resolve) => {
setTimeout(() => {
resolve(domainDiagnosticMock);
}, 1000);
});
}
const { data } = await v2.get<DomainType>(
`${getApiPath(platformId)}domain/${domainId}/diagnostic`,
);
return data;
};

// POST

export const postZimbraDomain = async (
Expand Down
5 changes: 5 additions & 0 deletions packages/manager/apps/zimbra/src/api/domain/key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ export const getZimbraPlatformDomainsQueryKey = (
`get/zimbra/platform/${platformId}/domain?organizationId=${organizationId}`,
];

export const getZimbraPlatformDomainDiagnosticQueryKey = (
platformId: string,
domainId: string,
) => [`get/zimbra/platform/${platformId}/domain/${domainId}/diagnostic`];

export const getZimbraPlatformDomainQueryKey = (
platformId: string,
domainId: string,
Expand Down
114 changes: 114 additions & 0 deletions packages/manager/apps/zimbra/src/api/domain/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,117 @@ export type DomainType = {
organizationId: string;
};
};

export type DnsDiagnostic = MXDiagnostic | SPFDiagnostic | DKIMDiagnostic;

/** Error code of MX Diagnostics */
export enum MXErrorCodeEnum {
'MISSING_VALID_MX_RECORD' = 'MISSING_VALID_MX_RECORD',
}

/** Object representing an MX record */
export interface MXRecord {
/** Priority for that target server */
priority: number;
/** Target server */
target: string;
}

/** Object representing a MX diagnostic */
export interface MXDiagnostic {
/** Error code of the MX diagnostic */
errorCode?: MXErrorCodeEnum;
/** Error message of the MX diagnostic */
errorMessage?: string;
/** MX records found */
recordsFound?: MXRecord[];
/** Status of the MX diagnostic */
status: DiagnosticStatusEnum;
}

/** Error code of SPF Diagnostics */
export enum SPFErrorCodeEnum {
'MISSING_RECORD' = 'MISSING_RECORD',
'OVH_NOT_INCLUDED' = 'OVH_NOT_INCLUDED',
}

/** Object representing a SPF diagnostic */
export interface SPFDiagnostic {
/** Error code of the SPF diagnostic */
errorCode?: SPFErrorCodeEnum;
/** Error message of the SPF diagnostic */
errorMessage?: string;
/** Record found for SPF */
recordFound?: string;
/** Status of the SPF diagnostic */
status: DiagnosticStatusEnum;
}

/** Global status of the diagnostic */
export enum GlobalDiagnosticStatusEnum {
'ERROR' = 'ERROR',
'OK' = 'OK',
'PARTIAL' = 'PARTIAL',
}

/** Error code for glopbal diagnostic */
export enum GlobalDiagnosticErrorEnum {
'DNS_TIMEOUT' = 'DNS_TIMEOUT',
}

/** Status of the diagnostic */
export enum DiagnosticStatusEnum {
'DISABLED' = 'DISABLED',
'ERROR' = 'ERROR',
'OK' = 'OK',
'TO_CONFIGURE' = 'TO_CONFIGURE',
'UPDATING' = 'UPDATING',
}

/** Error code of DKIM Diagnostics */
export enum DKIMErrorCodeEnum {
'INCORRECT_CNAME_RECORD' = 'INCORRECT_CNAME_RECORD',
'MISSING_ONE_SELECTOR' = 'MISSING_ONE_SELECTOR',
'OVH_NOT_INCLUDED' = 'OVH_NOT_INCLUDED',
'TASK_FAILED' = 'TASK_FAILED',
}

/** Object representing a diagnostic of DKIM */
export interface DKIMDiagnostic {
/** Error code of the DKIM diagnostic */
errorCode?: DKIMErrorCodeEnum;
/** Error message of the DKIM diagnostic */
errorMessage?: string;
/** Records found in DNS identified as DKIM */
recordsFound?: string[];
/** Status of the DKIM diagnostic */
status: DiagnosticStatusEnum;
}

/** Diagnostic of a domain */
export interface Diagnostic {
/** Diagnostic of DKIM fields */
dkim?: DKIMDiagnostic;
/** Error code of the global diagnostic */
errorCode?: GlobalDiagnosticErrorEnum;
/** Error message of the global diagnostic */
errorMessage?: string;
/** Diagnostic of MX fields */
mx?: MXDiagnostic;
/** Diagnostic of SPF field */
spf?: SPFDiagnostic;
/** Global status of the diagnostic */
status: GlobalDiagnosticStatusEnum;
}

/** Response to a diagnostic request */
export interface DiagnosticResponse {
/** Diagnostic of the domain */
diagnostic: Diagnostic;
/** Id of the domain */
domainId: string;
/** Name of the domain */
domainName: string;
/** Id of the diagnostic */
id: string;
}
79 changes: 0 additions & 79 deletions packages/manager/apps/zimbra/src/components/DiagnosticBadge.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ export const Dashboard: React.FC = () => {
urls.domains,
urls.domainsEdit,
urls.domainsDelete,
urls.domains_diagnostic,
urls.domains_diagnostic_mx,
urls.domains_diagnostic_spf,
urls.domains_diagnostic_srv,
urls.domains_diagnostic_dkim,
],
platformId,
),
Expand Down
Loading

0 comments on commit 3df33fd

Please sign in to comment.