Skip to content

Commit bc0cccd

Browse files
marie-jantleblanc
authored andcommitted
fix(pci.instance.add): add public network when adding a network (#714)
ref :MSB-85
1 parent 9444c66 commit bc0cccd

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

packages/manager/modules/pci/src/projects/project/instances/add/add.component.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default {
66
goBack: '<',
77
projectId: '@',
88
privateNetworks: '<',
9+
publicNetwork: '<',
910
regions: '<',
1011
cancelLink: '<',
1112
quotaLink: '<',

packages/manager/modules/pci/src/projects/project/instances/add/add.controller.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ export default class PciInstancesAddController {
157157
if (get(this.selectedPrivateNetwork, 'id')) {
158158
this.instance.networks = [{
159159
networkId: get(this.selectedPrivateNetwork, 'id'),
160+
}, {
161+
networkId: get(this.publicNetwork, 'id'),
160162
}];
161163
} else {
162164
this.instance.networks = [];

packages/manager/modules/pci/src/projects/project/instances/add/add.routing.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ export default /* @ngInject */($stateProvider) => {
1010
projectId,
1111
) => PciProjectsProjectInstanceService.getPrivateNetworks(projectId),
1212

13+
publicNetwork: /* @ngInject */ (
14+
PciProjectsProjectInstanceService,
15+
projectId,
16+
) => PciProjectsProjectInstanceService.getPublicNetwork(projectId),
17+
1318
regions: /* @ngInject */ (
1419
PciProjectsProjectInstanceService,
1520
projectId,

packages/manager/modules/pci/src/projects/project/instances/instances.service.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,17 @@ export default class PciProjectInstanceService {
269269
));
270270
}
271271

272+
getPublicNetwork(projectId) {
273+
return this.OvhApiCloudProjectNetwork
274+
.Public()
275+
.v6()
276+
.query({
277+
serviceName: projectId,
278+
})
279+
.$promise
280+
.then(([publicNetwork]) => publicNetwork);
281+
}
282+
272283
getCompatiblesPrivateNetworks(projectId, instance) {
273284
return this.getAvailablesPrivateNetworks(projectId, instance.region)
274285
.then(networks => filter(

0 commit comments

Comments
 (0)