Skip to content

Commit

Permalink
[frontend] Frontend copy/paste & stacktrace (#5548-support-logs)
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahBocognano committed Apr 26, 2024
1 parent d2933b4 commit 427696e
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 9 deletions.
2 changes: 2 additions & 0 deletions opencti-platform/opencti-front/lang/front/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"An instance trigger on an entity X notifies the following events: update/deletion of X, creation/deletion of a relationship from/to X, creation/deletion of an entity that has X in its refs (for instance contains X, is shared with X, is created by X...), adding/removing X in the ref of an entity.": "Ein Instanz-Trigger auf eine Entität X meldet die folgenden Ereignisse: Aktualisierung/Löschung von X, Erstellung/Löschung einer Beziehung von/zu X, Erstellung/Löschung einer Entität, die X in ihren Referenzen hat (z.B. enthält X, wird mit X geteilt, wird von X erstellt...), Hinzufügen/Entfernen von X in der Referenz einer Entität.",
"An unknown error has occurred! Please try again later.": "Es ist ein unbekannter Fehler aufgetreten! Bitte versuchen Sie es später noch einmal.",
"An unknown error has occurred! Please try again later.": "Es ist ein unbekannter Fehler aufgetreten! Bitte versuchen Sie es später noch einmal.",
"An unknown error occurred. Please contact your administrator or the OpenCTI maintainers.": "Ein unbekannter Fehler ist aufgetreten. Bitte kontaktieren Sie Ihren Administrator oder die OpenCTI-Maintainer.",
"Analyses": "Auswertungen",
"Analysis": "Analyse",
"Analysis definition version": "Version der Analysedefinition",
Expand Down Expand Up @@ -357,6 +358,7 @@
"Copy": "Kopieren",
"Copy disabled: too many selected elements (maximum number of elements for a copy: ": "Kopieren deaktiviert: zu viele ausgewählte Elemente (maximale Anzahl von Elementen für eine Kopie:",
"Copy link": "Link kopieren",
"Copy stack trace errors": "Stacktrace-Fehler kopieren",
"Copy uri to clipboard for your csv client": "Kopiere uri in die Zwischenablage für deinen csv Client",
"Copy uri to clipboard for your Taxii client": "Kopiere uri in die Zwischenablage für deinen Taxii-Client",
"Copy/paste text content": "Kopieren/Einfügen von Textinhalten",
Expand Down
2 changes: 2 additions & 0 deletions opencti-platform/opencti-front/lang/front/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"An instance trigger on an entity X notifies the following events: update/deletion of X, creation/deletion of a relationship from/to X, creation/deletion of an entity that has X in its refs (for instance contains X, is shared with X, is created by X...), adding/removing X in the ref of an entity.": "An instance trigger on an entity X notifies the following events: update/deletion of X, creation/deletion of a relationship from/to X, creation/deletion of an entity that has X in its refs (for instance contains X, is shared with X, is created by X...), adding/removing X in the ref of an entity.",
"An unknown error has occurred! Please try again later.": "An unknown error has occurred! Please try again later.",
"An unknown error has occurred! Please try again later.": "An unknown error has occurred! Please try again later.",
"An unknown error occurred. Please contact your administrator or the OpenCTI maintainers.": "An unknown error occurred. Please contact your administrator or the OpenCTI maintainers.",
"Analyses": "Analyses",
"Analysis": "Analysis",
"Analysis definition version": "Analysis definition version",
Expand Down Expand Up @@ -357,6 +358,7 @@
"copy": "copy",
"Copy disabled: too many selected elements (maximum number of elements for a copy: ": "Copy disabled: too many selected elements (maximum number of elements for a copy: ",
"Copy link": "Copy link",
"Copy stack trace errors": "Copy stack trace errors",
"Copy uri to clipboard for your csv client": "Copy uri to clipboard for your csv client",
"Copy uri to clipboard for your Taxii client": "Copy uri to clipboard for your Taxii client",
"Copy/paste text content": "Copy/paste text content",
Expand Down
2 changes: 2 additions & 0 deletions opencti-platform/opencti-front/lang/front/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"An instance trigger on an entity X notifies the following events: update/deletion of X, creation/deletion of a relationship from/to X, creation/deletion of an entity that has X in its refs (for instance contains X, is shared with X, is created by X...), adding/removing X in the ref of an entity.": "Un desencadenador de instancia en una entidad X notifica los siguientes eventos: actualización/eliminación de X, creación/eliminación de una relación de/hacia X, creación/eliminación de una entidad que tiene X en sus referencias (por ejemplo, contiene X, se comparte con X, es creada por X...), agrega/elimina X en la referencia de una entidad.",
"An unknown error has occurred! Please try again later.": "Ha ocurrido un error desconocido. Inténtalo de nuevo más tarde.",
"An unknown error has occurred! Please try again later.": "Se ha producido un error desconocido Vuelva a intentarlo más tarde.",
"An unknown error occurred. Please contact your administrator or the OpenCTI maintainers.": "Se ha producido un error desconocido. Póngase en contacto con su administrador o con los responsables de OpenCTI.",
"Analyses": "Análisis",
"Analysis": "Análisis",
"Analysis definition version": "Versión de la definición del análisis",
Expand Down Expand Up @@ -357,6 +358,7 @@
"copy": "copia",
"Copy disabled: too many selected elements (maximum number of elements for a copy: ": "Copia deshabilitada: demasiados elementos seleccionados (número máximo de elementos para una copia: ",
"Copy link": "Copiar enlace",
"Copy stack trace errors": "Copiar errores de seguimiento de pila",
"Copy uri to clipboard for your csv client": "Copiar uri al portapapeles para su cliente csv",
"Copy uri to clipboard for your Taxii client": "Copiar uri al portapapeles para su cliente Taxii",
"Copy/paste text content": "Copiar o pegar contenido textual",
Expand Down
2 changes: 2 additions & 0 deletions opencti-platform/opencti-front/lang/front/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"An instance trigger on an entity X notifies the following events: update/deletion of X, creation/deletion of a relationship from/to X, creation/deletion of an entity that has X in its refs (for instance contains X, is shared with X, is created by X...), adding/removing X in the ref of an entity.": "Un déclencheur d’instance sur une entité X notifie les événements suivants : mise à jour/suppression de X, création/suppression d’une relation de/vers X, création/suppression d’une entité qui a X dans ses refs (par exemple contient X, est partagée avec X, est créée par X...), ajout/suppression de X dans la ref d’une entité.",
"An unknown error has occurred! Please try again later.": "Une erreur est survenue ! Merci de rééssayer plus tard.",
"An unknown error has occurred! Please try again later.": "Une erreur inconnue s'est produite ! Veuillez réessayer plus tard.",
"An unknown error occurred. Please contact your administrator or the OpenCTI maintainers.": "Une erreur inconnue s'est produite. Veuillez contacter votre administrateur ou les responsables d'OpenCTI.",
"Analyses": "Analyses",
"Analysis": "Analysis",
"Analysis definition version": "Version de la définition de l'analyse",
Expand Down Expand Up @@ -357,6 +358,7 @@
"copy": "copie",
"Copy disabled: too many selected elements (maximum number of elements for a copy: ": "Copie désactivée : trop d’éléments sélectionnés (nombre maximum d'éléments pour une copie: ",
"Copy link": "Copier le lien",
"Copy stack trace errors": "Copier les erreurs de la trace de pile",
"Copy uri to clipboard for your csv client": "Copier l'uri dans le presse-papier pour votre client csv",
"Copy uri to clipboard for your Taxii client": "Copier l'uri dans le presse-papier pour votre client Taxii",
"Copy/paste text content": "Copier/coller du contenu textuel",
Expand Down
2 changes: 2 additions & 0 deletions opencti-platform/opencti-front/lang/front/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"An instance trigger on an entity X notifies the following events: update/deletion of X, creation/deletion of a relationship from/to X, creation/deletion of an entity that has X in its refs (for instance contains X, is shared with X, is created by X...), adding/removing X in the ref of an entity.": "エンティティ X のインスタンス トリガーは、次のイベントを通知します: X の更新/削除、X からの/へのリレーションシップの作成/削除、参照に X を持つエンティティの作成/削除 (たとえば、X を含む、X と共有されている、X によって作成されている...)、エンティティの参照で X を追加/削除します。",
"An unknown error has occurred! Please try again later.": "不明なエラーが発生しました。後でもう一度お試しください。",
"An unknown error has occurred! Please try again later.": "不明なエラーが発生しました!後で再試行してください。",
"An unknown error occurred. Please contact your administrator or the OpenCTI maintainers.": "不明なエラーが発生しました。管理者か OpenCTI メンテナに連絡してください。",
"Analyses": "分析",
"Analysis": "分析",
"Analysis definition version": "解析定義バージョン",
Expand Down Expand Up @@ -357,6 +358,7 @@
"copy": "コピー",
"Copy disabled: too many selected elements (maximum number of elements for a copy: ": "コピー無効:選択した要素が多すぎます(コピーの要素の最大数:",
"Copy link": "リンクをコピー",
"Copy stack trace errors": "スタックトレースエラーのコピー",
"Copy uri to clipboard for your csv client": "csvクライアント用にuriをクリップボードにコピーする",
"Copy uri to clipboard for your Taxii client": "TaxiiクライアントのURIをクリップボードにコピーする",
"Copy/paste text content": "コンテンツのコピー/ペースト",
Expand Down
2 changes: 2 additions & 0 deletions opencti-platform/opencti-front/lang/front/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"An instance trigger on an entity X notifies the following events: update/deletion of X, creation/deletion of a relationship from/to X, creation/deletion of an entity that has X in its refs (for instance contains X, is shared with X, is created by X...), adding/removing X in the ref of an entity.": "实体 X 的实例触发器会通知以下事件:更新/删除 X、创建/删除与 X 的关系、创建/删除在其引用中包含 X 的实体(例如包含 X、与 X 共享、由 X 创建......)、在实体的引用中添加/删除 X。",
"An unknown error has occurred! Please try again later.": "发生未知错误,请稍后再试。",
"An unknown error has occurred! Please try again later.": "出现未知错误!请稍后再试。",
"An unknown error occurred. Please contact your administrator or the OpenCTI maintainers.": "出现未知错误。请联系管理员或 OpenCTI 维护人员。",
"Analyses": "分析",
"Analysis": "分析",
"Analysis definition version": "分析定义版本",
Expand Down Expand Up @@ -357,6 +358,7 @@
"copy": "复制",
"Copy disabled: too many selected elements (maximum number of elements for a copy: ": "复制已关闭:选取元素过多(复制的最大元素数:",
"Copy link": "复制链接",
"Copy stack trace errors": "复制堆栈跟踪错误",
"Copy uri to clipboard for your csv client": "将 uri 复制到剪贴板,供 csv 客户端使用",
"Copy uri to clipboard for your Taxii client": "为 Taxii 客户端复制 uri 到剪贴板",
"Copy/paste text content": "复制/粘贴文本内容",
Expand Down
38 changes: 29 additions & 9 deletions opencti-platform/opencti-front/src/private/components/Error.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,35 @@ import { includes, map } from 'ramda';
import * as PropTypes from 'prop-types';
import Alert from '@mui/material/Alert';
import AlertTitle from '@mui/material/AlertTitle';
import { IconButton, Tooltip } from '@mui/material';
import { ContentCopyOutlined } from '@mui/icons-material';
import ErrorNotFound from '../../components/ErrorNotFound';
import { useFormatter } from '../../components/i18n';
import { copyToClipboard } from '../../utils/utils';

// Really simple error display
export const SimpleError = () => (
<Alert severity="error">
<AlertTitle>Error</AlertTitle>
An unknown error occurred. Please contact your administrator or the OpenCTI
maintainers.
</Alert>
);
export const SimpleError = ({ errorData }) => {
const { t_i18n } = useFormatter();
const errorDetails = JSON.stringify(errorData, null, 2);
const copyClick = () => {
copyToClipboard(t_i18n, errorDetails);
};
return (
<>
<Alert severity="error">
<AlertTitle style={{ marginBottom: 0 }}>{t_i18n('Error')}</AlertTitle>
<span style={{ marginRight: 10 }}>
{t_i18n('An unknown error occurred. Please contact your administrator or the OpenCTI maintainers.')}
</span>
<Tooltip title={t_i18n('Copy stack trace errors')}>
<IconButton onClick={copyClick} size="small" color="error">
<ContentCopyOutlined />
</IconButton>
</Tooltip>
</Alert>
</>
);
};

export const DedicatedWarning = ({ title, description }) => (
<Alert severity="warning">
Expand Down Expand Up @@ -43,7 +62,8 @@ class ErrorBoundaryComponent extends React.Component {
// eslint-disable-next-line @typescript-eslint/no-throw-literal
throw this.state.error;
}
return this.props.display ?? <SimpleError/>;
const DisplayComponent = this.props.display || SimpleError;
return <DisplayComponent errorData={retroErrors} />;
}
return this.props.children;
}
Expand All @@ -57,7 +77,7 @@ export const ErrorBoundary = ErrorBoundaryComponent;
export const boundaryWrapper = (Component) => {
// eslint-disable-next-line react/display-name
return (routeProps) => (
<ErrorBoundary display={<SimpleError />}>
<ErrorBoundary>
<Component {...routeProps} />
</ErrorBoundary>
);
Expand Down

0 comments on commit 427696e

Please sign in to comment.