-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Engine Selector/ Dropdown to Query UI
Engine Selector is a dropdown that sets an engine to be used to run the query. Currently two engines `thanos` and `prometheus`. This dropdown sends a query param `engine` to query api, which runs the api using the engine provided. Provided to run query using multiple query engines from Query UI. Signed-off-by: Pradyumna Krishna <[email protected]>
- Loading branch information
1 parent
00eca42
commit 8ef7010
Showing
5 changed files
with
100 additions
and
40 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { FC, memo } from 'react'; | ||
import { FormGroup, Label, Input, InputProps } from 'reactstrap'; | ||
|
||
export interface DropdownOption { | ||
name: string; | ||
value: string; | ||
} | ||
|
||
interface DropdownProps extends InputProps { | ||
options: DropdownOption[]; | ||
} | ||
|
||
const Dropdown: FC<DropdownProps> = ({ children, selected, options, id, ...rest }) => { | ||
return ( | ||
<FormGroup className="custom-control d-inline"> | ||
<Label for={id} className="control-label"> | ||
{children} | ||
</Label> | ||
<Input | ||
{...rest} | ||
id={id} | ||
type="select" | ||
value={selected} | ||
className="control-input custom-select" | ||
style={{ | ||
width: 'auto', | ||
marginLeft: '10px', | ||
}} | ||
> | ||
{options.map(function (option) { | ||
return <option value={option.value}>{option.name}</option>; | ||
})} | ||
</Input> | ||
</FormGroup> | ||
); | ||
}; | ||
|
||
export default memo(Dropdown); |
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
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