diff --git a/scm-ui-components/packages/ui-components/src/BackendErrorNotification.js b/scm-ui-components/packages/ui-components/src/BackendErrorNotification.js index dc38208be0..0995417e57 100644 --- a/scm-ui-components/packages/ui-components/src/BackendErrorNotification.js +++ b/scm-ui-components/packages/ui-components/src/BackendErrorNotification.js @@ -1,79 +1,74 @@ // @flow import React from "react"; -import {BackendError} from "./errors"; -import classNames from "classnames"; +import { BackendError } from "./errors"; import Notification from "./Notification"; -import {translate} from "react-i18next"; +import { translate } from "react-i18next"; type Props = { error: BackendError, t: string => string }; -type State = { collapsed: boolean }; -class BackendErrorNotification extends React.Component { +class BackendErrorNotification extends React.Component { constructor(props: Props) { super(props); - this.state = { collapsed: true }; } render() { - const { collapsed } = this.state; - const icon = collapsed ? "fa-angle-right" : "fa-angle-down"; - return ( -
-

- { - this.setState({ collapsed: !this.state.collapsed }); - }} - > - - - {this.renderErrorMessage()} - -

- {this.renderUncollapsed()} -
+
+

{this.renderErrorName()}

+

{this.renderErrorDescription()}

+ {this.renderMetadata()} +
); } - renderErrorMessage = () => { + renderErrorName = () => { const { error, t } = this.props; - const translation = t("errors." + error.errorCode); + const translation = t("errors." + error.errorCode + ".displayName"); if (translation === error.errorCode) { return error.message; } return translation; }; - renderUncollapsed = () => { + renderErrorDescription = () => { const { error, t } = this.props; - if (!this.state.collapsed) { - return ( - <> -

- {t("errors.context")} -

-
    - {error.context.map((context, index) => { - return ( -
  • - {context.type}: {context.id} -
  • - ); - })} -
- {this.renderMoreInformationLink(error)} -
-
{t("errors.errorCode")} {error.errorCode}
-
{t("errors.transactionId")} {error.transactionId}
-
- - ); + const translation = t("errors." + error.errorCode + ".description"); + if (translation === error.errorCode) { + return ""; } - return null; + return translation; + }; + + renderMetadata = () => { + const { error, t } = this.props; + return ( + <> +

+ {t("errors.context")} +

+
    + {error.context.map((context, index) => { + return ( +
  • + {context.type}: {context.id} +
  • + ); + })} +
+ {this.renderMoreInformationLink(error)} +
+
+ {t("errors.transactionId")} {error.transactionId} +
+
+ {t("errors.errorCode")} {error.errorCode} +
+
+ + ); }; renderMoreInformationLink = (error: BackendError) => { diff --git a/scm-webapp/src/main/resources/locales/de/plugins.json b/scm-webapp/src/main/resources/locales/de/plugins.json index 159194c0dc..2f619f0b8a 100644 --- a/scm-webapp/src/main/resources/locales/de/plugins.json +++ b/scm-webapp/src/main/resources/locales/de/plugins.json @@ -93,10 +93,25 @@ "errorCode": "Fehlercode", "transactionId": "Transaktions-ID", "moreInfo": "Für mehr Informationen, siehe", - "AGR7UzkhA1": "Nicht gefunden", - "FtR7UznKU1": "Existiert bereits", - "9BR7qpDAe1": "Passwortänderung nicht erlaubt", - "2wR7UzpPG1": "Konkurrierende Änderungen", - "9SR8G0kmU1": "Feature nicht unterstützt" + "AGR7UzkhA1": { + "displayName": "Nicht gefunden", + "description": "Die angefragte Entität konnte nicht gefunden werden. Möglicherweise wurde es in einer weiteren Session gelöscht." + }, + "FtR7UznKU1": { + "displayName": "Existiert bereits", + "description": "Eine Entität mit den gegebenen Schlüsselwerten existiert bereits" + }, + "9BR7qpDAe1": { + "displayName": "Passwortänderung nicht erlaubt", + "description": "Sie haben nicht die Berechtigung, das Passwort zu ändern" + }, + "2wR7UzpPG1": { + "displayName": "Konkurrierende Änderungen", + "description": "Die Entität wurde konkurrierend von einem anderen Benutzer oder einem anderen Prozess modifiziert. Bitte laden sie die Entität erneut." + }, + "9SR8G0kmU1": { + "displayName": "Feature nicht unterstützt", + "description": "Das Versionsverwaltungssystem dieses Repo unterstützt das angefragte Feature nicht." + } } } diff --git a/scm-webapp/src/main/resources/locales/en/plugins.json b/scm-webapp/src/main/resources/locales/en/plugins.json index 6319c5012e..062b59d38b 100644 --- a/scm-webapp/src/main/resources/locales/en/plugins.json +++ b/scm-webapp/src/main/resources/locales/en/plugins.json @@ -89,14 +89,29 @@ } }, "errors": { - "context": "context", + "context": "Context", "errorCode": "Error Code", "transactionId": "Transaction ID", "moreInfo": "For more information, see", - "AGR7UzkhA1": "Not found", - "FtR7UznKU1": "Already exists", - "9BR7qpDAe1": "Password change not allowed", - "2wR7UzpPG1": "Concurrent modifications", - "9SR8G0kmU1": "Feature not supported" + "AGR7UzkhA1": { + "displayName": "Not found", + "description": "The requested entity could not be found. It may have been deleted in another session." + }, + "FtR7UznKU1": { + "displayName": "Already exists", + "description": "There is already an entity with the same key values." + }, + "9BR7qpDAe1": { + "displayName": "Password change not allowed", + "description": "You do not have the permission to change the password." + }, + "2wR7UzpPG1": { + "displayName": "Concurrent modifications", + "description": "The entity has been modified concurrently by another user or another process. Please reload the entity." + }, + "9SR8G0kmU1": { + "displayName": "Feature not supported", + "description": "The version control system for this repository does not support the requested feature." + } } }