* hide standard text when we have a description

* lookup description in message bundle

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-10-10 15:17:14 +02:00 committed by Pedro Igor
parent eb5afeeabb
commit b4caeee0c7

View file

@ -5,9 +5,9 @@ import {
Page, Page,
Text, Text,
TextContent, TextContent,
TextVariants,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { label } from "../user-profile/utils";
import { getNetworkErrorDescription } from "../utils/errors"; import { getNetworkErrorDescription } from "../utils/errors";
type ErrorPageProps = { type ErrorPageProps = {
@ -30,7 +30,7 @@ export const ErrorPage = (props: ErrorPageProps) => {
<Page> <Page>
<Modal <Modal
variant={ModalVariant.small} variant={ModalVariant.small}
title={t("somethingWentWrong")} title={errorMessage ? "" : t("somethingWentWrong")}
titleIconVariant="danger" titleIconVariant="danger"
showClose={false} showClose={false}
isOpen isOpen
@ -41,9 +41,10 @@ export const ErrorPage = (props: ErrorPageProps) => {
]} ]}
> >
<TextContent> <TextContent>
<Text>{t("somethingWentWrongDescription")}</Text> {errorMessage ? (
{errorMessage && ( <Text>{label(t, errorMessage)}</Text>
<Text component={TextVariants.small}>{errorMessage}</Text> ) : (
<Text>{t("somethingWentWrongDescription")}</Text>
)} )}
</TextContent> </TextContent>
</Modal> </Modal>