Skip to content

Commit

Permalink
Remove ANY option for interpolated property quality
Browse files Browse the repository at this point in the history
  • Loading branch information
iwysiu committed Jul 12, 2024
1 parent be97a5f commit cc2f297
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/sitewise/api/property_interpolated.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down
8 changes: 6 additions & 2 deletions src/components/query/QualityAndOrderRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,18 @@ export class QualityAndOrderRow extends PureComponent<Props> {

render() {
const { query } = this.props;
let currQualites = qualities;
if (query.queryType === QueryType.PropertyInterpolated) {
currQualites = qualities.slice(1);
}
return (
<>
<EditorField label="Quality" width={15} htmlFor="quality">
<Select
id="quality"
aria-label="Quality"
options={qualities}
value={qualities.find((v) => v.value === query.quality) ?? qualities[0]}
options={currQualites}
value={currQualites.find((v) => v.value === query.quality) ?? currQualites[0]}
onChange={this.onQualityChange}
isSearchable={true}
menuPlacement="auto"
Expand Down
4 changes: 4 additions & 0 deletions src/components/query/QueryEditor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ describe('QueryEditor', () => {
expect(screen.getByText('Quality')).toBeInTheDocument();
expect(screen.getByText('Resolution')).toBeInTheDocument();
expect(screen.getByText('Format')).toBeInTheDocument();

// Interpolatged Property queries should not have ANY as the quality default
expect(screen.getByText('GOOD')).toBeInTheDocument();
expect(screen.queryByText('ANY')).not.toBeInTheDocument();
});
});

Expand Down

0 comments on commit cc2f297

Please sign in to comment.