feat: change "Submit" to "Run Notebook" (#18230)

pull/18250/head
alexpaxton 2020-05-26 15:02:36 -07:00 committed by GitHub
parent f04fc81ca6
commit dae7953806
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 4 deletions

View File

@ -1,14 +1,19 @@
// Libraries
import React, {FC, useContext, useCallback} from 'react'
// Contexts
import {NotebookContext} from 'src/notebooks/context/notebook'
import {TimeProvider, TimeContext, TimeBlock} from 'src/notebooks/context/time'
import AppSettingProvider from 'src/notebooks/context/app'
// Components
import TimeZoneDropdown from 'src/notebooks/components/header/TimeZoneDropdown'
import TimeRangeDropdown from 'src/notebooks/components/header/TimeRangeDropdown'
import AutoRefreshDropdown from 'src/notebooks/components/header/AutoRefreshDropdown'
import {SubmitQueryButton} from 'src/timeMachine/components/SubmitQueryButton'
import {IconFont} from '@influxdata/clockface'
// Types
import {RemoteDataState} from 'src/types'
export interface TimeContextProps {
@ -44,6 +49,8 @@ const Buttons: FC = () => {
<TimeRangeDropdown context={timeContext[id]} update={update} />
<AutoRefreshDropdown context={timeContext[id]} update={update} />
<SubmitQueryButton
text="Run Notebook"
icon={IconFont.Play}
submitButtonDisabled={false}
queryStatus={RemoteDataState.NotStarted}
onSubmit={submit}

View File

@ -8,6 +8,7 @@ import {
ComponentColor,
ComponentSize,
ComponentStatus,
IconFont,
} from '@influxdata/clockface'
// Actions
@ -29,18 +30,32 @@ interface DispatchProps {
onSubmit: typeof saveAndExecuteQueries | (() => void)
}
type Props = StateProps & DispatchProps
interface OwnProps {
text?: string
icon?: IconFont
testID?: string
}
type Props = OwnProps & StateProps & DispatchProps
class SubmitQueryButton extends PureComponent<Props> {
public static defaultProps = {
text: 'Submit',
testID: 'time-machine-submit-button',
}
public render() {
const {text, icon, testID} = this.props
return (
<Button
text="Submit"
text={text}
icon={icon}
size={ComponentSize.Small}
status={this.buttonStatus}
onClick={this.handleClick}
color={ComponentColor.Primary}
testID="time-machine-submit-button"
testID={testID}
/>
)
}