diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/ConfigurationTabs.js b/monkey/monkey_island/cc/ui/src/components/configuration-components/ConfigurationTabs.js new file mode 100644 index 000000000..7701959cf --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/ConfigurationTabs.js @@ -0,0 +1,30 @@ +const CONFIGURATION_TABS = { + ATTACK: 'attack', + BASIC: 'basic', + BASIC_NETWORK: 'basic_network', + RANSOMWARE: 'ransomware', + MONKEY: 'monkey', + INTERNAL: 'internal' +}; + +const advancedModeConfigTabs = [ + CONFIGURATION_TABS.ATTACK, + CONFIGURATION_TABS.BASIC, + CONFIGURATION_TABS.BASIC_NETWORK, + CONFIGURATION_TABS.RANSOMWARE, + CONFIGURATION_TABS.MONKEY, + CONFIGURATION_TABS.INTERNAL +]; + +const ransomwareModeConfigTabs = [ + CONFIGURATION_TABS.BASIC, + CONFIGURATION_TABS.BASIC_NETWORK, + CONFIGURATION_TABS.RANSOMWARE +]; + +const CONFIGURATION_TABS_PER_MODE = { + 'advanced': advancedModeConfigTabs, + 'ransomware': ransomwareModeConfigTabs +}; + +export default CONFIGURATION_TABS_PER_MODE; 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 594b0ad08..26141b22c 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -18,19 +18,12 @@ import ConfigExportModal from '../configuration-components/ExportConfigModal'; import ConfigImportModal from '../configuration-components/ImportConfigModal'; import applyUiSchemaManipulators from '../configuration-components/UISchemaManipulators.tsx'; import HtmlFieldDescription from '../configuration-components/HtmlFieldDescription.js'; +import CONFIGURATION_TABS_PER_MODE from '../configuration-components/ConfigurationTabs.js'; const ATTACK_URL = '/api/attack'; const CONFIG_URL = '/api/configuration/island'; export const API_PBA_LINUX = '/api/fileUpload/PBAlinux'; export const API_PBA_WINDOWS = '/api/fileUpload/PBAwindows'; -const CONFIGURATION_TABS = { - ATTACK: 'attack', - BASIC: 'basic', - BASIC_NETWORK: 'basic_network', - RANSOMWARE: 'ransomware', - MONKEY: 'monkey', - INTERNAL: 'internal' -}; class ConfigurePageComponent extends AuthComponent { @@ -67,30 +60,9 @@ class ConfigurePageComponent extends AuthComponent { // } // ); - let advancedModeConfigTabs = [ - CONFIGURATION_TABS.ATTACK, - CONFIGURATION_TABS.BASIC, - CONFIGURATION_TABS.BASIC_NETWORK, - CONFIGURATION_TABS.RANSOMWARE, - CONFIGURATION_TABS.MONKEY, - CONFIGURATION_TABS.INTERNAL - ] - - let ransomwareModeConfigTabs = [ - CONFIGURATION_TABS.BASIC, - CONFIGURATION_TABS.BASIC_NETWORK, - CONFIGURATION_TABS.RANSOMWARE - ] - - let mode = 'ransomware'; - // let mode = ''; - - if (mode === 'ransomware') { - return ransomwareModeConfigTabs; - } - else { - return advancedModeConfigTabs; - } + // let mode = 'ransomware'; + let mode = 'advanced'; + return CONFIGURATION_TABS_PER_MODE[mode]; } setInitialConfig(config) {