mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* WIP: intial commit * Switch: Adds tooltip * Refactor: Adds props to LogsPanelEditor * Refactor: Moves LogRowContextProvider to grafana/ui * Refactor: Moves LogRowContext and Alert to grafana/ui * Refactor: Moves LogLabelStats to grafana/ui * Refactor: Moves LogLabels and LogLabel to grafana/ui * Refactor: Moves LogMessageAnsi and ansicolor to grafana/ui * Refactor: Moves calculateFieldStats, LogsParsers and getParser to grafana/data * Refactor: Moves findHighlightChunksInText to grafana/data * Refactor: Moves LogRow to grafana/ui * Refactor: Moving ExploreGraphPanel to grafana/ui * Refactor: Copies Logs to grafana/ui * Refactor: Moves ToggleButtonGroup to grafana/ui * Refactor: Adds Logs to LogsPanel * Refactor: Moves styles to emotion * Feature: Adds LogsRows * Refactor: Introduces render limit * Styles: Moves styles to emotion * Styles: Moves styles to emotion * Styles: Moves styles to emotion * Styles: Moves styles to emotion * Refactor: Adds sorting to LogsPanelEditor * Tests: Adds tests for sorting * Refactor: Changes according to PR comments * Refactor: Changes according to PR comments * Refactor: Moves Logs and ExploreGraphPanel out of grafana/ui * Fix: Shows the Show context label again
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import { PanelProps, LogRows, CustomScrollbar } from '@grafana/ui';
|
|
import { Options } from './types';
|
|
import { LogsDedupStrategy } from '@grafana/data';
|
|
import { dataFrameToLogsModel } from 'app/core/logs_model';
|
|
import { sortLogsResult } from 'app/core/utils/explore';
|
|
|
|
interface LogsPanelProps extends PanelProps<Options> {}
|
|
|
|
export const LogsPanel: React.FunctionComponent<LogsPanelProps> = ({
|
|
data,
|
|
timeZone,
|
|
options: { showTime, sortOrder },
|
|
width,
|
|
}) => {
|
|
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 sortedNewResults = sortLogsResult(newResults, sortOrder);
|
|
|
|
return (
|
|
<CustomScrollbar autoHide>
|
|
<LogRows
|
|
data={sortedNewResults}
|
|
dedupStrategy={LogsDedupStrategy.none}
|
|
highlighterExpressions={[]}
|
|
showTime={showTime}
|
|
showLabels={false}
|
|
timeZone={timeZone}
|
|
/>
|
|
</CustomScrollbar>
|
|
);
|
|
};
|