diff --git a/src/components/QueryEditor.tsx b/src/components/QueryEditor.tsx index 8112d19e..70cc5eea 100644 --- a/src/components/QueryEditor.tsx +++ b/src/components/QueryEditor.tsx @@ -1,4 +1,4 @@ -import { ResourceSelector } from '@grafana/aws-sdk'; +import { ResourceSelector, QueryEditorHeader } from '@grafana/aws-sdk'; import { QueryEditorProps, SelectableValue } from '@grafana/data'; import { Select, Switch, useStyles2 } from '@grafana/ui'; import React, { useEffect, useState } from 'react'; @@ -106,112 +106,120 @@ export function QueryEditor(props: Props) { }, [database, table]); return ( - - - - - - - - - - - + {props?.app !== 'explore' && ( + + {...props} + enableRunButton={!!props.query.rawQuery} + /> + )} + + + + + + + + + + + + + + + + + + + + + + + { + 'Timeseries queries must have times in ascending order, which can be done by adding "ORDER BY - - - - - - + +
+ - - - - - { - 'Timeseries queries must have times in ascending order, which can be done by adding "ORDER BY - - -
- -
-
- +
+
+
+ ); } const getStyles = () => ({ diff --git a/src/components/SQLEditor.tsx b/src/components/SQLEditor.tsx index 5565596f..a625be9f 100644 --- a/src/components/SQLEditor.tsx +++ b/src/components/SQLEditor.tsx @@ -13,7 +13,7 @@ interface RawEditorProps { datasource: DataSource; } -export default function SQLEditor({ query, datasource, onRunQuery, onChange }: RawEditorProps) { +export default function SQLEditor({ query, datasource, onChange }: RawEditorProps) { const queryRef = useRef(query); useEffect(() => { queryRef.current = query; @@ -70,7 +70,6 @@ export default function SQLEditor({ query, datasource, onRunQuery, onChange }: R return ( onRunQuery()} onChange={onChangeRawQuery} language={{ ...timestreamLanguageDefinition, diff --git a/tests/alertRule.spec.ts b/tests/alertRule.spec.ts index 2c9a0758..93deb2aa 100644 --- a/tests/alertRule.spec.ts +++ b/tests/alertRule.spec.ts @@ -21,6 +21,4 @@ test('should successfully create an alert rule', async ({ `select region, avg(measure_value::double) from $__database.$__table where time between from_milliseconds(1615395600000) and from_milliseconds(1615395900000) and measure_value::double > 1 group by region limit 10` ); await expect(alertRuleEditPage.evaluate()).toBeOK(); - // TODO: remove page.unrouteAll if onBlur handler is removed from SQLEditor - await page.unrouteAll({ behavior: 'ignoreErrors' }); });