cc: Extract configuration tabs' order to a separate file and modify how the order is fetched

This commit is contained in:
Shreya 2021-07-14 18:42:26 +05:30 committed by Mike Salvatore
parent 6e3053cfc0
commit 7170efbf0d
2 changed files with 34 additions and 32 deletions

View File

@ -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;

View File

@ -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) {