Skip to content

Commit

Permalink
[SLOs] only display group by cardinality when group by exists (elasti…
Browse files Browse the repository at this point in the history
…c#178133)

## Summary

Resolves elastic#178129

<img width="882" alt="Screenshot 2024-03-06 at 10 54 54 AM"
src="https://github.com/elastic/kibana/assets/11356435/f9c6e979-d921-478a-9b38-ab65a0798ee0">

### Release note
SLOs: Does not display group by cardinality when group by is not
selected.

### Testing
1. Create an SLO without a group by
2. Create an SLO with a group by
3. Edit the SLO without a group by. The cardinality callout should not
appear
4. Add a group by to the same SLO. The cardinality callout should appear
5. Edit the SLO with a group by. The cardinality callout should appear
6. Remove the group by on the same SLO. The cardinality callout should
disappear
  • Loading branch information
dominiqueclarke authored Mar 6, 2024
1 parent 4dcc900 commit edb11eb
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export function GroupByField({ dataView, isLoading }: { dataView?: DataView; isL

const { isLoading: isGroupByCardinalityLoading, data: groupByCardinality } =
useFetchGroupByCardinality(index, timestampField, groupByField);
const groupBy = [groupByField].flat().filter((value) => !!value);
const hasGroupBy = !groupBy.includes(ALL_VALUE) && groupBy.length;

return (
<>
Expand Down Expand Up @@ -55,7 +57,7 @@ export function GroupByField({ dataView, isLoading }: { dataView?: DataView; isL
isLoading={!!index && isLoading}
isDisabled={!index}
/>
{!isGroupByCardinalityLoading && !!groupByCardinality && (
{!isGroupByCardinalityLoading && !!groupByCardinality && hasGroupBy && (
<EuiCallOut
size="s"
iconType={groupByCardinality.isHighCardinality ? 'warning' : ''}
Expand Down

0 comments on commit edb11eb

Please sign in to comment.