diff --git a/src/components/query/QueryEditor.test.tsx b/src/components/query/QueryEditor.test.tsx index de27022f..ccdcc398 100644 --- a/src/components/query/QueryEditor.test.tsx +++ b/src/components/query/QueryEditor.test.tsx @@ -159,11 +159,8 @@ describe('QueryEditor', () => { expect(screen.getByText('Property Alias')).toBeInTheDocument(); expect(screen.getByText('Asset')).toBeInTheDocument(); expect(screen.getByText('Property')).toBeInTheDocument(); - expect(screen.getByText('Quality')).toBeInTheDocument(); expect(screen.getByText('Format L4E Anomaly Result')).toBeInTheDocument(); expect(screen.getByText('Client cache')).toBeInTheDocument(); - expect(screen.getByText('Time')).toBeInTheDocument(); - expect(screen.getByText('Format')).toBeInTheDocument(); }); }); @@ -174,10 +171,6 @@ describe('QueryEditor', () => { }); await waitFor(() => { expect(screen.getByText('Property Alias')).toBeInTheDocument(); - // temporary condition - in the old form version, the following fields are not displayed, but they should be in the new one - expect(screen.getByText('Quality')).toBeInTheDocument(); - expect(screen.getByText('Time')).toBeInTheDocument(); - expect(screen.getByText('Format')).toBeInTheDocument(); }); }); diff --git a/src/components/query/QueryOptions.tsx b/src/components/query/QueryOptions.tsx index 74290149..b560723e 100644 --- a/src/components/query/QueryOptions.tsx +++ b/src/components/query/QueryOptions.tsx @@ -1,4 +1,4 @@ -import { SitewiseQuery, shouldShowL4eOptions, shouldShowLastObserved } from 'types'; +import { SitewiseQuery, shouldShowL4eOptions, shouldShowLastObserved, shouldShowQualityAndOrderComponent } from 'types'; import { CollapsableSection, Switch, useTheme2 } from '@grafana/ui'; import React from 'react'; import { EditorField, EditorFieldGroup } from '@grafana/experimental'; @@ -55,7 +55,10 @@ export function QueryOptions({ )} - {(showProp || query.propertyAlias) && showQuality && qualityAndOrderComponent} + {shouldShowQualityAndOrderComponent(query.queryType) && + (showProp || query.propertyAlias) && + showQuality && + qualityAndOrderComponent} diff --git a/src/types.ts b/src/types.ts index eccbf6f5..4254894c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -13,7 +13,7 @@ export enum QueryType { PropertyValueHistory = 'PropertyValueHistory', PropertyAggregate = 'PropertyAggregate', PropertyInterpolated = 'PropertyInterpolated', - ListTimeSeries = "ListTimeSeries" + ListTimeSeries = 'ListTimeSeries', } export enum SiteWiseQuality { @@ -202,7 +202,7 @@ export interface ListTimeSeriesQuery extends SitewiseQuery { queryType: QueryType.ListTimeSeries; aliasPrefix?: string; assetId?: string; - timeSeriesType?: "ASSOCIATED" | "DISASSOCIATED" | "ALL"; + timeSeriesType?: 'ASSOCIATED' | 'DISASSOCIATED' | 'ALL'; } export function isListTimeSeriesQuery(q?: SitewiseQuery): q is ListTimeSeriesQuery { @@ -235,6 +235,10 @@ export function shouldShowL4eOptions(queryType?: QueryType): boolean { return queryType === QueryType.PropertyValue || queryType === QueryType.PropertyValueHistory; } +export function shouldShowQualityAndOrderComponent(queryType?: QueryType): boolean { + return queryType !== QueryType.PropertyValue; +} + // matches native sitewise API with capitals export interface AssetPropertyInfo extends SelectableValue { Id: string; diff --git a/tests/queryEditor.spec.ts b/tests/queryEditor.spec.ts index c34ed566..2250edf2 100644 --- a/tests/queryEditor.spec.ts +++ b/tests/queryEditor.spec.ts @@ -37,12 +37,6 @@ test.describe('Query Editor', () => { await queryEditor.selectProperty('Total Average Power'); - await queryEditor.openQueryOptions(); - - await expect(queryEditor.qualitySelect).toBeVisible(); - await expect(queryEditor.timeSelect).toBeVisible(); - await expect(queryEditor.formatSelect).toBeVisible(); - await queryEditor.runQuery(); await expect(page.getByText('No data')).not.toBeVisible();