Fix #9155: updated the error messages for duplicate entity failure for better context (#11865)

* Updated the entity already exits message for better context

* localization changes for other languages
This commit is contained in:
Aniket Katkar 2023-06-06 12:29:58 +05:30 committed by GitHub
parent 65f370e4aa
commit 0315fc2a74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 370 additions and 59 deletions

View File

@ -13,6 +13,7 @@
import { Col, Row, Typography } from 'antd';
import { AxiosError } from 'axios';
import { HTTP_STATUS_CODE } from 'constants/auth.constants';
import { CreateTestCase } from 'generated/api/tests/createTestCase';
import { t } from 'i18next';
import { isUndefined, toString } from 'lodash';
@ -163,7 +164,24 @@ const AddDataQualityTestV1: React.FC<AddDataQualityTestProps> = ({
setActiveServiceStep(3);
setTestCaseRes(testCaseResponse);
} catch (error) {
showErrorToast(error as AxiosError);
if (
(error as AxiosError).response?.status === HTTP_STATUS_CODE.CONFLICT
) {
showErrorToast(
t('server.entity-already-exist', {
entity: t('label.test-case'),
entityPlural: t('label.test-case-lowercase-plural'),
name: data.name,
})
);
} else {
showErrorToast(
error as AxiosError,
t('server.create-entity-error', {
entity: t('label.test-case-lowercase'),
})
);
}
}
};

View File

