feat: editor is updated in error details page

This commit is contained in:
Palash gupta 2022-04-27 22:21:57 +05:30
parent b335d440cf
commit 08e3428744
No known key found for this signature in database
GPG Key ID: 8FD05AE6F9150AD6
2 changed files with 7 additions and 5 deletions

View File

@ -5,13 +5,14 @@ function Editor({
value,
language = 'yaml',
onChange,
readOnly = false,
}: EditorProps): JSX.Element {
return (
<MEditor
theme="vs-dark"
language={language}
value={value}
options={{ fontSize: 16, automaticLayout: true }}
options={{ fontSize: 16, automaticLayout: true, readOnly }}
height="40vh"
onChange={(newValue): void => {
if (newValue) {
@ -26,10 +27,12 @@ interface EditorProps {
value: string;
language?: string;
onChange: (value: string) => void;
readOnly?: boolean;
}
Editor.defaultProps = {
language: undefined,
readOnly: false,
};
export default Editor;

View File

@ -2,7 +2,7 @@ import { Button, Divider, notification, Space, Table, Typography } from 'antd';
import Editor from 'components/Editor';
import dayjs from 'dayjs';
import history from 'lib/history';
import React, { useMemo, useRef, useState } from 'react';
import React, { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useLocation } from 'react-router-dom';
import { PayloadProps as GetByErrorTypeAndServicePayload } from 'types/api/errors/getByErrorTypeAndService';
@ -21,7 +21,7 @@ function ErrorDetails(props: ErrorDetailsProps): JSX.Element {
const errorDetail = idPayload;
const stackTraceValue = useRef(errorDetail.excepionStacktrace);
const [stackTraceValue] = useState(errorDetail.excepionStacktrace);
const columns = useMemo(
() => [
@ -126,7 +126,6 @@ function ErrorDetails(props: ErrorDetailsProps): JSX.Element {
>
{t('newer')}
</Button>
{/* <Button icon={<RightOutlined />} /> */}
</Space>
</div>
</EventContainer>
@ -139,7 +138,7 @@ function ErrorDetails(props: ErrorDetailsProps): JSX.Element {
</DashedContainer>
<Typography.Title level={4}>{t('stack_trace')}</Typography.Title>
<Editor value={stackTraceValue} readOnly />
<Editor onChange={(): void => {}} value={stackTraceValue} readOnly />
<EditorContainer>
<Space direction="vertical">