mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* Add input to specify min step * Add stepInterval to as input to component * Add onBlur to Input component * Loki: add functionality for min step * Loki: change name on props to step to make it more clear * Loki: add resolution as a query option * Loki: Add min,max,exact as step options * Loki: add functionality for different step modes * Loki: fix bug where step function isn't working * Loki: fix bug where exact step isn't working * Loki: change width of step input field * Loki: add tests for adjustInterval function * Loki: add check for max step oprio to make sure it's not below the safe interval * Loki: fix bug with some tests * Loki: fix bug with tests * Explore: add tooltip to loki step function * Loki: remove resolution as a logs option * Loki: update snapshots * Fix failing tests * Loki: add select component for choosing resolution * Loki: add functionality for calculating correct interval with resolution applied * Loki: remove functionality for step mode * Loki: remove tests for step mode * Loki: add tooltip to line limit and resolution * Loki: add backend support for resolution * Loki: fixed backend bug where resolution was undefined * Loki: add check for resolution
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
// Libraries
|
|
import React, { memo } from 'react';
|
|
// Types
|
|
import { LokiQuery } from '../types';
|
|
import { LokiQueryField } from './LokiQueryField';
|
|
import { LokiOptionFields } from './LokiOptionFields';
|
|
import LokiDatasource from '../datasource';
|
|
|
|
interface Props {
|
|
expr: string;
|
|
maxLines?: number;
|
|
instant?: boolean;
|
|
datasource: LokiDatasource;
|
|
onChange: (query: LokiQuery) => void;
|
|
}
|
|
|
|
export const LokiAnnotationsQueryEditor = memo(function LokiAnnotationQueryEditor(props: Props) {
|
|
const { expr, maxLines, instant, datasource, onChange } = props;
|
|
|
|
const queryWithRefId: LokiQuery = {
|
|
refId: '',
|
|
expr,
|
|
maxLines,
|
|
instant,
|
|
};
|
|
return (
|
|
<div className="gf-form-group">
|
|
<LokiQueryField
|
|
datasource={datasource}
|
|
query={queryWithRefId}
|
|
onChange={onChange}
|
|
onRunQuery={() => {}}
|
|
onBlur={() => {}}
|
|
history={[]}
|
|
ExtraFieldElement={
|
|
<LokiOptionFields
|
|
queryType={queryWithRefId.instant ? 'instant' : 'range'}
|
|
lineLimitValue={queryWithRefId?.maxLines?.toString() || ''}
|
|
resolution={queryWithRefId.resolution || 1}
|
|
query={queryWithRefId}
|
|
onRunQuery={() => {}}
|
|
onChange={onChange}
|
|
/>
|
|
}
|
|
/>
|
|
</div>
|
|
);
|
|
});
|