// Libraries import { css } from '@emotion/css'; import React, { memo } from 'react'; // Types import { AbsoluteTimeRange, QueryEditorProps } from '@grafana/data'; import { InlineFormLabel } from '@grafana/ui'; import { CloudWatchDatasource } from '../datasource'; import { CloudWatchJsonData, CloudWatchLogsQuery, CloudWatchQuery } from '../types'; import CloudWatchLink from './CloudWatchLink'; import { CloudWatchLogsQueryField } from './LogsQueryField'; type Props = QueryEditorProps & { allowCustomValue?: boolean; }; const labelClass = css` margin-left: 3px; flex-grow: 0; `; export const CloudWatchLogsQueryEditor = memo(function CloudWatchLogsQueryEditor(props: Props) { const { query, data, datasource, onRunQuery, onChange, exploreId, allowCustomValue = false } = props; let absolute: AbsoluteTimeRange; if (data?.request?.range?.from) { const { range } = data.request; absolute = { from: range.from.valueOf(), to: range.to.valueOf(), }; } else { absolute = { from: Date.now() - 10000, to: Date.now(), }; } return ( } /> ); }); export default CloudWatchLogsQueryEditor;