Skip to content

Commit

Permalink
do not set value if value isEmpty for GroupBy and OrderBy Input
Browse files Browse the repository at this point in the history
  • Loading branch information
MGJamJam committed May 9, 2024
1 parent e5b60e4 commit a81c91b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export function FilterInput(props: Props) {
type="text"
onChange={(value) => props.onValueChange(value.currentTarget.value)}
width={30}
placeholder="Enter Filter value"
/>
</Tooltip>
<IconButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { HorizontalGroup, IconButton, Select } from '@grafana/ui';

import { QueryAttribute } from '../types/queryAttributes';
import { QueryAdAttribute } from '../types/queryAdAttributes';
import { isEmpty } from 'lodash';

export enum REORDER_DIRECTION {
UP,
Expand All @@ -23,7 +24,12 @@ type Props = {
export function GroupByInput(props: Props) {
return (
<HorizontalGroup>
<Select value={props.groupBy} onChange={props.onChange} options={props.selectableGroupBys} width={30} />
<Select
value={isEmpty(props.groupBy) ? undefined : props.groupBy}
onChange={props.onChange}
options={props.selectableGroupBys}
width={30}
/>
<IconButton
tooltip="Move down"
onClick={() => props.onReorderGroupBy(REORDER_DIRECTION.DOWN)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { QueryAttribute } from '../types/queryAttributes';
import { QueryAdAttribute } from '../types/queryAdAttributes';
import { QuerySortOrder } from '../types/queryOrderBy';
import { REORDER_DIRECTION } from './GroupByInput';
import { isEmpty } from 'lodash';

type Props = {
readonly isAdAnalytics: boolean;
Expand All @@ -29,7 +30,7 @@ export function OrderByInput(props: Props) {
return (
<HorizontalGroup spacing="xs">
<Select
value={props.attribute}
value={isEmpty(props.attribute) ? undefined : props.attribute}
onChange={(value) => props.onAttributeChange(value)}
options={props.selectableOrderByAttributes}
width={30}
Expand Down

0 comments on commit a81c91b

Please sign in to comment.