@ -154,6 +154,7 @@ const AddService = ({
showErrorToast(
t('server.entity-already-exist', {
entity: t('label.service'),
entityPlural: t('label.service-lowercase-plural'),
name: serviceConfig.serviceName,
})
);

View File

@ -157,7 +157,7 @@ const GlossaryHeader = ({
label: (
<ManageButtonItemLabel
description={t('message.export-entity-help', {
entity: t('label.glossary-terms-lowercase'),
entity: t('label.glossary-term-lowercase-plural'),
})}
icon={<ExportIcon width="18px" />}
id="export-button"

View File

@ -14,6 +14,7 @@
import { AxiosError } from 'axios';
import { GlossaryTermForm } from 'components/AddGlossaryTermForm/AddGlossaryTermForm.interface';
import Loader from 'components/Loader/Loader';
import { HTTP_STATUS_CODE } from 'constants/auth.constants';
import {
API_RES_MAX_SIZE,
getGlossaryTermDetailsPath,
@ -177,7 +178,24 @@ const GlossaryV1 = ({
}
onTermModalSuccess();
} catch (error) {
showErrorToast(error as AxiosError);
if (
(error as AxiosError).response?.status === HTTP_STATUS_CODE.CONFLICT
) {
showErrorToast(
t('server.entity-already-exist', {
entity: t('label.glossary-term'),
entityPlural: t('label.glossary-term-lowercase-plural'),
name: updatedData.name,
})
);
} else {
showErrorToast(
error as AxiosError,
t('server.entity-updating-error', {
entity: t('label.glossary-term-lowercase'),
})
);
}
}
};
@ -205,8 +223,25 @@ const GlossaryV1 = ({
parent: activeGlossaryTerm?.fullyQualifiedName,
});
onTermModalSuccess();
} catch (err) {
showErrorToast(err as AxiosError);
} catch (error) {
if (
(error as AxiosError).response?.status === HTTP_STATUS_CODE.CONFLICT
) {
showErrorToast(
t('server.entity-already-exist', {
entity: t('label.glossary-term'),
entityPlural: t('label.glossary-term-lowercase-plural'),
name: formData.name,
})
);
} else {
showErrorToast(
error as AxiosError,
t('server.create-entity-error', {
entity: t('label.glossary-term-lowercase'),
})
);
}
}
};

View File

@ -36,6 +36,8 @@
"advanced-search": "Advanced Search",
"airflow-config-plural": "airflow configs",
"alert": "Alert",
"alert-lowercase": "alert",
"alert-lowercase-plural": "alerts",
"alert-plural": "Alerts",
"alert-type": "Alert Type",
"algorithm": "Algorithm",
@ -107,6 +109,7 @@
"claim-ownership": "Claim Ownership",
"classification": "Classification",
"classification-lowercase": "classification",
"classification-lowercase-plural": "classifications",
"classification-plural": "Classifications",
"clean-up-policy-plural-lowercase": "clean-up policies",
"clear-entity": "Clear {{entity}}",
@ -373,11 +376,14 @@
"generate": "Generate",
"generate-new-token": "Generate New Token",
"glossary": "Glossary",
"glossary-lowercase": "glossary",
"glossary-lowercase-plural": "glossaries",
"glossary-name": "Glossary Name",
"glossary-plural": "Glossaries",
"glossary-term": "Glossary Term",
"glossary-term-lowercase": "glossary term",
"glossary-term-lowercase-plural": "glossary terms",
"glossary-term-plural": "Glossary Terms",
"glossary-terms-lowercase": "glossary terms",
"go-back": "Go Back",
"go-to-home-page": "Go To Homepage",
"google": "Google",
@ -635,6 +641,7 @@
"plus-symbol": "+",
"policy": "Policy",
"policy-lowercase": "policy",
"policy-lowercase-plural": "policies",
"policy-name": "Policy Name",
"policy-plural": "Policies",
"posted-on-lowercase": "posted on",
@ -720,6 +727,7 @@
"revoke-token": "Revoke token",
"role": "Role",
"role-lowercase": "role",
"role-lowercase-plural": "roles",
"role-name": "Role Name",
"role-plural": "Roles",
"row": "Row",
@ -727,8 +735,10 @@
"row-plural": "Rows",
"rule": "Rule",
"rule-effect": "Rule Effect",
"rule-lowercase": "rule",
"rule-lowercase-plural": "rules",
"rule-name": "Rule Name",
"rules": "Rules",
"rule-plural": "Rules",
"run": "Run",
"running": "Running",
"runs-for": "Runs for",
@ -781,6 +791,7 @@
"service-created-successfully": "Service Created Successfully",
"service-detail-lowercase-plural": "service-details",
"service-lowercase": "service",
"service-lowercase-plural": "services",
"service-name": "Service Name",
"service-plural": "Services",
"service-sso": "{{serviceType}} SSO",
@ -848,6 +859,7 @@
"tag": "Tag",
"tag-category-lowercase": "tag category",
"tag-lowercase": "tag",
"tag-lowercase-plural": "tags",
"tag-plural": "Tags",
"target": "Target",
"target-column": "Target Column",
@ -868,11 +880,14 @@
"test": "Test",
"test-case": "Test case",
"test-case-lowercase": "test case",
"test-case-lowercase-plural": "test cases",
"test-case-plural": "Test Cases",
"test-entity": "Test {{entity}}",
"test-plural": "Tests",
"test-suite": "Test Suite",
"test-suite-ingestion": "Test suite ingestion",
"test-suite-lowercase": "test suite",
"test-suite-lowercase-plural": "test suites",
"test-suite-plural": "Test Suites",
"test-suite-status": "Test Suite Status",
"test-type": "Test type",
@ -1388,7 +1403,8 @@
"email-found": "User with the given email address already exists!",
"email-not-found": "User with the given email address does not exist!",
"email-verification-error": "An email could not be sent for verification. Please contact your Administrator.",
"entity-already-exist": "{{entity}} \"{{name}}\" already exists. Duplicated {{entity}} are not allowed.",
"entity-already-exist": "{{entity}} \"{{name}}\" already exists. Duplicated {{entityPlural}} are not allowed.",
"entity-already-exist-message-without-name": "A {{entity}} with the given details already exists. Duplicated {{entityPlural}} are not allowed.",
"entity-creation-error": "Error while creating {{entity}}",
"entity-deleted-successfully": "{{entity}} deleted successfully!",
"entity-details-fetch-error": "Error while fetching details for {{entityType}} {{entityName}}",

View File

@ -36,6 +36,8 @@
"advanced-search": "Advanced Search",
"airflow-config-plural": "Configuraciones de airflow",
"alert": "Alerta",
"alert-lowercase": "alert",
"alert-lowercase-plural": "alerts",
"alert-plural": "Alertas",
"alert-type": "Alert Type",
"algorithm": "Algoritmo",
@ -107,6 +109,7 @@
"claim-ownership": "Reclamar propiedad",
"classification": "Clasificación",
"classification-lowercase": "clasificación",
"classification-lowercase-plural": "classifications",
"classification-plural": "Clasificaciones",
"clean-up-policy-plural-lowercase": "políticas de limpieza",
"clear-entity": "Limpiar {{entity}}",
@ -373,11 +376,14 @@
"generate": "Generar",
"generate-new-token": "Generar un nuevo token",
"glossary": "Glosario",
"glossary-lowercase": "glossary",
"glossary-lowercase-plural": "glossaries",
"glossary-name": "Nombre del glosario",
"glossary-plural": "Glosarios",
"glossary-term": "Término del glosario",
"glossary-term-lowercase": "glossary term",
"glossary-term-lowercase-plural": "glossary terms",
"glossary-term-plural": "Términos de glosario",
"glossary-terms-lowercase": "glossary terms",
"go-back": "Volver",
"go-to-home-page": "Ir a la página principal",
"google": "Google",
@ -635,6 +641,7 @@
"plus-symbol": "+",
"policy": "Política",
"policy-lowercase": "política",
"policy-lowercase-plural": "policies",
"policy-name": "Nombre de la política",
"policy-plural": "Políticas",
"posted-on-lowercase": "publicado en",
@ -720,6 +727,7 @@
"revoke-token": "Revocar token",
"role": "Rol",
"role-lowercase": "rol",
"role-lowercase-plural": "roles",
"role-name": "Nombre del Rol",
"role-plural": "Roles",
"row": "Fila",
@ -727,8 +735,10 @@
"row-plural": "Filas",
"rule": "Regla",
"rule-effect": "Efecto de la Regla",
"rule-lowercase": "rule",
"rule-lowercase-plural": "rules",
"rule-name": "Nombre de la Regla",
"rules": "Reglas",
"rule-plural": "Rules",
"run": "Ejecutar",
"running": "Running",
"runs-for": "Runs for",
@ -781,6 +791,7 @@
"service-created-successfully": "Servicio Creado correctamente",
"service-detail-lowercase-plural": "detalles del servicio",
"service-lowercase": "servicio",
"service-lowercase-plural": "services",
"service-name": "Nombre del Servicio",
"service-plural": "Servicios",
"service-sso": "{{serviceType}} SSO",
@ -848,6 +859,7 @@
"tag": "Etiqueta",
"tag-category-lowercase": "categoría de etiqueta",
"tag-lowercase": "etiqueta",
"tag-lowercase-plural": "tags",
"tag-plural": "Etiquetas",
"target": "Objetivo",
"target-column": "Columna de Objetivo",
@ -868,11 +880,14 @@
"test": "Prueba",
"test-case": "Caso de Prueba",
"test-case-lowercase": "caso de prueba",
"test-case-lowercase-plural": "test cases",
"test-case-plural": "Casos de Prueba",
"test-entity": "Prueba {{entity}}",
"test-plural": "Pruebas",
"test-suite": "Suite de Pruebas",
"test-suite-ingestion": "Ingesta de Suite de Tests",
"test-suite-lowercase": "test suite",
"test-suite-lowercase-plural": "test suites",
"test-suite-plural": "Suites de Tests",
"test-suite-status": "Estado de Suite de Tests",
"test-type": "Tipo de Test",
@ -1389,6 +1404,7 @@
"email-not-found": "¡No existe un usuario con la dirección de correo electrónico proporcionada!",
"email-verification-error": "No se pudo enviar un correo electrónico para verificar. Por favor contacta a tu administrador.",
"entity-already-exist": "{{entity}} \"{{name}}\" ya existe. No se permiten {{entity}} duplicados.",
"entity-already-exist-message-without-name": "A {{entity}} with the given details already exists. Duplicated {{entityPlural}} are not allowed.",
"entity-creation-error": "Error al crear {{entity}}",
"entity-deleted-successfully": "¡{{entity}} eliminado exitosamente!",
"entity-details-fetch-error": "Error al recuperar detalles para {{entityType}} {{entityName}}",

View File

@ -36,6 +36,8 @@
"advanced-search": "Recherche Avancée",
"airflow-config-plural": "configs airflow",
"alert": "Alerte",
"alert-lowercase": "alert",
"alert-lowercase-plural": "alerts",
"alert-plural": "Alertes",
"alert-type": "Type d'Alerte",
"algorithm": "Algorithme",
@ -107,6 +109,7 @@
"claim-ownership": "Assumer la Propriété",
"classification": "Classification",
"classification-lowercase": "classification",
"classification-lowercase-plural": "classifications",
"classification-plural": "Classifications",
"clean-up-policy-plural-lowercase": "Nettoyer les stratégies",
"clear-entity": "Effacer {{entity}}",
@ -373,11 +376,14 @@
"generate": "Générer",
"generate-new-token": "Générer un Nouveau Jeton",
"glossary": "Glossaire",
"glossary-lowercase": "glossary",
"glossary-lowercase-plural": "glossaries",
"glossary-name": "Nom du Glossaire",
"glossary-plural": "Glossaires",
"glossary-term": "Terme du Glossaire",
"glossary-term-lowercase": "glossary term",
"glossary-term-lowercase-plural": "glossary terms",
"glossary-term-plural": "Termes du Glossaire",
"glossary-terms-lowercase": "glossary terms",
"go-back": "Retour en arrière",
"go-to-home-page": "Retour à la page d'accueil",
"google": "Google",
@ -635,6 +641,7 @@
"plus-symbol": "+",
"policy": "Stratégie",
"policy-lowercase": "stratégie",
"policy-lowercase-plural": "policies",
"policy-name": "Nom de la Stratégie",
"policy-plural": "Stratégies",
"posted-on-lowercase": "publié le",
@ -720,6 +727,7 @@
"revoke-token": "Révoquer le jeton",
"role": "Rôle",
"role-lowercase": "rôle",
"role-lowercase-plural": "roles",
"role-name": "Nom du rôle",
"role-plural": "Rôles",
"row": "Ligne",
@ -727,8 +735,10 @@
"row-plural": "Lignes",
"rule": "Règle",
"rule-effect": "Effet de la Règle",
"rule-lowercase": "rule",
"rule-lowercase-plural": "rules",
"rule-name": "Nom de la Règle",
"rules": "Règles",
"rule-plural": "Rules",
"run": "Executer",
"running": "En cours d'exécution",
"runs-for": "Exécution pour",
@ -781,6 +791,7 @@
"service-created-successfully": "Service créé avec succès",
"service-detail-lowercase-plural": "détails du service",
"service-lowercase": "service",
"service-lowercase-plural": "services",
"service-name": "Nom du Service",
"service-plural": "Services",
"service-sso": "{{serviceType}} SSO",
@ -848,6 +859,7 @@
"tag": "Tag",
"tag-category-lowercase": "catégorie du tag",
"tag-lowercase": "tag",
"tag-lowercase-plural": "tags",
"tag-plural": "Tags",
"target": "Cible",
"target-column": "Colonne Cible",
@ -868,11 +880,14 @@
"test": "Test",
"test-case": "Cas de Test",
"test-case-lowercase": "cas de test",
"test-case-lowercase-plural": "test cases",
"test-case-plural": "Cas de Tests",
"test-entity": "Test {{entity}}",
"test-plural": "Tests",
"test-suite": "Ensemble de Tests",
"test-suite-ingestion": "Ingestion de l'Ensemble de Tests",
"test-suite-lowercase": "test suite",
"test-suite-lowercase-plural": "test suites",
"test-suite-plural": "Ensembles de Tests",
"test-suite-status": "Statut de l'Ensemble de Tests",
"test-type": "Type de Test",
@ -1389,6 +1404,7 @@
"email-not-found": "Aucun utilisateur avec l'adresse e-mail fournie n'existe !",
"email-verification-error": "Un e-mail de vérification n'a pas pu être envoyé. Veuillez contacter votre administrateur.",
"entity-already-exist": "{{entity}} \"{{name}}\" existe déjà. Les doublons de {{entity}} ne sont pas autorisés.",
"entity-already-exist-message-without-name": "A {{entity}} with the given details already exists. Duplicated {{entityPlural}} are not allowed.",
"entity-creation-error": "Erreur lors de la création de {{entity}}",
"entity-deleted-successfully": "{{entity}} supprimé avec succès !",
"entity-details-fetch-error": "Erreur lors de la récupération des détails pour {{entityType}} {{entityName}}",

View File

@ -36,6 +36,8 @@
"advanced-search": "Advanced Search",
"airflow-config-plural": "Airflowの設定",
"alert": "アラート",
"alert-lowercase": "alert",
"alert-lowercase-plural": "alerts",
"alert-plural": "アラート",
"alert-type": "Alert Type",
"algorithm": "アルゴリズム",
@ -107,6 +109,7 @@
"claim-ownership": "所有権を要求する",
"classification": "分類",
"classification-lowercase": "分類",
"classification-lowercase-plural": "classifications",
"classification-plural": "分類",
"clean-up-policy-plural-lowercase": "ポリシーの削除",
"clear-entity": "{{entity}}を削除",
@ -373,11 +376,14 @@
"generate": "生成",
"generate-new-token": "新しいトークンを生成",
"glossary": "用語集",
"glossary-lowercase": "glossary",
"glossary-lowercase-plural": "glossaries",
"glossary-name": "Glossary Name",
"glossary-plural": "Glossaries",
"glossary-term": "用語集の用語",
"glossary-term-lowercase": "glossary term",
"glossary-term-lowercase-plural": "glossary terms",
"glossary-term-plural": "用語集の用語",
"glossary-terms-lowercase": "glossary terms",
"go-back": "前に戻る",
"go-to-home-page": "ホームに戻る",
"google": "Google",
@ -635,6 +641,7 @@
"plus-symbol": "+",
"policy": "ポリシー",
"policy-lowercase": "ポリシー",
"policy-lowercase-plural": "policies",
"policy-name": "ポリシー名",
"policy-plural": "ポリシー",
"posted-on-lowercase": "投稿",
@ -720,6 +727,7 @@
"revoke-token": "Revoke token",
"role": "ロール",
"role-lowercase": "ロール",
"role-lowercase-plural": "roles",
"role-name": "ロール名",
"role-plural": "ロール",
"row": "行",
@ -727,8 +735,10 @@
"row-plural": "行",
"rule": "ルール",
"rule-effect": "ルールの効果",
"rule-lowercase": "rule",
"rule-lowercase-plural": "rules",
"rule-name": "ルール名",
"rules": "ルール",
"rule-plural": "Rules",
"run": "実行",
"running": "Running",
"runs-for": "Runs for",
@ -781,6 +791,7 @@
"service-created-successfully": "Service Created Successfully",
"service-detail-lowercase-plural": "service-details",
"service-lowercase": "サービス",
"service-lowercase-plural": "services",
"service-name": "サービス名",
"service-plural": "サービス",
"service-sso": "{{serviceType}} SSO",
@ -848,6 +859,7 @@
"tag": "タグ",
"tag-category-lowercase": "タグのカテゴリ",
"tag-lowercase": "タグ",
"tag-lowercase-plural": "tags",
"tag-plural": "タグ",
"target": "ターゲット",
"target-column": "Target Column",
@ -868,11 +880,14 @@
"test": "テスト",
"test-case": "テストケース",
"test-case-lowercase": "テストケース",
"test-case-lowercase-plural": "test cases",
"test-case-plural": "テストケース",
"test-entity": "テスト {{entity}}",
"test-plural": "テスト",
"test-suite": "テストスイート",
"test-suite-ingestion": "Test suite ingestion",
"test-suite-lowercase": "test suite",
"test-suite-lowercase-plural": "test suites",
"test-suite-plural": "テストスイート",
"test-suite-status": "テストスイートの状態",
"test-type": "テスト種別",
@ -1389,6 +1404,7 @@
"email-not-found": "このメールアドレスのユーザーは存在しません!",
"email-verification-error": "確認のためのメールを送信できませんでした。管理者までご連絡ください。",
"entity-already-exist": "{{entity}} \"{{name}}\" already exists. Duplicated {{entity}} are not allowed.",
"entity-already-exist-message-without-name": "A {{entity}} with the given details already exists. Duplicated {{entityPlural}} are not allowed.",
"entity-creation-error": "{{entity}}の作成中にエラーが発生しました",
"entity-deleted-successfully": "{{entity}} deleted successfully!",
"entity-details-fetch-error": "{{entityType}} {{entityName}}から詳細を取得中にエラーが発生しました",

View File

@ -36,6 +36,8 @@
"advanced-search": "Advanced Search",
"airflow-config-plural": "Configurações do Airflow",
"alert": "Alerta",
"alert-lowercase": "alert",
"alert-lowercase-plural": "alerts",
"alert-plural": "Alertas",
"alert-type": "Alert Type",
"algorithm": "Algoritmo",
@ -107,6 +109,7 @@
"claim-ownership": "Reivindicar propriedade",
"classification": "Classificação",
"classification-lowercase": "classificação",
"classification-lowercase-plural": "classifications",
"classification-plural": "Classificações",
"clean-up-policy-plural-lowercase": "limpar políticas",
"clear-entity": "Limpar {{entity}}",
@ -373,11 +376,14 @@
"generate": "Gerar",
"generate-new-token": "Gerar novo Token",
"glossary": "Glossário",
"glossary-lowercase": "glossary",
"glossary-lowercase-plural": "glossaries",
"glossary-name": "Glossary Name",
"glossary-plural": "Glossários",
"glossary-term": "Termo do glossário",
"glossary-term-lowercase": "glossary term",
"glossary-term-lowercase-plural": "glossary terms",
"glossary-term-plural": "Termos do glossário",
"glossary-terms-lowercase": "glossary terms",
"go-back": "Retornar",
"go-to-home-page": "Ir para página inicial",
"google": "Google",
@ -635,6 +641,7 @@
"plus-symbol": "+",
"policy": "Politica",
"policy-lowercase": "política",
"policy-lowercase-plural": "policies",
"policy-name": "Nome da política",
"policy-plural": "Políticas",
"posted-on-lowercase": "postado em",
@ -720,6 +727,7 @@
"revoke-token": "Revogar Token",
"role": "Função",
"role-lowercase": "função",
"role-lowercase-plural": "roles",
"role-name": "Nome da função",
"role-plural": "Funções",
"row": "Linha",
@ -727,8 +735,10 @@
"row-plural": "Linhas",
"rule": "Regra",
"rule-effect": "Efeito da regra",
"rule-lowercase": "rule",
"rule-lowercase-plural": "rules",
"rule-name": "Nome da regra",
"rules": "Regras",
"rule-plural": "Rules",
"run": "Executar",
"running": "Running",
"runs-for": "Runs for",
@ -781,6 +791,7 @@
"service-created-successfully": "Serviço Criado com Sucesso",
"service-detail-lowercase-plural": "detalhes de serviço",
"service-lowercase": "serviço",
"service-lowercase-plural": "services",
"service-name": "Nome do Serviço",
"service-plural": "Serviços",
"service-sso": "{{serviceType}} SSO",
@ -848,6 +859,7 @@
"tag": "Tag",
"tag-category-lowercase": "categoria de tag",
"tag-lowercase": "tag",
"tag-lowercase-plural": "tags",
"tag-plural": "Tags",
"target": "Alvo",
"target-column": "Coluna Alvo",
@ -868,11 +880,14 @@
"test": "Teste",
"test-case": "Caso de Teste",
"test-case-lowercase": "caso de teste",
"test-case-lowercase-plural": "test cases",
"test-case-plural": "Casos de Teste",
"test-entity": "Teste {{entity}}",
"test-plural": "Testes",
"test-suite": "Conjunto de Testes",
"test-suite-ingestion": "Ingestão do Conjunto de Testes",
"test-suite-lowercase": "test suite",
"test-suite-lowercase-plural": "test suites",
"test-suite-plural": "Conjuntos de Testes",
"test-suite-status": "Status do Conjunto de Testes",
"test-type": "Tipo de Teste",
@ -1389,6 +1404,7 @@
"email-not-found": "Usuário com o endereço de e-mail fornecido não existe!",
"email-verification-error": "Não foi possível enviar um e-mail para verificação. Entre em contato com seu Administrador.",
"entity-already-exist": "{{entity}} \"{{name}}\" already exists. Duplicated {{entity}} are not allowed.",
"entity-already-exist-message-without-name": "A {{entity}} with the given details already exists. Duplicated {{entityPlural}} are not allowed.",
"entity-creation-error": "Erro ao criar {{entity}}",
"entity-deleted-successfully": "{{entity}} excluído com sucesso!",
"entity-details-fetch-error": "Erro ao buscar detalhes para {{entityType}} {{entityName}}",

View File

@ -36,6 +36,8 @@
"advanced-search": "高级搜索",
"airflow-config-plural": "airflow 配置",
"alert": "提醒",
"alert-lowercase": "alert",
"alert-lowercase-plural": "alerts",
"alert-plural": "提醒",
"alert-type": "提醒类型",
"algorithm": "算法",
@ -107,6 +109,7 @@
"claim-ownership": "声明所有权",
"classification": "分类",
"classification-lowercase": "分类",
"classification-lowercase-plural": "classifications",
"classification-plural": "分类",
"clean-up-policy-plural-lowercase": "清理策略",
"clear-entity": "清除{{entity}}",
@ -373,11 +376,14 @@
"generate": "生成",
"generate-new-token": "生成新令牌",
"glossary": "术语库",
"glossary-lowercase": "glossary",
"glossary-lowercase-plural": "glossaries",
"glossary-name": "术语库名",
"glossary-plural": "术语库",
"glossary-term": "术语",
"glossary-term-lowercase": "glossary term",
"glossary-term-lowercase-plural": "glossary terms",
"glossary-term-plural": "术语",
"glossary-terms-lowercase": "glossary terms",
"go-back": "返回",
"go-to-home-page": "转到首页",
"google": "Google",
@ -635,6 +641,7 @@
"plus-symbol": "+",
"policy": "策略",
"policy-lowercase": "策略",
"policy-lowercase-plural": "policies",
"policy-name": "策略名",
"policy-plural": "策略",
"posted-on-lowercase": "发布于",
@ -720,6 +727,7 @@
"revoke-token": "吊销令牌",
"role": "角色",
"role-lowercase": "角色",
"role-lowercase-plural": "roles",
"role-name": "角色名",
"role-plural": "角色",
"row": "行",
@ -727,8 +735,10 @@
"row-plural": "行",
"rule": "规则",
"rule-effect": "规则生效",
"rule-lowercase": "rule",
"rule-lowercase-plural": "rules",
"rule-name": "规则名称",
"rules": "规则",
"rule-plural": "Rules",
"run": "运行",
"running": "正在运行",
"runs-for": "运行时长",
@ -781,6 +791,7 @@
"service-created-successfully": "服务成功创建",
"service-detail-lowercase-plural": "服务详情",
"service-lowercase": "服务",
"service-lowercase-plural": "services",
"service-name": "服务名",
"service-plural": "服务",
"service-sso": "{{serviceType}}单点登录",
@ -848,6 +859,7 @@
"tag": "标签",
"tag-category-lowercase": "标签分类",
"tag-lowercase": "标签",
"tag-lowercase-plural": "tags",
"tag-plural": "标签",
"target": "目标",
"target-column": "目标列",
@ -868,11 +880,14 @@
"test": "测试",
"test-case": "测试用例",
"test-case-lowercase": "测试用例",
"test-case-lowercase-plural": "test cases",
"test-case-plural": "测试用例",
"test-entity": "测试{{entity}}",
"test-plural": "测试",
"test-suite": "质控测试集",
"test-suite-ingestion": "质控测试集提取",
"test-suite-lowercase": "test suite",
"test-suite-lowercase-plural": "test suites",
"test-suite-plural": "质控测试集",
"test-suite-status": "质控测试集状态",
"test-type": "测试类型",
@ -1389,6 +1404,7 @@
"email-not-found": "具有给定电子邮箱地址的用户不存在!",
"email-verification-error": "无法发送验证电子邮箱,请联系您的管理员",
"entity-already-exist": "于该名称\"{{name}}\"同名的{{entity}}已经存在,不允许重名",
"entity-already-exist-message-without-name": "A {{entity}} with the given details already exists. Duplicated {{entityPlural}} are not allowed.",
"entity-creation-error": "创建{{entity}}时发生错误",
"entity-deleted-successfully": "{{entity}}删除成功!",
"entity-details-fetch-error": "获取{{entityType}}{{entityName}}的详细信息时发生错误!",

View File

@ -29,8 +29,10 @@ import {
} from 'antd';
import { useForm } from 'antd/lib/form/Form';
import { DefaultOptionType } from 'antd/lib/select';
import { AxiosError } from 'axios';
import { AsyncSelect } from 'components/AsyncSelect/AsyncSelect';
import RichTextEditor from 'components/common/rich-text-editor/RichTextEditor';
import { HTTP_STATUS_CODE } from 'constants/auth.constants';
import { SubscriptionType } from 'generated/events/api/createEventSubscription';
import {
AlertType,
@ -212,18 +214,32 @@ const AddAlertPage = () => {
)
);
} catch (error) {
showErrorToast(
t(
`server.${
isEditMode ? 'entity-updating-error' : 'entity-creation-error'
}`,
{
entity: t('label.alert-plural'),
}
)
);
if (
(error as AxiosError).response?.status === HTTP_STATUS_CODE.CONFLICT
) {
showErrorToast(
t('server.entity-already-exist', {
entity: t('label.alert'),
entityPlural: t('label.alert-lowercase-plural'),
name: data.name,
})
);
} else {
showErrorToast(
error as AxiosError,
t(
`server.${
isEditMode ? 'entity-updating-error' : 'entity-creation-error'
}`,
{
entity: t('label.alert-lowercase'),
}
)
);
}
} finally {
setIsButtonLoading(false);
}
setIsButtonLoading(false);
};
const getUsersAndTeamsOptions = useCallback(async (search: string) => {

View File

@ -77,11 +77,12 @@ const AddGlossaryPage: FunctionComponent = () => {
getIsErrorMatch(error as AxiosError, ERROR_MESSAGE.alreadyExist)
? t('server.entity-already-exist', {
entity: t('label.glossary'),
entityPlural: t('label.glossary-lowercase-plural'),
name: data.name,
})
: (error as AxiosError),
t('server.add-entity-error', {
entity: t('label.glossary'),
entity: t('label.glossary-lowercase'),
})
);
} finally {

View File

@ -28,6 +28,7 @@ import { TitleBreadcrumbProps } from 'components/common/title-breadcrumb/title-b
import PageLayoutV1 from 'components/containers/PageLayoutV1';
import { usePermissionProvider } from 'components/PermissionProvider/PermissionProvider';
import SchemaEditor from 'components/schema-editor/SchemaEditor';
import { HTTP_STATUS_CODE } from 'constants/auth.constants';
import {
getTableTabPath,
INITIAL_PAGING_VALUE,
@ -169,7 +170,22 @@ const AddQueryPage = () => {
setIsSaving(false);
handleCancelClick();
} catch (error) {
showErrorToast(error as AxiosError);
if (
(error as AxiosError).response?.status === HTTP_STATUS_CODE.CONFLICT
) {
showErrorToast(
t('server.entity-already-exist-message-without-name', {
entity: t('label.query'),
entityPlural: t('label.query-lowercase-plural'),
})
);
} else {
showErrorToast(
t('server.create-entity-error', {
entity: t('label.query-plural'),
})
);
}
setIsSaving(false);
}
};

View File

@ -91,7 +91,7 @@ const CreateUserPage = () => {
if (isBotExists) {
showErrorToast(
t('server.email-already-exist', {
entity: t('label.bot'),
entity: t('label.bot-lowercase'),
name: userData.name,
})
);
@ -128,8 +128,8 @@ const CreateUserPage = () => {
} catch (error) {
handleSaveFailure(
getIsErrorMatch(error as AxiosError, ERROR_MESSAGE.alreadyExist)
? t('server.entity-already-exist', {
entity: t('label.user'),
? t('server.email-already-exist', {
entity: t('label.user-lowercase'),
name: userData.name,
})
: (error as AxiosError),

View File

@ -103,6 +103,7 @@ const AddPolicyPage = () => {
getIsErrorMatch(error as AxiosError, ERROR_MESSAGE.alreadyExist)
? t('server.entity-already-exist', {
entity: t('label.policy'),
entityPlural: t('label.policy-lowercase-plural'),
name: data.name,
})
: (error as AxiosError)

View File

@ -15,6 +15,7 @@ import { Button, Card, Col, Form, Row, Space, Typography } from 'antd';
import { AxiosError } from 'axios';
import TitleBreadcrumb from 'components/common/title-breadcrumb/title-breadcrumb.component';
import Loader from 'components/Loader/Loader';
import { HTTP_STATUS_CODE } from 'constants/auth.constants';
import { compare } from 'fast-json-patch';
import { trim } from 'lodash';
import React, { useEffect, useMemo, useState } from 'react';
@ -103,7 +104,24 @@ const AddRulePage = () => {
handleBack();
}
} catch (error) {
showErrorToast(error as AxiosError);
if (
(error as AxiosError).response?.status === HTTP_STATUS_CODE.CONFLICT
) {
showErrorToast(
t('server.entity-already-exist', {
entity: t('label.rule'),
entityPlural: t('label.rule-lowercase-plural'),
name: ruleData.name,
})
);
} else {
showErrorToast(
error as AxiosError,
t('server.create-entity-error', {
entity: t('label.rule-lowercase'),
})
);
}
}
};

View File

@ -15,6 +15,7 @@ import { Button, Card, Col, Form, Row, Space, Typography } from 'antd';
import { AxiosError } from 'axios';
import TitleBreadcrumb from 'components/common/title-breadcrumb/title-breadcrumb.component';
import Loader from 'components/Loader/Loader';
import { HTTP_STATUS_CODE } from 'constants/auth.constants';
import { compare } from 'fast-json-patch';
import { trim } from 'lodash';
import React, { useEffect, useMemo, useState } from 'react';
@ -122,7 +123,24 @@ const EditRulePage = () => {
handleBack();
}
} catch (error) {
showErrorToast(error as AxiosError);
if (
(error as AxiosError).response?.status === HTTP_STATUS_CODE.CONFLICT
) {
showErrorToast(
t('server.entity-already-exist', {
entity: t('label.rule'),
entityPlural: t('label.rule-lowercase-plural'),
name: ruleData.name,
})
);
} else {
showErrorToast(
error as AxiosError,
t('server.entity-updating-error', {
entity: t('label.rule-lowercase'),
})
);
}
}
};

View File

@ -120,7 +120,7 @@ describe('Test Policy details page', () => {
const description = await screen.findByTestId('description-data');
const rulesTab = await screen.findByText('label.rules');
const rulesTab = await screen.findByText('label.rule-plural');
const rolesTab = await screen.findByText('label.role-plural');

View File

@ -386,7 +386,7 @@ const PoliciesDetailPage = () => {
/>
<Tabs defaultActiveKey="rules">
<TabPane key="rules" tab={t('label.rules')}>
<TabPane key="rules" tab={t('label.rule-plural')}>
{isEmpty(policy.rules) ? (
<ErrorPlaceHolder />
) : (

View File

@ -94,6 +94,7 @@ const AddRolePage = () => {
getIsErrorMatch(error as AxiosError, ERROR_MESSAGE.alreadyExist)
? t('server.entity-already-exist', {
entity: t('label.role'),
entityPlural: t('label.role-lowercase-plural'),
name: data.name,
})
: (error as AxiosError)

View File

@ -45,6 +45,7 @@ import {
ResourceEntity,
} from 'components/PermissionProvider/PermissionProvider.interface';
import TagsLeftPanelSkeleton from 'components/Skeleton/Tags/TagsLeftPanelSkeleton.component';
import { HTTP_STATUS_CODE } from 'constants/auth.constants';
import { LOADING_STATE } from 'enums/common.enum';
import { compare } from 'fast-json-patch';
import { CreateTag } from 'generated/api/classification/createTag';
@ -292,12 +293,24 @@ const TagsPage = () => {
await fetchClassifications();
history.push(getTagPath(res.name));
} catch (error) {
showErrorToast(
error as AxiosError,
t('server.create-entity-error', {
entity: t('label.tag-category-lowercase'),
})
);
if (
(error as AxiosError).response?.status === HTTP_STATUS_CODE.CONFLICT
) {
showErrorToast(
t('server.entity-already-exist', {
entity: t('label.classification'),
entityPlural: t('label.classification-lowercase-plural'),
name: data.name,
})
);
} else {
showErrorToast(
error as AxiosError,
t('server.create-entity-error', {
entity: t('label.classification-lowercase'),
})
);
}
} finally {
setIsAddingClassification(false);
setIsButtonLoading(false);
@ -432,7 +445,24 @@ const TagsPage = () => {
throw t('server.unexpected-response');
}
} catch (error) {
showErrorToast(error as AxiosError);
if (
(error as AxiosError).response?.status === HTTP_STATUS_CODE.CONFLICT
) {
showErrorToast(
t('server.entity-already-exist', {
entity: t('label.classification'),
entityPlural: t('label.classification-lowercase-plural'),
name: updatedClassification.name,
})
);
} else {
showErrorToast(
error as AxiosError,
t('server.entity-updating-error', {
entity: t('label.classification-lowercase'),
})
);
}
} finally {
setIsEditClassification(false);
}
@ -467,12 +497,24 @@ const TagsPage = () => {
fetchCurrentClassification(currentClassification?.name as string, true);
} catch (error) {
showErrorToast(
error as AxiosError,
t('label.create-entity-error', {
entity: t('label.tag-lowercase'),
})
);
if (
(error as AxiosError).response?.status === HTTP_STATUS_CODE.CONFLICT
) {
showErrorToast(
t('server.entity-already-exist', {
entity: t('label.tag'),
entityPlural: t('label.tag-lowercase-plural'),
name: data.name,
})
);
} else {
showErrorToast(
error as AxiosError,
t('server.create-entity-error', {
entity: t('label.tag-lowercase'),
})
);
}
} finally {
setIsAddingTag(false);
}
@ -493,7 +535,24 @@ const TagsPage = () => {
throw t('server.unexpected-response');
}
} catch (error) {
showErrorToast(error as AxiosError);
if (
(error as AxiosError).response?.status === HTTP_STATUS_CODE.CONFLICT
) {
showErrorToast(
t('server.entity-already-exist', {
entity: t('label.tag'),
entityPlural: t('label.tag-lowercase-plural'),
name: updatedData.name,
})
);
} else {
showErrorToast(
error as AxiosError,
t('server.entity-updating-error', {
entity: t('label.tag-lowercase'),
})
);
}
} finally {
setIsButtonLoading(false);
handleCancel();

View File

@ -23,6 +23,7 @@ import SuccessScreen from 'components/common/success-screen/SuccessScreen';
import TitleBreadcrumb from 'components/common/title-breadcrumb/title-breadcrumb.component';
import PageLayoutV1 from 'components/containers/PageLayoutV1';
import IngestionStepper from 'components/IngestionStepper/IngestionStepper.component';
import { HTTP_STATUS_CODE } from 'constants/auth.constants';
import React, { useCallback, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom';
@ -63,7 +64,24 @@ const TestSuiteStepper = () => {
setTestSuiteResponse(response);
setActiveServiceStep(2);
} catch (error) {
showErrorToast(error as AxiosError);
if (
(error as AxiosError).response?.status === HTTP_STATUS_CODE.CONFLICT
) {
showErrorToast(
t('server.entity-already-exist', {
entity: t('label.test-suite'),
entityPlural: t('label.test-suite-lowercase-plural'),
name: data.name,
})
);
} else {
showErrorToast(
error as AxiosError,
t('server.create-entity-error', {
entity: t('label.test-suite-lowercase'),
})
);
}
}
};

View File

@ -21,6 +21,7 @@ import {
ResourceEntity,
} from 'components/PermissionProvider/PermissionProvider.interface';
import TeamDetailsV1 from 'components/TeamDetails/TeamDetailsV1';
import { HTTP_STATUS_CODE } from 'constants/auth.constants';
import { ERROR_PLACEHOLDER_TYPE } from 'enums/common.enum';
import { compare, Operation } from 'fast-json-patch';
import { cloneDeep, isEmpty, isUndefined } from 'lodash';
@ -265,12 +266,24 @@ const TeamsPage = () => {
handleAddTeam(false);
}
} catch (error) {
showErrorToast(
error as AxiosError,
t('message.entity-creation-error', {
entity: t('label.team'),
})
);
if (
(error as AxiosError).response?.status === HTTP_STATUS_CODE.CONFLICT
) {
showErrorToast(
t('server.entity-already-exist', {
entity: t('label.team'),
entityPlural: t('label.team-plural-lowercase'),
name: data.name,
})
);
} else {
showErrorToast(
error as AxiosError,
t('server.create-entity-error', {
entity: t('label.team-lowercase'),
})
);
}
} finally {
setIsLoading(false);
}