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