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

View File

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