From cc2f2976dd25c7e7aaf2f6811b7e4d8a5a2db85f Mon Sep 17 00:00:00 2001 From: Isabella Siu Date: Fri, 12 Jul 2024 17:08:11 -0400 Subject: [PATCH 1/3] Remove ANY option for interpolated property quality --- pkg/sitewise/api/property_interpolated.go | 2 +- src/components/query/QualityAndOrderRow.tsx | 8 ++++++-- src/components/query/QueryEditor.test.tsx | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pkg/sitewise/api/property_interpolated.go b/pkg/sitewise/api/property_interpolated.go index 84d8514e..d9d1caec 100644 --- a/pkg/sitewise/api/property_interpolated.go +++ b/pkg/sitewise/api/property_interpolated.go @@ -37,7 +37,7 @@ func interpolatedQueryToInputs(query models.AssetPropertyValueQuery) []*iotsitew endTimeInSeconds := to.Unix() quality := query.Quality - if quality == "" { + if quality == "" || query.Quality == "ANY" { quality = "GOOD" } diff --git a/src/components/query/QualityAndOrderRow.tsx b/src/components/query/QualityAndOrderRow.tsx index 4e3ee2f7..b397bcf0 100644 --- a/src/components/query/QualityAndOrderRow.tsx +++ b/src/components/query/QualityAndOrderRow.tsx @@ -104,14 +104,18 @@ export class QualityAndOrderRow extends PureComponent { render() { const { query } = this.props; + let currQualites = qualities; + if (query.queryType === QueryType.PropertyInterpolated) { + currQualites = qualities.slice(1); + } return ( <> v.value === query.quality) ?? currQualites[0]} + options={currQualities} + value={currQualities.find((v) => v.value === query.quality) ?? currQualities[0]} onChange={this.onQualityChange} isSearchable={true} menuPlacement="auto" diff --git a/src/components/query/QueryEditor.test.tsx b/src/components/query/QueryEditor.test.tsx index e14496d0..de27022f 100644 --- a/src/components/query/QueryEditor.test.tsx +++ b/src/components/query/QueryEditor.test.tsx @@ -112,7 +112,7 @@ describe('QueryEditor', () => { expect(screen.getByText('Resolution')).toBeInTheDocument(); expect(screen.getByText('Format')).toBeInTheDocument(); - // Interpolatged Property queries should not have ANY as the quality default + // Interpolated Property queries should not have ANY as the quality default expect(screen.getByText('GOOD')).toBeInTheDocument(); expect(screen.queryByText('ANY')).not.toBeInTheDocument(); }); From 02dd37cca7a157189325f703c7f59af4ebb302b5 Mon Sep 17 00:00:00 2001 From: Isabella Siu Date: Mon, 22 Jul 2024 11:11:21 -0400 Subject: [PATCH 3/3] kevin comments --- src/components/query/QualityAndOrderRow.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/query/QualityAndOrderRow.tsx b/src/components/query/QualityAndOrderRow.tsx index 3926bd63..5f33726c 100644 --- a/src/components/query/QualityAndOrderRow.tsx +++ b/src/components/query/QualityAndOrderRow.tsx @@ -43,6 +43,8 @@ const qualities: Array> = [ { value: SiteWiseQuality.UNCERTAIN, label: 'UNCERTAIN' }, ]; +const interpolatedPropertyQualities: Array> = qualities.slice(1); + const ordering: Array> = [ { value: SiteWiseTimeOrder.ASCENDING, label: 'ASCENDING' }, { value: SiteWiseTimeOrder.DESCENDING, label: 'DESCENDING' }, @@ -104,10 +106,8 @@ export class QualityAndOrderRow extends PureComponent { render() { const { query } = this.props; - let currQualities = qualities; - if (query.queryType === QueryType.PropertyInterpolated) { - currQualities = qualities.slice(1); - } + const currQualities = + query.queryType === QueryType.PropertyInterpolated ? interpolatedPropertyQualities : qualities; return ( <>