Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: text wrap in log details view, remove json/raw tag #5231

Merged
merged 1 commit into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions frontend/src/container/LogDetailedView/JsonView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { JSONViewProps } from './LogDetailedView.types';
import { aggregateAttributesResourcesToString } from './utils';

function JSONView({ logData }: JSONViewProps): JSX.Element {
const [isWrapWord, setIsWrapWord] = useState<boolean>(false);
const [isWrapWord, setIsWrapWord] = useState<boolean>(true);

const LogJsonData = useMemo(
() => aggregateAttributesResourcesToString(logData),
Expand All @@ -22,7 +22,7 @@ function JSONView({ logData }: JSONViewProps): JSX.Element {
const options: EditorProps['options'] = {
automaticLayout: true,
readOnly: true,
wordWrap: 'on',
wordWrap: isWrapWord ? 'on' : 'off',
minimap: {
enabled: false,
},
Expand Down Expand Up @@ -68,7 +68,7 @@ function JSONView({ logData }: JSONViewProps): JSX.Element {
return (
<div className="json-view-container">
<MEditor
value={isWrapWord ? JSON.stringify(LogJsonData) : LogJsonData}
value={LogJsonData}
language="json"
options={options}
onChange={(): void => {}}
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/container/LogDetailedView/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function Overview({
onClickActionItem,
isListViewPanel = false,
}: Props): JSX.Element {
const [isWrapWord, setIsWrapWord] = useState<boolean>(false);
const [isWrapWord, setIsWrapWord] = useState<boolean>(true);
const [isSearchVisible, setIsSearchVisible] = useState<boolean>(false);
const [isAttributesExpanded, setIsAttributesExpanded] = useState<boolean>(
true,
Expand All @@ -48,7 +48,7 @@ function Overview({
automaticLayout: true,
readOnly: true,
height: '40vh',
wordWrap: 'on',
wordWrap: isWrapWord ? 'on' : 'off',
minimap: {
enabled: false,
},
Expand Down Expand Up @@ -118,8 +118,8 @@ function Overview({
children: (
<div className="logs-body-content">
<MEditor
value={isWrapWord ? JSON.stringify(logData.body) : logData.body}
language={isWrapWord ? 'placetext' : 'json'}
value={logData.body}
language="json"
options={options}
onChange={(): void => {}}
height="20vh"
Expand All @@ -143,7 +143,7 @@ function Overview({
</div>
</div>
),
extra: <Tag className="tag">{isWrapWord ? 'Raw' : 'JSON'}</Tag>,
// extra: <Tag className="tag">JSON</Tag>,
className: 'collapse-content',
},
]}
Expand Down
Loading