The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/plugins/datasource/loki/components/LokiQueryEditor.tsx

90 lines
2.4 KiB

// Libraries
import React, { PureComponent } from 'react';
// Types
import { QueryEditorProps } from '@grafana/ui';
import { LokiDatasource } from '../datasource';
import { LokiQuery } from '../types';
// import { LokiQueryField } from './LokiQueryField';
type Props = QueryEditorProps<LokiDatasource, LokiQuery>;
// interface State {
// query: LokiQuery;
// }
export class LokiQueryEditor extends PureComponent<Props> {
// state: State = {
// query: this.props.query,
// };
//
// onRunQuery = () => {
// const { query } = this.state;
//
// this.props.onChange(query);
// this.props.onRunQuery();
// };
//
// onFieldChange = (query: LokiQuery, override?) => {
// this.setState({
// query: {
// ...this.state.query,
// expr: query.expr,
// },
// });
// };
//
// onFormatChanged = (option: SelectableValue) => {
// this.props.onChange({
// ...this.state.query,
// resultFormat: option.value,
// });
// };
render() {
// const { query } = this.state;
// const { datasource } = this.props;
// const formatOptions: SelectableValue[] = [
// { label: 'Time Series', value: 'time_series' },
// { label: 'Table', value: 'table' },
// ];
//
// query.resultFormat = query.resultFormat || 'time_series';
// const currentFormat = formatOptions.find(item => item.value === query.resultFormat);
return (
<div>
<div className="gf-form">
<div className="gf-form-label">
Loki is currently not supported as dashboard data source. We are working on it!
</div>
</div>
{/*
<LokiQueryField
datasource={datasource}
query={query}
onQueryChange={this.onFieldChange}
onExecuteQuery={this.onRunQuery}
history={[]}
/>
<div className="gf-form-inline">
<div className="gf-form">
<div className="gf-form-label">Format as</div>
<Select
isSearchable={false}
options={formatOptions}
onChange={this.onFormatChanged}
value={currentFormat}
/>
</div>
<div className="gf-form gf-form--grow">
<div className="gf-form-label gf-form-label--grow" />
</div>
</div>
*/}
</div>
);
}
}
export default LokiQueryEditor;