mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 00:35:56 +08:00
fix(FE/logs): enable horizontal scroll in logs context
This commit is contained in:
parent
26b95f1b9f
commit
a393ea4d68
@ -37,12 +37,19 @@ const convert = new Convert();
|
||||
interface RawLogViewProps {
|
||||
isActiveLog?: boolean;
|
||||
isReadOnly?: boolean;
|
||||
isTextOverflowEllipsisDisabled?: boolean;
|
||||
data: ILog;
|
||||
linesPerRow: number;
|
||||
}
|
||||
|
||||
function RawLogView(props: RawLogViewProps): JSX.Element {
|
||||
const { isActiveLog = false, isReadOnly = false, data, linesPerRow } = props;
|
||||
const {
|
||||
isActiveLog = false,
|
||||
isReadOnly = false,
|
||||
data,
|
||||
linesPerRow,
|
||||
isTextOverflowEllipsisDisabled = false,
|
||||
} = props;
|
||||
|
||||
const { isHighlighted, isLogsExplorerPage, onLogCopy } = useCopyLogLink(
|
||||
data.id,
|
||||
@ -143,6 +150,7 @@ function RawLogView(props: RawLogViewProps): JSX.Element {
|
||||
<RawLogContent
|
||||
$isReadOnly={isReadOnly}
|
||||
$isActiveLog={isActiveLog}
|
||||
$isTextOverflowEllipsisDisabled={isTextOverflowEllipsisDisabled}
|
||||
linesPerRow={linesPerRow}
|
||||
dangerouslySetInnerHTML={html}
|
||||
/>
|
||||
@ -181,6 +189,7 @@ function RawLogView(props: RawLogViewProps): JSX.Element {
|
||||
RawLogView.defaultProps = {
|
||||
isActiveLog: false,
|
||||
isReadOnly: false,
|
||||
isTextOverflowEllipsisDisabled: false,
|
||||
};
|
||||
|
||||
export default RawLogView;
|
||||
|
@ -35,6 +35,7 @@ interface RawLogContentProps {
|
||||
linesPerRow: number;
|
||||
$isReadOnly: boolean;
|
||||
$isActiveLog: boolean;
|
||||
$isTextOverflowEllipsisDisabled: boolean;
|
||||
}
|
||||
|
||||
export const RawLogContent = styled.div<RawLogContentProps>`
|
||||
@ -42,12 +43,15 @@ export const RawLogContent = styled.div<RawLogContentProps>`
|
||||
font-family: Fira Code, monospace;
|
||||
font-weight: 300;
|
||||
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: ${(props): number => props.linesPerRow};
|
||||
line-clamp: ${(props): number => props.linesPerRow};
|
||||
-webkit-box-orient: vertical;
|
||||
${(props): string =>
|
||||
props.$isTextOverflowEllipsisDisabled
|
||||
? 'white-space: nowrap'
|
||||
: `overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: ${props.linesPerRow};
|
||||
line-clamp: ${props.linesPerRow};
|
||||
-webkit-box-orient: vertical;`};
|
||||
|
||||
font-size: 1rem;
|
||||
line-height: 2rem;
|
||||
|
@ -154,7 +154,13 @@ function LogsContextList({
|
||||
|
||||
const getItemContent = useCallback(
|
||||
(_: number, log: ILog): JSX.Element => (
|
||||
<RawLogView isReadOnly key={log.id} data={log} linesPerRow={1} />
|
||||
<RawLogView
|
||||
isReadOnly
|
||||
isTextOverflowEllipsisDisabled
|
||||
key={log.id}
|
||||
data={log}
|
||||
linesPerRow={1}
|
||||
/>
|
||||
),
|
||||
[],
|
||||
);
|
||||
|
@ -9,7 +9,7 @@ import { useIsDarkMode } from 'hooks/useDarkMode';
|
||||
import { memo, useCallback, useMemo, useState } from 'react';
|
||||
import { Query, TagFilter } from 'types/api/queryBuilder/queryBuilderData';
|
||||
|
||||
import { EditButton, TitleWrapper } from './styles';
|
||||
import { EditButton, LogContainer, TitleWrapper } from './styles';
|
||||
import { LogsExplorerContextProps } from './types';
|
||||
import useInitialQuery from './useInitialQuery';
|
||||
|
||||
@ -96,7 +96,15 @@ function LogsExplorerContext({
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
{...contextListParams}
|
||||
/>
|
||||
<RawLogView isActiveLog isReadOnly data={log} linesPerRow={1} />
|
||||
<LogContainer>
|
||||
<RawLogView
|
||||
isActiveLog
|
||||
isReadOnly
|
||||
isTextOverflowEllipsisDisabled
|
||||
data={log}
|
||||
linesPerRow={1}
|
||||
/>
|
||||
</LogContainer>
|
||||
<LogsContextList
|
||||
order={FILTERS.DESC}
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
|
@ -28,3 +28,7 @@ export const EditButton = styled(Button)<{ $isDarkMode: boolean }>`
|
||||
? getAlphaColor(themeColors.white)[45]
|
||||
: getAlphaColor(themeColors.black)[45]};
|
||||
`;
|
||||
|
||||
export const LogContainer = styled.div`
|
||||
overflow-x: auto;
|
||||
`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user