mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 01:09:02 +08:00
feat: logs explorer context log line redirection (#7142)
* feat: display select columns from user preferences for context log line * feat: add support for redirecting context log line to logs explorer * feat: open context log line in new tab * feat: pass all the filters on opening context log line in a new tab * chore: make log context line cursor pointer
This commit is contained in:
parent
8a01312967
commit
2f3cee814e
@ -22,4 +22,10 @@
|
|||||||
width: fit-content;
|
width: fit-content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&__item {
|
||||||
|
width: 100%;
|
||||||
|
.raw-log-content {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,9 +1,10 @@
|
|||||||
import './ContextLogRenderer.styles.scss';
|
import './ContextLogRenderer.styles.scss';
|
||||||
|
|
||||||
import { Skeleton } from 'antd';
|
import { Button, Skeleton } from 'antd';
|
||||||
import RawLogView from 'components/Logs/RawLogView';
|
import RawLogView from 'components/Logs/RawLogView';
|
||||||
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
||||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||||
|
import { QueryParams } from 'constants/query';
|
||||||
import ShowButton from 'container/LogsContextList/ShowButton';
|
import ShowButton from 'container/LogsContextList/ShowButton';
|
||||||
import { convertKeysToColumnFields } from 'container/LogsExplorerList/utils';
|
import { convertKeysToColumnFields } from 'container/LogsExplorerList/utils';
|
||||||
import { useOptionsMenu } from 'container/OptionsMenu';
|
import { useOptionsMenu } from 'container/OptionsMenu';
|
||||||
@ -11,7 +12,9 @@ import { defaultLogsSelectedColumns } from 'container/OptionsMenu/constants';
|
|||||||
import { FontSize } from 'container/OptionsMenu/types';
|
import { FontSize } from 'container/OptionsMenu/types';
|
||||||
import { ORDERBY_FILTERS } from 'container/QueryBuilder/filters/OrderByFilter/config';
|
import { ORDERBY_FILTERS } from 'container/QueryBuilder/filters/OrderByFilter/config';
|
||||||
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
||||||
|
import useUrlQuery from 'hooks/useUrlQuery';
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
import { Virtuoso } from 'react-virtuoso';
|
import { Virtuoso } from 'react-virtuoso';
|
||||||
import { ILog } from 'types/api/logs/log';
|
import { ILog } from 'types/api/logs/log';
|
||||||
import { Query, TagFilter } from 'types/api/queryBuilder/queryBuilderData';
|
import { Query, TagFilter } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
@ -101,8 +104,36 @@ function ContextLogRenderer({
|
|||||||
}
|
}
|
||||||
}, [options.fontSize]);
|
}, [options.fontSize]);
|
||||||
|
|
||||||
|
const urlQuery = useUrlQuery();
|
||||||
|
|
||||||
|
const { pathname } = useLocation();
|
||||||
|
|
||||||
|
const handleLogClick = useCallback(
|
||||||
|
(logId: string): void => {
|
||||||
|
urlQuery.set(QueryParams.activeLogId, `"${logId}"`);
|
||||||
|
|
||||||
|
urlQuery.set(
|
||||||
|
QueryParams.compositeQuery,
|
||||||
|
encodeURIComponent(JSON.stringify(query)),
|
||||||
|
);
|
||||||
|
|
||||||
|
const link = `${pathname}?${urlQuery.toString()}`;
|
||||||
|
|
||||||
|
window.open(link, '_blank', 'noopener,noreferrer');
|
||||||
|
},
|
||||||
|
[pathname, query, urlQuery],
|
||||||
|
);
|
||||||
|
|
||||||
const getItemContent = useCallback(
|
const getItemContent = useCallback(
|
||||||
(_: number, logTorender: ILog): JSX.Element => (
|
(_: number, logTorender: ILog): JSX.Element => (
|
||||||
|
<Button
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
className="context-log-renderer__item"
|
||||||
|
onClick={(): void => {
|
||||||
|
handleLogClick(logTorender.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
<RawLogView
|
<RawLogView
|
||||||
isActiveLog={logTorender.id === log.id}
|
isActiveLog={logTorender.id === log.id}
|
||||||
isReadOnly
|
isReadOnly
|
||||||
@ -111,10 +142,13 @@ function ContextLogRenderer({
|
|||||||
data={logTorender}
|
data={logTorender}
|
||||||
linesPerRow={1}
|
linesPerRow={1}
|
||||||
fontSize={options.fontSize}
|
fontSize={options.fontSize}
|
||||||
selectedFields={convertKeysToColumnFields(defaultLogsSelectedColumns)}
|
selectedFields={convertKeysToColumnFields(
|
||||||
|
options.selectColumns ?? defaultLogsSelectedColumns,
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
|
</Button>
|
||||||
),
|
),
|
||||||
[log.id, options.fontSize],
|
[handleLogClick, log.id, options.fontSize, options.selectColumns],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user