From 5a52ceaa4c0de48b3284ba976fb852e6ddab13a7 Mon Sep 17 00:00:00 2001 From: vakarisz Date: Fri, 8 Jul 2022 11:24:07 +0300 Subject: [PATCH] UI: Reset last action on in ConfigurePage.js Last action, like "Configuration was reset successfully" shouldn't linger in the page for long. It should reset upon modifying the configuration or changing the tab --- .../cc/ui/src/components/pages/ConfigurePage.js | 13 ++++++------- .../components/ui-components/AdvancedMultiSelect.js | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js index e1016a304..81dfbfb14 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -59,6 +59,10 @@ class ConfigurePageComponent extends AuthComponent { } } + resetLastAction = () => { + this.setState({lastAction: 'none'}); + } + getSectionsOrder() { let islandMode = this.props.islandMode !== 'unset' ? this.props.islandMode : 'advanced' return CONFIGURATION_TABS_PER_MODE[islandMode]; @@ -262,13 +266,7 @@ class ConfigurePageComponent extends AuthComponent { } setSelectedSection = (key) => { - - // TODO: Fix https://github.com/guardicore/monkey/issues/1621 - //if ( key === 'basic' & this.userChangedConfig()) { - // this.setState({showUnsubmittedConfigWarning: true}); - // return; - //} - + this.resetLastAction(); this.updateConfigSection(); this.currentSection = key; let selectedSectionData = this.state.configuration[key]; @@ -351,6 +349,7 @@ class ConfigurePageComponent extends AuthComponent { formProperties['fields'] = {DescriptionField: HtmlFieldDescription}; formProperties['formData'] = this.state.currentFormData; formProperties['onChange'] = this.onChange; + formProperties['onFocus'] = this.resetLastAction; formProperties['customFormats'] = formValidationFormats; formProperties['transformErrors'] = transformErrors; formProperties['className'] = 'config-form'; diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js b/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js index fbef10235..e0bc667de 100644 --- a/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js @@ -182,7 +182,7 @@ class AdvancedMultiSelect extends React.Component { } = this.props; return ( -
+