Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ANY option for interpolated property quality #342

Merged
merged 3 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -43,6 +43,8 @@ const qualities: Array<SelectableValue<SiteWiseQuality>> = [
{ value: SiteWiseQuality.UNCERTAIN, label: 'UNCERTAIN' },
];

const interpolatedPropertyQualities: Array<SelectableValue<SiteWiseQuality>> = qualities.slice(1);

const ordering: Array<SelectableValue<SiteWiseTimeOrder>> = [
{ value: SiteWiseTimeOrder.ASCENDING, label: 'ASCENDING' },
{ value: SiteWiseTimeOrder.DESCENDING, label: 'DESCENDING' },
Expand Down Expand Up @@ -104,14 +106,16 @@ export class QualityAndOrderRow extends PureComponent<Props> {

render() {
const { query } = this.props;
const currQualities =
query.queryType === QueryType.PropertyInterpolated ? interpolatedPropertyQualities : qualities;
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={currQualities}
value={currQualities.find((v) => v.value === query.quality) ?? currQualities[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();

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

Expand Down
Loading