diff --git a/packages/xo-web/src/xo-app/new-vm/index.js b/packages/xo-web/src/xo-app/new-vm/index.js
index 53e08692d..ec172be5b 100644
--- a/packages/xo-web/src/xo-app/new-vm/index.js
+++ b/packages/xo-web/src/xo-app/new-vm/index.js
@@ -41,6 +41,7 @@ import {
createVms,
getCloudInitConfig,
subscribeCurrentUser,
+ subscribeIpPools,
subscribePermissions,
subscribeResourceSets,
XEN_DEFAULT_CPU_CAP,
@@ -115,12 +116,21 @@ const Item = ({ label, children, className }) => (
)
+@addSubscriptions({
+ // eslint-disable-next-line standard/no-callback-literal
+ ipPoolsConfigured: cb => subscribeIpPools(ipPools => cb(ipPools.length > 0)),
+})
@injectIntl
class Vif extends BaseComponent {
+ _getIpPoolPredicate = createSelector(
+ () => this.props.vif,
+ vif => ipPool => includes(ipPool.networks, vif.network)
+ )
+
render () {
const {
intl: { formatMessage },
- ipPoolPredicate,
+ ipPoolsConfigured,
networkPredicate,
onChangeAddresses,
onChangeMac,
@@ -159,26 +169,28 @@ class Vif extends BaseComponent {
)}
-
-
- {pool ? (
-
- ) : (
-
- )}
-
-
+ {ipPoolsConfigured && (
+
+
+ {pool ? (
+
+ ) : (
+
+ )}
+
+
+ )}
-