LokiQueryEditor.tsx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // Libraries
  2. import React, { PureComponent } from 'react';
  3. // Types
  4. import { QueryEditorProps } from '@grafana/ui';
  5. import { LokiDatasource } from '../datasource';
  6. import { LokiQuery } from '../types';
  7. // import { LokiQueryField } from './LokiQueryField';
  8. type Props = QueryEditorProps<LokiDatasource, LokiQuery>;
  9. // interface State {
  10. // query: LokiQuery;
  11. // }
  12. export class LokiQueryEditor extends PureComponent<Props> {
  13. // state: State = {
  14. // query: this.props.query,
  15. // };
  16. //
  17. // onRunQuery = () => {
  18. // const { query } = this.state;
  19. //
  20. // this.props.onChange(query);
  21. // this.props.onRunQuery();
  22. // };
  23. //
  24. // onFieldChange = (query: LokiQuery, override?) => {
  25. // this.setState({
  26. // query: {
  27. // ...this.state.query,
  28. // expr: query.expr,
  29. // },
  30. // });
  31. // };
  32. //
  33. // onFormatChanged = (option: SelectableValue) => {
  34. // this.props.onChange({
  35. // ...this.state.query,
  36. // resultFormat: option.value,
  37. // });
  38. // };
  39. render() {
  40. // const { query } = this.state;
  41. // const { datasource } = this.props;
  42. // const formatOptions: SelectableValue[] = [
  43. // { label: 'Time Series', value: 'time_series' },
  44. // { label: 'Table', value: 'table' },
  45. // ];
  46. //
  47. // query.resultFormat = query.resultFormat || 'time_series';
  48. // const currentFormat = formatOptions.find(item => item.value === query.resultFormat);
  49. return (
  50. <div>
  51. <div className="gf-form">
  52. <div className="gf-form-label">
  53. Loki is currently not supported as dashboard data source. We are working on it!
  54. </div>
  55. </div>
  56. {/*
  57. <LokiQueryField
  58. datasource={datasource}
  59. query={query}
  60. onQueryChange={this.onFieldChange}
  61. onExecuteQuery={this.onRunQuery}
  62. history={[]}
  63. />
  64. <div className="gf-form-inline">
  65. <div className="gf-form">
  66. <div className="gf-form-label">Format as</div>
  67. <Select
  68. isSearchable={false}
  69. options={formatOptions}
  70. onChange={this.onFormatChanged}
  71. value={currentFormat}
  72. />
  73. </div>
  74. <div className="gf-form gf-form--grow">
  75. <div className="gf-form-label gf-form-label--grow" />
  76. </div>
  77. </div>
  78. */}
  79. </div>
  80. );
  81. }
  82. }
  83. export default LokiQueryEditor;