Skip to content

Commit db9948b

Browse files
author
Sergiu Miclea
committed
Allow further progress even if the selected instances have no NICs
This means that the message from previous commit is still displayed, but the 'Next' button is enabled.
1 parent 8a776a7 commit db9948b

4 files changed

Lines changed: 52 additions & 40 deletions

File tree

src/actions/MigrationActions/MigrationActions.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,11 @@ MigrationActions.addMigration.listen((migration, callback = null, errorCallback
266266
})
267267

268268
let networkMap = {}
269-
migration.networks.forEach(network => {
270-
networkMap[network.network_name] = network.migrateNetwork
271-
})
269+
if (migration.networks) {
270+
migration.networks.forEach(network => {
271+
networkMap[network.network_name] = network.migrateNetwork
272+
})
273+
}
272274

273275
let destinationEnv = {}
274276

@@ -300,7 +302,7 @@ MigrationActions.addMigration.listen((migration, callback = null, errorCallback
300302
}
301303
}
302304

303-
destinationEnv["network_map"] = networkMap // eslint-disable-line dot-notation
305+
destinationEnv.network_map = networkMap
304306

305307
payload[migration.migrationType] = {
306308
origin_endpoint_id: migration.sourceCloud.credential.id,

src/components/MigrationWizard/MigrationWizard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class MigrationWizard extends Reflux.Component {
168168
step = <WizardVms setWizardState={(e) => this.setWizardState(e)} data={this.state} />
169169
break;
170170
case "WizardNetworks":
171-
step = <WizardNetworks setWizardState={(e) => this.setWizardState(e)} data={this.state} />
171+
step = <WizardNetworks data={this.state} />
172172
break;
173173
case "WizardMigrationType":
174174
step = (<WizardMigrationType

src/components/WizardNetworks/WizardNetworks.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class WizardNetworks extends Component {
3333

3434
static propTypes = {
3535
data: PropTypes.object,
36-
setWizardState: PropTypes.func
3736
}
3837

3938
constructor(props) {
@@ -126,10 +125,13 @@ class WizardNetworks extends Component {
126125
}, this)
127126
}
128127

129-
this.setState({
130-
networks: networks,
131-
hasNoNics: hasNoNics
132-
})
128+
if (!this.state.valid && hasNoNics) {
129+
this.setState({ networks, hasNoNics, valid: true }, () => {
130+
WizardActions.updateWizardState({ networks, valid: true })
131+
})
132+
} else {
133+
this.setState({ networks, hasNoNics })
134+
}
133135
}
134136

135137
handleChangeNetwork(event, network) {

src/components/WizardSummary/WizardSummary.js

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -78,29 +78,44 @@ class WizardSummary extends Component {
7878
</div>
7979
))
8080

81-
let networks = this.props.summary.networks.map((network, index) => {
82-
if (network.selected || true) {
83-
return (
84-
<div className="item" key={"Network_" + index}>
85-
<span className="cell">
86-
<TextTruncate line={1} text={network.network_name} truncateText="..." />
87-
</span>
88-
<span className="cell">
89-
<div className="arrow"></div>
90-
</span>
91-
<span className="cell">
92-
<TextTruncate
93-
line={1}
94-
text={network.migrateNetwork ? network.migrateNetwork : "Create new"}
95-
truncateText="..."
96-
/>
97-
</span>
81+
let networksContainer = null
82+
if (this.props.summary.networks) {
83+
let networks = this.props.summary.networks && this.props.summary.networks.map((network, index) => {
84+
if (network.selected || true) {
85+
return (
86+
<div className="item" key={"Network_" + index}>
87+
<span className="cell">
88+
<TextTruncate line={1} text={network.network_name} truncateText="..." />
89+
</span>
90+
<span className="cell">
91+
<div className="arrow"></div>
92+
</span>
93+
<span className="cell">
94+
<TextTruncate
95+
line={1}
96+
text={network.migrateNetwork ? network.migrateNetwork : "Create new"}
97+
truncateText="..."
98+
/>
99+
</span>
100+
</div>
101+
)
102+
} else {
103+
return null
104+
}
105+
})
106+
107+
networksContainer = (
108+
<div className={s.group}>
109+
<h3>
110+
Networks
111+
</h3>
112+
<div className={s.networks + " items-list"}>
113+
{networks}
98114
</div>
99-
)
100-
} else {
101-
return null
102-
}
103-
})
115+
</div>
116+
)
117+
}
118+
104119
return (
105120
<div className={s.root}>
106121
<div className={s.container}>
@@ -151,14 +166,7 @@ class WizardSummary extends Component {
151166
{instances}
152167
</div>
153168
</div>
154-
<div className={s.group}>
155-
<h3>
156-
Networks
157-
</h3>
158-
<div className={s.networks + " items-list"}>
159-
{networks}
160-
</div>
161-
</div>
169+
{networksContainer}
162170
</div>
163171
</div>
164172
</div>

0 commit comments

Comments
 (0)