diff --git a/packages/manager/modules/vrack/src/dashboard/translations/Messages_fr_FR.json b/packages/manager/modules/vrack/src/dashboard/translations/Messages_fr_FR.json index 434b3c28623c..d7c8cec55c79 100644 --- a/packages/manager/modules/vrack/src/dashboard/translations/Messages_fr_FR.json +++ b/packages/manager/modules/vrack/src/dashboard/translations/Messages_fr_FR.json @@ -36,6 +36,7 @@ "vrack_menu_add": "Créer un vRack", "vrack_menu_project_num": "Vrack {{num}}", "vrack_service_type_dedicatedserver": "Serveur dédié", + "vrack_service_type_ovhcloudconnect": "OVH Cloud connect", "vrack_service_type_dedicatedcloud": "Hosted Private Cloud", "vrack_service_type_managedbaremetal": "Managed Bare Metal", "vrack_service_type_dedicatedconnect": "Dedicated connect", diff --git a/packages/manager/modules/vrack/src/dashboard/vrack.constant.js b/packages/manager/modules/vrack/src/dashboard/vrack.constant.js index dff367d3fceb..7b373670be89 100644 --- a/packages/manager/modules/vrack/src/dashboard/vrack.constant.js +++ b/packages/manager/modules/vrack/src/dashboard/vrack.constant.js @@ -37,6 +37,7 @@ export const FEATURE_NAMES = { legacyVrack: 'vrack', managedBareMetal: 'managed-bare-metal', managedBareMetalDatacenter: 'managed-bare-metal', + ovhCloudConnect: 'cloud-connect', }; export const POLLING_INTERVAL = 500; @@ -64,6 +65,7 @@ export const TYPE_SERVICE = { ip: 'ip', legacyVrack: 'legacyVrack', ipv6: 'ipv6', + ovhCloudConnect: 'ovhCloudConnect', }; export const SERVICES = [ diff --git a/packages/manager/modules/vrack/src/dashboard/vrack.controller.js b/packages/manager/modules/vrack/src/dashboard/vrack.controller.js index 6772533ac910..407257ff81fb 100644 --- a/packages/manager/modules/vrack/src/dashboard/vrack.controller.js +++ b/packages/manager/modules/vrack/src/dashboard/vrack.controller.js @@ -536,8 +536,19 @@ export default class VrackMoveDialogCtrl { this.updateLegacyVrackServiceInfo(); } break; + case TYPE_SERVICE.ovhCloudConnect: + // Update ovhcloudconnect + if ( + !this.data.eligibleServices?.ovhCloudConnect?.length !== + services.ovhCloudConnect.length + ) { + this.data.eligibleServices.ovhCloudConnect = + services.ovhCloudConnect; + // Update ovhcloudconnect + this.updateOvhCloudConnect(); + } + break; default: - this.updateOvhCloudConnect(); break; } } @@ -555,9 +566,22 @@ export default class VrackMoveDialogCtrl { } updateOvhCloudConnect() { - if (this.data.eligibleServices?.ovhCloudConnect?.length > 0) { - this.data.eligibleServices.ovhCloudConnect = []; - } + return this.$q + .all( + this.data.eligibleServices.ovhCloudConnect.map((serviceId) => { + return this.vrackService + .getOvhCloudConnectServer(serviceId) + .then(({ data }) => { + const occ = VrackMoveDialogCtrl.getOvhCloudConnectServerNiceName( + data, + ); + return occ; + }); + }), + ) + .then((ovhCloudConnect) => { + this.data.eligibleServices.ovhCloudConnect = ovhCloudConnect; + }); } getEligibleServices() { @@ -613,8 +637,12 @@ export default class VrackMoveDialogCtrl { this.updateIpLoadbalancingServiceInfo(); } break; + case TYPE_SERVICE.ovhCloudConnect: + if (this.data.eligibleServices?.ovhCloudConnect?.length > 0) { + this.updateOvhCloudConnect(); + } + break; default: - this.updateOvhCloudConnect(); break; } } @@ -1164,6 +1192,12 @@ export default class VrackMoveDialogCtrl { }, ).$promise; break; + case 'ovhCloudConnect': + task = this.vrackService.associateOvhCloudConnectToVrack( + this.serviceName, + service.id, + ); + break; default: break; } @@ -1305,6 +1339,12 @@ export default class VrackMoveDialogCtrl { ipLoadbalancing: service.id, }).$promise; break; + case 'ovhCloudConnect': + task = this.vrackService.dissociateOvhCloudConnectFromVrack( + this.serviceName, + service.id, + ); + break; default: break; } @@ -1395,6 +1435,16 @@ export default class VrackMoveDialogCtrl { return formattedService; } + static getOvhCloudConnectServerNiceName(service) { + const formattedService = { + ...service, + id: service.uuid, + niceName: service.uuid, + trueServiceType: 'ovhCloudConnect', + }; + return formattedService; + } + static getDedicatedServerInterfaceNiceName(service) { const formattedService = VrackMoveDialogCtrl.getDedicatedServerNiceName( service.dedicatedServer, @@ -1490,6 +1540,13 @@ export default class VrackMoveDialogCtrl { trueServiceType: 'ip', }; break; + case 'ovhCloudConnect': + formattedService = { + id: service, + niceName: service, + trueServiceType: 'ovhCloudConnect', + }; + break; case 'cloudProject': formattedService = VrackMoveDialogCtrl.getCloudProjectNiceName(service); break; diff --git a/packages/manager/modules/vrack/src/dashboard/vrack.service.js b/packages/manager/modules/vrack/src/dashboard/vrack.service.js index 8f373dcc73e0..4a898053a122 100644 --- a/packages/manager/modules/vrack/src/dashboard/vrack.service.js +++ b/packages/manager/modules/vrack/src/dashboard/vrack.service.js @@ -30,6 +30,10 @@ export default class Vrack { return this.$http.get(`/dedicated/server/${serviceName}`); } + getOvhCloudConnectServer(serviceName) { + return this.$http.get(`/ovhCloudConnect/${serviceName}`); + } + getDedicatedCloud(serviceName) { return this.$http.get(`/dedicatedCloud/${serviceName}`); } @@ -41,4 +45,18 @@ export default class Vrack { getIpLoadbalancing(serviceName) { return this.$http.get(`/ipLoadbalancing/${serviceName}`); } + + associateOvhCloudConnectToVrack(serviceName, ovhCloudConnectId) { + return this.$http + .post(`/vrack/${serviceName}/ovhCloudConnect`, { + ovhCloudConnect: ovhCloudConnectId, + }) + .then(({ data }) => data); + } + + dissociateOvhCloudConnectFromVrack(serviceName, ovhCloudConnectId) { + return this.$http + .delete(`/vrack/${serviceName}/ovhCloudConnect/${ovhCloudConnectId}`) + .then(({ data }) => data); + } } diff --git a/packages/manager/modules/vrack/src/partials/available.html b/packages/manager/modules/vrack/src/partials/available.html index 86be1e006268..2415f4ae34b3 100644 --- a/packages/manager/modules/vrack/src/partials/available.html +++ b/packages/manager/modules/vrack/src/partials/available.html @@ -29,7 +29,8 @@
'ovh-font ovh-font-ip': serviceType === 'ip', 'ovh-font ovh-font-server': serviceType === 'dedicatedServer' || serviceType === 'dedicatedServerInterface', 'ovh-font ovh-font-network': serviceType === 'dedicatedConnect', - 'ovh-font ovh-font-vRack': serviceType === 'legacyVrack'}" + 'ovh-font ovh-font-vRack': serviceType === 'legacyVrack', + 'oui-icon oui-icon-line-communicating_concept': serviceType === 'ovhCloudConnect'}" > @@ -96,6 +97,24 @@ +