-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move bucket selection to first card in Query Builder (#12782)
* Break out raw data toggle into own component * Move bucket selection into "first" card in query builder * Appease linter gods * Updoot
- Loading branch information
alexpaxton
authored
Mar 20, 2019
1 parent
8abb76c
commit b1d8325
Showing
6 changed files
with
100 additions
and
50 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Libraries | ||
import React, {Component} from 'react' | ||
|
||
// Components | ||
import {Form} from 'src/clockface' | ||
import QueryBuilderBucketDropdown from 'src/timeMachine/components/QueryBuilderBucketDropdown' | ||
|
||
export default class QueryBuilderDataCard extends Component<{}> { | ||
public render() { | ||
return ( | ||
<div className="tag-selector data-card"> | ||
<Form.Element label="Bucket"> | ||
<QueryBuilderBucketDropdown /> | ||
</Form.Element> | ||
</div> | ||
) | ||
} | ||
} |
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,63 @@ | ||
// Libraries | ||
import React, {PureComponent} from 'react' | ||
import {connect} from 'react-redux' | ||
|
||
// Components | ||
import {SlideToggle, ComponentSize} from '@influxdata/clockface' | ||
|
||
// Actions | ||
import {setIsViewingRawData} from 'src/timeMachine/actions' | ||
|
||
// Utils | ||
import {getActiveTimeMachine} from 'src/timeMachine/selectors' | ||
|
||
// Types | ||
import {AppState} from 'src/types/v2' | ||
|
||
interface StateProps { | ||
isViewingRawData: boolean | ||
} | ||
|
||
interface DispatchProps { | ||
onSetIsViewingRawData: typeof setIsViewingRawData | ||
} | ||
|
||
type Props = StateProps & DispatchProps | ||
|
||
class TimeMachineQueries extends PureComponent<Props> { | ||
public render() { | ||
const {isViewingRawData} = this.props | ||
|
||
return ( | ||
<> | ||
<SlideToggle.Label text="View Raw Data" /> | ||
<SlideToggle | ||
active={isViewingRawData} | ||
onChange={this.handleToggleIsViewingRawData} | ||
size={ComponentSize.ExtraSmall} | ||
/> | ||
</> | ||
) | ||
} | ||
|
||
private handleToggleIsViewingRawData = () => { | ||
const {isViewingRawData, onSetIsViewingRawData} = this.props | ||
|
||
onSetIsViewingRawData(!isViewingRawData) | ||
} | ||
} | ||
|
||
const mstp = (state: AppState) => { | ||
const {isViewingRawData} = getActiveTimeMachine(state) | ||
|
||
return {isViewingRawData} | ||
} | ||
|
||
const mdtp = { | ||
onSetIsViewingRawData: setIsViewingRawData, | ||
} | ||
|
||
export default connect<StateProps, DispatchProps>( | ||
mstp, | ||
mdtp | ||
)(TimeMachineQueries) |