Skip to content

Commit 493dcb5

Browse files
Merge pull request #456 from MetaCell/feature/451_2
rebased 451 changes to a new branch
2 parents ee50b42 + fa70737 commit 493dcb5

File tree

3 files changed

+3581
-86
lines changed

3 files changed

+3581
-86
lines changed

webapp/components/topbar/SwitchPageButton.js

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ const CREATE_NETWORK = 'CREATE NETWORK';
3232
const CREATE_AND_SIMULATE = 'CREATE AND SIMULATE';
3333
const SIMULATE = 'SIMULATE';
3434
const BACK_TO_EDIT = 'BACK TO EDIT';
35+
const BACK_TO_EXPLORER = 'GO TO EXPLORER';
36+
const UPDATE_NETWORK = 'UPDATE NETWORK';
3537

3638
const editOptions = [CREATE_NETWORK, CREATE_AND_SIMULATE, SIMULATE];
39+
const instantiatedEditOptions = [UPDATE_NETWORK, CREATE_AND_SIMULATE, SIMULATE];
3740
const exploreOptions = [SIMULATE, CREATE_AND_SIMULATE];
3841

3942
class SwitchPageButton extends Component {
@@ -43,7 +46,7 @@ class SwitchPageButton extends Component {
4346
}
4447

4548
handleClick = (selectedOption) => {
46-
if (selectedOption === CREATE_NETWORK) {
49+
if (selectedOption === CREATE_NETWORK || selectedOption === UPDATE_NETWORK) {
4750
this.props.createNetwork();
4851
} else if (selectedOption === SIMULATE) {
4952
if (this.props.experimentInDesign) {
@@ -64,43 +67,37 @@ class SwitchPageButton extends Component {
6467
}
6568
};
6669

67-
getExploreLabel () {
68-
const {
69-
automaticInstantiation,
70-
automaticSimulation,
71-
} = this.props;
72-
const instantiate = automaticInstantiation || this.props.modelState === MODEL_STATE.NOT_INSTANTIATED;
73-
if (instantiate && automaticSimulation) {
74-
return TOPBAR_CONSTANTS.CREATE_AND_SIMULATE_NETWORK;
75-
}
76-
if (instantiate) {
77-
return TOPBAR_CONSTANTS.CREATE_NETWORK;
78-
}
79-
if (automaticSimulation) {
80-
console.debug('Bad option combination: can\'t auto simulate without auto instantiate');
81-
}
82-
return TOPBAR_CONSTANTS.EXPLORE_EXISTING_NETWORK;
83-
}
84-
8570
render () {
8671
const {
8772
classes,
8873
editModelPage,
74+
modelState
8975
} = this.props;
76+
const instantiated = modelState == MODEL_STATE.INSTANTIATED ;
9077
return (
9178
<div className={classes.container}>
9279
{editModelPage
9380
? (
94-
<SplitButton
95-
options={editOptions}
96-
handleClick={(selectedOption) => this.handleClick(selectedOption)}
97-
icon={(
98-
<span style={{ marginRight: '5px' }}>
99-
<Icon name="rocket" />
100-
</span>
101-
)}
102-
skipIconFor={CREATE_NETWORK}
103-
/>
81+
<>
82+
<Button
83+
variant="contained"
84+
onClick={() => this.handleClick(BACK_TO_EXPLORER)}
85+
startIcon={<Icon name="screen" selected={false} />}
86+
disabled={!instantiated}
87+
>
88+
{ BACK_TO_EXPLORER }
89+
</Button>
90+
<SplitButton
91+
options={instantiated ? instantiatedEditOptions : editOptions }
92+
handleClick={(selectedOption) => this.handleClick(selectedOption)}
93+
icon={(
94+
<span style={{ marginRight: '5px' }}>
95+
<Icon name="rocket" />
96+
</span>
97+
)}
98+
skipIconFor={ CREATE_NETWORK }
99+
/>
100+
</>
104101
)
105102
: (
106103
<>

webapp/static/icons/screen.svg

Lines changed: 7 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)