feat(ux): Disabled Execute button while request is in progress (#6776)
Avoid sending multiple request while old is in progress Co-authored-by: Tim Lai <timothy.lai@gmail.com>
This commit is contained in:
@@ -11,7 +11,8 @@ export default class Execute extends Component {
|
|||||||
method: PropTypes.string.isRequired,
|
method: PropTypes.string.isRequired,
|
||||||
oas3Selectors: PropTypes.object.isRequired,
|
oas3Selectors: PropTypes.object.isRequired,
|
||||||
oas3Actions: PropTypes.object.isRequired,
|
oas3Actions: PropTypes.object.isRequired,
|
||||||
onExecute: PropTypes.func
|
onExecute: PropTypes.func,
|
||||||
|
disabled: PropTypes.bool
|
||||||
}
|
}
|
||||||
|
|
||||||
handleValidateParameters = () => {
|
handleValidateParameters = () => {
|
||||||
@@ -24,7 +25,7 @@ export default class Execute extends Component {
|
|||||||
let { path, method, specSelectors, oas3Selectors, oas3Actions } = this.props
|
let { path, method, specSelectors, oas3Selectors, oas3Actions } = this.props
|
||||||
let validationErrors = {
|
let validationErrors = {
|
||||||
missingBodyValue: false,
|
missingBodyValue: false,
|
||||||
missingRequiredKeys: []
|
missingRequiredKeys: []
|
||||||
}
|
}
|
||||||
// context: reset errors, then (re)validate
|
// context: reset errors, then (re)validate
|
||||||
oas3Actions.clearRequestBodyValidateError({ path, method })
|
oas3Actions.clearRequestBodyValidateError({ path, method })
|
||||||
@@ -92,8 +93,9 @@ export default class Execute extends Component {
|
|||||||
onChangeProducesWrapper = ( val ) => this.props.specActions.changeProducesValue([this.props.path, this.props.method], val)
|
onChangeProducesWrapper = ( val ) => this.props.specActions.changeProducesValue([this.props.path, this.props.method], val)
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
|
const { disabled } = this.props
|
||||||
return (
|
return (
|
||||||
<button className="btn execute opblock-control__btn" onClick={ this.onClick }>
|
<button className="btn execute opblock-control__btn" onClick={ this.onClick } disabled={disabled}>
|
||||||
Execute
|
Execute
|
||||||
</button>
|
</button>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -198,7 +198,8 @@ export default class Operation extends PureComponent {
|
|||||||
oas3Actions={ oas3Actions }
|
oas3Actions={ oas3Actions }
|
||||||
path={ path }
|
path={ path }
|
||||||
method={ method }
|
method={ method }
|
||||||
onExecute={ onExecute } />
|
onExecute={ onExecute }
|
||||||
|
disabled={executeInProgress}/>
|
||||||
}
|
}
|
||||||
|
|
||||||
{ (!tryItOutEnabled || !response || !allowTryItOut) ? null :
|
{ (!tryItOutEnabled || !response || !allowTryItOut) ? null :
|
||||||
|
|||||||
Reference in New Issue
Block a user