mirror of
https://github.com/grafana/grafana.git
synced 2025-09-23 00:33:22 +08:00

* Switch to GraphNG for Logs Histogram * Remove redundant timeZone It was used just to format timestamp in the tooltip but it's not needed anymore. * Add tests for creating logs histogram data * Update decoractors tests * Adjust bar width to be more like in the old graph * Fix tooltip pointer color * Test tooltip pointer color * Decouple graph config from uPlot internals * Ensure nested properties are not mutated when overrides are applied * Add legend toggling for Explore graphs * Remove unused component ExploreGraphNGPanel is now used in Explore * Code formatting * allow multiple bars pathBuilders to be globally cached with different settings Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import React from 'react';
|
|
import { LogRows, CustomScrollbar } from '@grafana/ui';
|
|
import { PanelProps, Field } from '@grafana/data';
|
|
import { Options } from './types';
|
|
import { dataFrameToLogsModel, dedupLogRows } from 'app/core/logs_model';
|
|
import { getFieldLinksForExplore } from 'app/features/explore/utils/links';
|
|
|
|
interface LogsPanelProps extends PanelProps<Options> {}
|
|
|
|
export const LogsPanel: React.FunctionComponent<LogsPanelProps> = ({
|
|
data,
|
|
timeZone,
|
|
options: { showLabels, showTime, wrapLogMessage, sortOrder, dedupStrategy, enableLogDetails },
|
|
}) => {
|
|
if (!data) {
|
|
return (
|
|
<div className="panel-empty">
|
|
<p>No data found in response</p>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const newResults = data ? dataFrameToLogsModel(data.series, data.request?.intervalMs) : null;
|
|
const logRows = newResults?.rows || [];
|
|
const deduplicatedRows = dedupLogRows(logRows, dedupStrategy);
|
|
|
|
const getFieldLinks = (field: Field, rowIndex: number) => {
|
|
return getFieldLinksForExplore({ field, rowIndex, range: data.timeRange });
|
|
};
|
|
|
|
return (
|
|
<CustomScrollbar autoHide>
|
|
<LogRows
|
|
logRows={logRows}
|
|
deduplicatedRows={deduplicatedRows}
|
|
dedupStrategy={dedupStrategy}
|
|
highlighterExpressions={[]}
|
|
showLabels={showLabels}
|
|
showTime={showTime}
|
|
wrapLogMessage={wrapLogMessage}
|
|
timeZone={timeZone}
|
|
getFieldLinks={getFieldLinks}
|
|
logsSortOrder={sortOrder}
|
|
enableLogDetails={enableLogDetails}
|
|
/>
|
|
</CustomScrollbar>
|
|
);
|
|
};
|