mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-24 23:14:34 +08:00
feat: restrict timestamp from adding it to query (#1517)
Co-authored-by: Palash Gupta <palashgdev@gmail.com>
This commit is contained in:
parent
b23d63cb2b
commit
166e5612eb
@ -2,6 +2,7 @@ import { blue, grey, orange } from '@ant-design/colors';
|
||||
import { CopyFilled, CopyrightCircleFilled, ExpandAltOutlined } from '@ant-design/icons';
|
||||
import { Button, Card, Divider, Row, Typography } from 'antd';
|
||||
import { map } from 'd3';
|
||||
import dayjs from 'dayjs';
|
||||
import { FlatLogData } from 'lib/logs/flatLogData';
|
||||
import { flatMap, flatMapDeep } from 'lodash-es';
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
@ -95,7 +96,7 @@ function LogItem({ logData }) {
|
||||
)}
|
||||
<LogGeneralField
|
||||
fieldKey="timestamp"
|
||||
fieldValue={flattenLogData.timestamp}
|
||||
fieldValue={dayjs(flattenLogData.timestamp / 1e6).format()}
|
||||
/>
|
||||
</div>
|
||||
{'}'}
|
||||
|
@ -14,6 +14,9 @@ import React, { useMemo, useState } from 'react';
|
||||
|
||||
import ActionItem from './ActionItem';
|
||||
|
||||
// Fields which should be restricted from adding it to query
|
||||
const RESTRICTED_FIELDS = ['timestamp'];
|
||||
|
||||
function TableView({ logData }) {
|
||||
const [fieldSearchInput, setFieldSearchInput] = useState<string>('');
|
||||
|
||||
@ -38,27 +41,33 @@ function TableView({ logData }) {
|
||||
{
|
||||
title: 'Action',
|
||||
width: 75,
|
||||
render: (fieldData) => (
|
||||
<ActionItem
|
||||
fieldKey={fieldData.field.split('.').slice(-1)}
|
||||
fieldValue={fieldData.value}
|
||||
/>
|
||||
),
|
||||
render: (fieldData) => {
|
||||
const fieldKey = fieldData.field.split('.').slice(-1);
|
||||
if (!RESTRICTED_FIELDS.includes(fieldKey[0])) {
|
||||
return <ActionItem fieldKey={fieldKey} fieldValue={fieldData.value} />;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Field',
|
||||
dataIndex: 'field',
|
||||
key: 'field',
|
||||
width: '35%',
|
||||
render: (field: string) => (
|
||||
<AddToQueryHOC
|
||||
fieldKey={field.split('.').slice(-1)}
|
||||
fieldValue={flattenLogData[field]}
|
||||
>
|
||||
{' '}
|
||||
<span style={{ color: blue[4] }}>{field}</span>
|
||||
</AddToQueryHOC>
|
||||
),
|
||||
render: (field: string) => {
|
||||
const fieldKey = field.split('.').slice(-1);
|
||||
const renderedField = <span style={{ color: blue[4] }}>{field}</span>;
|
||||
|
||||
if (!RESTRICTED_FIELDS.includes(fieldKey[0])) {
|
||||
return (
|
||||
<AddToQueryHOC fieldKey={fieldKey} fieldValue={flattenLogData[field]}>
|
||||
{' '}
|
||||
{renderedField}
|
||||
</AddToQueryHOC>
|
||||
);
|
||||
}
|
||||
return renderedField;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Value',
|
||||
@ -83,7 +92,7 @@ function TableView({ logData }) {
|
||||
/>
|
||||
<Table
|
||||
// scroll={{ x: true }}
|
||||
tableLayout='fixed'
|
||||
tableLayout="fixed"
|
||||
dataSource={dataSource}
|
||||
columns={columns}
|
||||
pagination={false}
|
||||
|
@ -110,7 +110,7 @@ function LogLiveTail() {
|
||||
const timeStamp = dayjs().subtract(liveTailStartRange, 'minute').valueOf();
|
||||
const queryParams = new URLSearchParams({
|
||||
...(queryString ? { q: queryString } : {}),
|
||||
timestampStart: timeStamp,
|
||||
timestampStart: timeStamp * 1e6,
|
||||
...(liveTailSourceRef.current && logs.length > 0
|
||||
? {
|
||||
idGt: logs[0].id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user