ui: extract UnsafeOptionsConfirmationModal JSX invocation into a function

This commit is contained in:
Mike Salvatore 2021-02-26 11:19:33 -05:00
parent 5a9cb8b4af
commit 75bf30913a
1 changed files with 11 additions and 6 deletions

View File

@ -186,7 +186,6 @@ class ConfigurePageComponent extends AuthComponent {
} }
configSubmit() { configSubmit() {
// Submit monkey configuration
if (!this.canSafelySubmitConfig(this.state.configuration)) { if (!this.canSafelySubmitConfig(this.state.configuration)) {
this.setState({showUnsafeOptionsConfirmation: true}); this.setState({showUnsafeOptionsConfirmation: true});
return; return;
@ -276,6 +275,16 @@ class ConfigurePageComponent extends AuthComponent {
</Modal>) </Modal>)
}; };
renderUnsafeOptionsConfirmationModal() {
return (
<UnsafeOptionsConfirmationModal
show={this.state.showUnsafeOptionsConfirmation}
onCancelClick={this.onUnsafeConfirmationCancelClick}
onContinueClick={this.onUnsafeConfirmationContinueClick}
/>
)
}
userChangedConfig() { userChangedConfig() {
if (JSON.stringify(this.state.configuration) === JSON.stringify(this.initialConfig)) { if (JSON.stringify(this.state.configuration) === JSON.stringify(this.initialConfig)) {
if (Object.keys(this.currentFormData).length === 0 || if (Object.keys(this.currentFormData).length === 0 ||
@ -504,11 +513,7 @@ class ConfigurePageComponent extends AuthComponent {
lg={{offset: 3, span: 8}} xl={{offset: 2, span: 8}} lg={{offset: 3, span: 8}} xl={{offset: 2, span: 8}}
className={'main'}> className={'main'}>
{this.renderAttackAlertModal()} {this.renderAttackAlertModal()}
<UnsafeOptionsConfirmationModal {this.renderUnsafeOptionsConfirmationModal()}
show={this.state.showUnsafeOptionsConfirmation}
onCancelClick={this.onUnsafeConfirmationCancelClick}
onContinueClick={this.onUnsafeConfirmationContinueClick}
/>
<h1 className='page-title'>Monkey Configuration</h1> <h1 className='page-title'>Monkey Configuration</h1>
{this.renderNav()} {this.renderNav()}
{content} {content}