fix boolean segment filters (#14622)

This commit is contained in:
Vadim Ogievetsky 2023-07-19 20:45:23 -07:00 committed by GitHub
parent bac5ef347c
commit 01e9a39544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 8 deletions

View File

@ -94,19 +94,18 @@ export function GenericFilterInput({ column, filter, onChange, key }: FilterRend
}
export function BooleanFilterInput({ filter, onChange, key }: FilterRendererProps) {
const filterValue = filter ? filter.value : '';
return (
<HTMLSelect
className="boolean-filter-input"
key={key}
style={{ width: '100%' }}
onChange={(event: any) => onChange(event.target.value)}
value={filterValue || 'all'}
value={filter?.value || ''}
fill
>
<option value="all">Show all</option>
<option value="true">true</option>
<option value="false">false</option>
<option value="">Show all</option>
<option value="=true">true</option>
<option value="=false">false</option>
</HTMLSelect>
);
}

View File

@ -199,7 +199,7 @@ export class SegmentsView extends React.PureComponent<SegmentsViewProps, Segment
visibleColumns.shown('Datasource') && `"datasource"`,
`"start"`,
`"end"`,
visibleColumns.shown('Version') && `"version"`,
`"version"`,
visibleColumns.shown('Time span') &&
`CASE
WHEN "start" = '-146136543-09-08T08:23:32.096Z' AND "end" = '146140482-04-24T15:36:27.903Z' THEN 'All'
@ -298,8 +298,16 @@ END AS "time_span"`,
return SqlComparison.like(shardSpecColumn, `%"type":"${modeAndNeedle.needle}%`);
}
} else if (f.id.startsWith('is_')) {
if (f.value === 'all') return;
return C(f.id).equal(f.value === 'true' ? 1 : 0);
switch (f.value) {
case '=false':
return C(f.id).equal(0);
case '=true':
return C(f.id).equal(1);
default:
return;
}
} else {
return sqlQueryCustomTableFilter(f);
}