LokiQueryEditor.tsx 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // Libraries
  2. import React, { PureComponent } from 'react';
  3. // Components
  4. // import { Select, SelectOptionItem } from '@grafana/ui';
  5. // Types
  6. import { QueryEditorProps } from '@grafana/ui/src/types';
  7. import { LokiDatasource } from '../datasource';
  8. import { LokiQuery } from '../types';
  9. // import { LokiQueryField } from './LokiQueryField';
  10. type Props = QueryEditorProps<LokiDatasource, LokiQuery>;
  11. // interface State {
  12. // query: LokiQuery;
  13. // }
  14. export class LokiQueryEditor extends PureComponent<Props> {
  15. // state: State = {
  16. // query: this.props.query,
  17. // };
  18. //
  19. // onRunQuery = () => {
  20. // const { query } = this.state;
  21. //
  22. // this.props.onChange(query);
  23. // this.props.onRunQuery();
  24. // };
  25. //
  26. // onFieldChange = (query: LokiQuery, override?) => {
  27. // this.setState({
  28. // query: {
  29. // ...this.state.query,
  30. // expr: query.expr,
  31. // },
  32. // });
  33. // };
  34. //
  35. // onFormatChanged = (option: SelectOptionItem) => {
  36. // this.props.onChange({
  37. // ...this.state.query,
  38. // resultFormat: option.value,
  39. // });
  40. // };
  41. render() {
  42. // const { query } = this.state;
  43. // const { datasource } = this.props;
  44. // const formatOptions: SelectOptionItem[] = [
  45. // { label: 'Time Series', value: 'time_series' },
  46. // { label: 'Table', value: 'table' },
  47. // ];
  48. //
  49. // query.resultFormat = query.resultFormat || 'time_series';
  50. // const currentFormat = formatOptions.find(item => item.value === query.resultFormat);
  51. return (
  52. <div>
  53. <div className="gf-form">
  54. <div className="gf-form-label">Loki is currently not supported as dashboard data source. We are working on it!</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;