Skip to content

Commit

Permalink
fix(submitBtn): added setQueryToLoading for Submit component
Browse files Browse the repository at this point in the history
  • Loading branch information
asalem1 committed Jun 9, 2020
1 parent f926775 commit a585d98
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ui/src/notebooks/components/header/Submit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const COMMENT_REMOVER = /(\/\*([\s\S]*?)\*\/)|(\/\/(.*)$)/gm

export const Submit: FC = () => {
const {query} = useContext(QueryContext)
const {onNotify} = useContext(SubmitQueryButtonContext)
const {onNotify, setQueryToLoading} = useContext(SubmitQueryButtonContext)
const {id, pipes, updateResult, updateMeta} = useContext(NotebookContext)
const {timeContext} = useContext(TimeContext)
const time = timeContext[id]
Expand Down Expand Up @@ -86,6 +86,7 @@ export const Submit: FC = () => {
<SubmitQueryButton
text="Run Flow"
onNotify={onNotify}
setQueryToLoading={setQueryToLoading}
icon={IconFont.Play}
submitButtonDisabled={false}
queryStatus={RemoteDataState.NotStarted}
Expand Down
2 changes: 2 additions & 0 deletions ui/src/notebooks/context/query.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ export const QueryContext = React.createContext<QueryContextType>(

export interface SubmitQueryButtonContextType {
onNotify: () => void
setQueryToLoading: () => void
}

export const DEFAULT_SUBMIT_BTN_CONTEXT: SubmitQueryButtonContextType = {
onNotify: () => {},
setQueryToLoading: () => {},
}

export const SubmitQueryButtonContext = React.createContext<
Expand Down
2 changes: 1 addition & 1 deletion ui/src/timeMachine/components/SubmitQueryButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ interface StateProps {
}

interface DispatchProps {
setQueryToLoading: typeof setQueryToLoading
setQueryToLoading: typeof setQueryToLoading | (() => void)
onSubmit: typeof saveAndExecuteQueries | (() => void)
onNotify: typeof notify | (() => void)
}
Expand Down

0 comments on commit a585d98

Please sign in to comment.