-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implements reordering of GroupBys and fixes position of Add Button
- Loading branch information
Showing
3 changed files
with
59 additions
and
16 deletions.
There are no files selected for viewing
33 changes: 29 additions & 4 deletions
33
bitmovin-analytics-datasource/src/components/GroupByInput.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,47 @@ | ||
import React from 'react'; | ||
import { SelectableValue } from '@grafana/data'; | ||
import { HorizontalGroup, IconButton, Select } from '@grafana/ui'; | ||
|
||
import { QueryAttribute } from '../types/queryAttributes'; | ||
import { QueryAdAttribute } from '../types/queryAdAttributes'; | ||
import { SelectableValue } from '@grafana/data'; | ||
|
||
type Props = { | ||
groupBy: SelectableValue<QueryAttribute | QueryAdAttribute>; | ||
selectableGroupBys: Array<SelectableValue<QueryAttribute | QueryAdAttribute>>; | ||
onDelete: () => void; | ||
onChange: (newValue: SelectableValue<QueryAdAttribute | QueryAttribute>) => void; | ||
isFirst: boolean; | ||
isLast: boolean; | ||
onReorderGroupBy: (direction: REORDER_DIRECTION) => void; | ||
}; | ||
|
||
export enum REORDER_DIRECTION { | ||
UP, | ||
DOWN, | ||
} | ||
export function GroupByInput(props: Props) { | ||
//TODOMY delete margin between select and icon | ||
//TODOMY border around the icon | ||
return ( | ||
<HorizontalGroup> | ||
<Select value={props.groupBy} onChange={props.onChange} options={props.selectableGroupBys} width={30} /> | ||
<IconButton tooltip="Delete Group By" name="trash-alt" onClick={() => props.onDelete()} size="lg" /> | ||
<IconButton | ||
tooltip="Move down" | ||
onClick={() => props.onReorderGroupBy(REORDER_DIRECTION.DOWN)} | ||
name="arrow-down" | ||
disabled={props.isLast} | ||
/> | ||
<IconButton | ||
tooltip="Move up" | ||
onClick={() => props.onReorderGroupBy(REORDER_DIRECTION.UP)} | ||
name="arrow-up" | ||
disabled={props.isFirst} | ||
/> | ||
<IconButton | ||
tooltip="Delete Group By" | ||
name="trash-alt" | ||
onClick={() => props.onDelete()} | ||
size="lg" | ||
variant="destructive" | ||
/> | ||
</HorizontalGroup> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters