mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
- tried split selector and search for a week, and it did not feel natural - keeping some of the original modifications in QueryField from splitting PR - adapted CheatSheet and placeholder text - added new label selector state: No labels found
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
|
|
const CHEAT_SHEET_ITEMS = [
|
|
{
|
|
title: 'See your logs',
|
|
label: 'Start by selecting a log stream from the Log labels selector.',
|
|
},
|
|
{
|
|
title: 'Logs from a "job"',
|
|
expression: '{job="default/prometheus"}',
|
|
label: 'Returns all log lines emitted by instances of this job.',
|
|
},
|
|
{
|
|
title: 'Combine stream selectors',
|
|
expression: '{app="cassandra",namespace="prod"}',
|
|
label: 'Returns all log lines from streams that have both labels.',
|
|
},
|
|
{
|
|
title: 'Search for text',
|
|
expression: '{app="cassandra"} (duration|latency)\\s*(=|is|of)\\s*[\\d\\.]+',
|
|
label: 'Add a regular expression after the selector to filter for.',
|
|
},
|
|
];
|
|
|
|
export default (props: any) => (
|
|
<div>
|
|
<h2>Loki Cheat Sheet</h2>
|
|
{CHEAT_SHEET_ITEMS.map(item => (
|
|
<div className="cheat-sheet-item" key={item.expression}>
|
|
<div className="cheat-sheet-item__title">{item.title}</div>
|
|
{item.expression && (
|
|
<div
|
|
className="cheat-sheet-item__expression"
|
|
onClick={e => props.onClickExample({ refId: '1', expr: item.expression })}
|
|
>
|
|
<code>{item.expression}</code>
|
|
</div>
|
|
)}
|
|
<div className="cheat-sheet-item__label">{item.label}</div>
|
|
</div>
|
|
))}
|
|
</div>
|
|
);
|