Island: Pass island mode as a prop to ConfigurePageComponent

This commit is contained in:
Mike Salvatore 2021-07-14 14:26:14 -04:00
parent 7170efbf0d
commit c0514e1359
2 changed files with 6 additions and 15 deletions

View File

@ -155,6 +155,7 @@ class AppComponent extends AuthComponent {
true)} true)}
{this.renderRoute('/configure', {this.renderRoute('/configure',
<StandardLayoutComponent component={ConfigurePage} <StandardLayoutComponent component={ConfigurePage}
islandMode={this.state.islandMode}
onStatusChange={this.updateStatus} onStatusChange={this.updateStatus}
completedSteps={this.state.completedSteps}/>)} completedSteps={this.state.completedSteps}/>)}
{this.renderRoute('/run-monkey', {this.renderRoute('/run-monkey',

View File

@ -31,8 +31,7 @@ class ConfigurePageComponent extends AuthComponent {
super(props); super(props);
this.initialConfig = {}; this.initialConfig = {};
this.initialAttackConfig = {}; this.initialAttackConfig = {};
this.sectionsOrder = this.getSectionsOrder(); this.currentSection = this.getSectionsOrder()[0];
this.currentSection = this.sectionsOrder[0];
this.state = { this.state = {
attackConfig: {}, attackConfig: {},
@ -51,18 +50,9 @@ class ConfigurePageComponent extends AuthComponent {
}; };
} }
getSectionsOrder() { // TODO: Fetch mode from API endpoint getSectionsOrder() {
// let mode = ""; let islandMode = this.props.islandMode ? this.props.islandMode : 'advanced'
// this.authFetch('/api/mode') return CONFIGURATION_TABS_PER_MODE[islandMode];
// .then(res => res.json())
// .then(res => {
// mode = res.mode
// }
// );
// let mode = 'ransomware';
let mode = 'advanced';
return CONFIGURATION_TABS_PER_MODE[mode];
} }
setInitialConfig(config) { setInitialConfig(config) {
@ -85,7 +75,7 @@ class ConfigurePageComponent extends AuthComponent {
let monkeyConfig = data[0]; let monkeyConfig = data[0];
this.setInitialConfig(monkeyConfig.configuration); this.setInitialConfig(monkeyConfig.configuration);
this.setInitialAttackConfig(attackConfig.configuration); this.setInitialAttackConfig(attackConfig.configuration);
for (let sectionKey of this.sectionsOrder) { for (let sectionKey of this.getSectionsOrder()) {
if (sectionKey === 'attack') { if (sectionKey === 'attack') {
sections.push({key: sectionKey, title: 'ATT&CK'}) sections.push({key: sectionKey, title: 'ATT&CK'})
} else { } else {