Skip to content

Commit d17556c

Browse files
Cyrille Bourgoisjleveugle
authored andcommitted
fix(server-sidebar): update regions config
1 parent b59ae14 commit d17556c

File tree

4 files changed

+74
-40
lines changed

4 files changed

+74
-40
lines changed

packages/manager/modules/server-sidebar/src/controller.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export default class OvhManagerServerSidebarController {
5454
this.SIDEBAR_CONFIG = SIDEBAR_CONFIG;
5555
this.SIDEBAR_ORDER_CONFIG = SIDEBAR_ORDER_CONFIG;
5656

57-
5857
if (this.universe === 'DEDICATED' && find(universes, { universe: this.universe.toLowerCase() })) {
5958
this.SIDEBAR_CONFIG = DEDICATED_SIDEBAR_CONFIG;
6059
this.SIDEBAR_ORDER_CONFIG = DEDICATED_ORDER_SIDEBAR_CONFIG;
@@ -144,7 +143,7 @@ export default class OvhManagerServerSidebarController {
144143
}
145144

146145
addItems(services, parent = null) {
147-
each(services, (service) => {
146+
each(this.filterRegions(services), (service) => {
148147
if (!this.SidebarMenu.getItemById(service.id)) {
149148
const hasSubItems = has(service, 'types') || has(service, 'children');
150149
const isExternal = !includes(service.app, this.universe);
@@ -155,7 +154,6 @@ export default class OvhManagerServerSidebarController {
155154
link = get(MANAGER_URLS, [this.coreConfig.getRegion(), service.app[0], 'FR']);
156155
link += service.stateUrl;
157156
}
158-
159157
const menuItem = this.SidebarMenu.addMenuItem({
160158
id: service.id,
161159
name: service.id,
@@ -199,14 +197,25 @@ export default class OvhManagerServerSidebarController {
199197
stateParams = typeServices.type.stateParamsTransformer(stateParams);
200198
}
201199

200+
let link = null;
201+
let state = null;
202+
if (isExternal) {
203+
link = service.url;
204+
} else {
205+
state = get(typeServices.type, 'state');
206+
if (has(typeServices.type, 'getState') && isFunction(typeServices.type.getState)) {
207+
state = typeServices.type.getState(service.extraParams);
208+
}
209+
}
210+
202211
const menuItem = this.SidebarMenu.addMenuItem({
203212
title: service.displayName,
204213
allowSubItems: hasSubItems && !isExternal,
205214
infiniteScroll: hasSubItems && !isExternal,
206215
allowSearch: false,
207-
state: isExternal ? null : get(typeServices.type, 'state'),
216+
state,
208217
stateParams,
209-
url: isExternal ? service.url : null,
218+
url: link,
210219
target: isExternal ? '_self' : null,
211220
icon: get(typeServices.type, 'icon'),
212221
loadOnState: get(typeServices.type, 'loadOnState'),

packages/manager/modules/server-sidebar/src/dedicated.constants.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const DEDICATED_SERVER_CONFIG = {
2121
],
2222
icon: 'ovh-font ovh-font-server',
2323
app: [DEDICATED],
24+
regions: ['EU', 'CA', 'US'],
2425
};
2526

2627
export const DEDICATED_CLOUD_CONFIG = {
@@ -48,6 +49,7 @@ export const DEDICATED_CLOUD_CONFIG = {
4849
loadOnState: 'app.dedicatedClouds',
4950
icon: 'ovh-font ovh-font-dedicatedCloud',
5051
app: [DEDICATED],
52+
regions: ['EU', 'CA', 'US'],
5153
};
5254

5355
export const NETWORKS_CONFIG = {
@@ -64,6 +66,7 @@ export const NETWORKS_CONFIG = {
6466
'domain',
6567
],
6668
app: [DEDICATED],
69+
regions: ['EU'],
6770
},
6871
],
6972
state: 'app.networks.cdn.dedicated',
@@ -78,7 +81,7 @@ export const NETWORKS_CONFIG = {
7881
stateParams: ['nasId'],
7982
icon: 'ovh-font ovh-font-cloudnas',
8083
app: [DEDICATED],
81-
regions: ['EU'],
84+
regions: ['EU', 'CA'],
8285
},
8386
{
8487
path: '/dedicated/nasha',
@@ -91,11 +94,13 @@ export const NETWORKS_CONFIG = {
9194
}),
9295
icon: 'ovh-font ovh-font-cloudnas',
9396
app: [DEDICATED],
97+
regions: ['EU', 'CA'],
9498
},
9599
],
96100
loadOnState: 'app.networks',
97101
icon: 'ovh-font ovh-font-network',
98102
app: [DEDICATED],
103+
regions: ['EU', 'CA'],
99104
};
100105

101106
export const OLD_MICROSOFT_CONFIG = {
@@ -188,6 +193,7 @@ export const DEDICATED_ORDER_SIDEBAR_CONFIG = [
188193
icon: 'ovh-font ovh-font-public-cloud',
189194
linkId: 'cloudProjectOrder',
190195
app: [DEDICATED],
196+
regions: ['EU', 'CA', 'US'],
191197
},
192198
{
193199
id: 'order-nas',
@@ -205,22 +211,23 @@ export const DEDICATED_ORDER_SIDEBAR_CONFIG = [
205211
linkId: 'dedicatedOrder',
206212
target: '_blank',
207213
app: [DEDICATED],
214+
regions: ['EU', 'CA', 'US'],
208215
},
209216
{
210217
id: 'order-vrack',
211218
title: 'vrack',
212219
icon: 'ovh-font ovh-font-vRack',
213220
linkId: 'vrackOrder',
214221
target: '_blank',
215-
regions: ['US'],
216222
app: [DEDICATED],
223+
regions: ['EU', 'CA', 'US'],
217224
},
218225
{
219226
id: 'order-additional-ip',
220227
title: 'ip',
221228
icon: 'ovh-font ovh-font-ip',
222229
state: 'app.ip.agora-order',
223-
regions: ['US'],
230+
regions: ['EU', 'CA', 'US'],
224231
app: [DEDICATED],
225232
},
226233
{
@@ -229,6 +236,7 @@ export const DEDICATED_ORDER_SIDEBAR_CONFIG = [
229236
icon: 'ovh-font ovh-font-certificate',
230237
state: 'app.license.order',
231238
app: [DEDICATED],
239+
regions: ['EU', 'CA', 'US'],
232240
},
233241
];
234242

packages/manager/modules/server-sidebar/src/order.constants.js

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,6 @@ export const ORDER_URLS = {
263263
dedicatedOrder: {
264264
US: 'https://us.ovhcloud.com/order/dedicated/#/dedicated/select',
265265
},
266-
vrackOrder: {
267-
US: 'https://us.ovhcloud.com/order/express/#/express/review?products=~(~(planCode~\'vrack~quantity~1~productId~\'vrack))',
268-
},
269266
cloudProjectOrder: {
270267
US: 'https://us.ovhcloud.com/manager/cloud/#/iaas/pci/offer',
271268
},
@@ -287,6 +284,7 @@ export const SIDEBAR_ORDER_CONFIG = [
287284
icon: 'ovh-font ovh-font-public-cloud',
288285
linkId: 'publicCloudProjectOrder',
289286
app: [DEDICATED],
287+
regions: ['EU', 'CA', 'US'],
290288
},
291289
{
292290
id: 'order-nas',
@@ -295,25 +293,18 @@ export const SIDEBAR_ORDER_CONFIG = [
295293
state: 'app.networks.nas.order', // TODO: SHOULD BE A LINK DEDICATED #/configuration/nas
296294
linkId: 'DEDICATED',
297295
linkPart: '#/configuration/nas',
298-
regions: ['EU'],
299296
app: [DEDICATED],
297+
regions: ['EU'],
300298
},
301299
{
302300
id: 'order-dedicated-server',
303301
title: 'dedicated_server',
304302
icon: 'ovh-font ovh-font-server',
305303
linkId: 'dedicatedOrder',
306304
target: '_blank',
305+
external: true,
307306
app: [DEDICATED],
308-
},
309-
{
310-
id: 'order-vrack',
311-
title: 'vrack',
312-
icon: 'ovh-font ovh-font-vRack',
313-
linkId: 'vrackOrder',
314-
target: '_blank',
315-
regions: ['US'],
316-
app: [DEDICATED],
307+
regions: ['EU', 'CA', 'US'],
317308
},
318309
{
319310
id: 'order-additional-ip',
@@ -322,8 +313,8 @@ export const SIDEBAR_ORDER_CONFIG = [
322313
state: 'app.ip.agora-order',
323314
linkId: 'DEDICATED',
324315
linkPart: '#/configuration/ip?landingTo=ip&tab=ip',
325-
regions: ['EU', 'CA'],
326316
app: [DEDICATED],
317+
regions: ['EU', 'CA', 'US'],
327318
},
328319
{
329320
id: 'order-license',
@@ -333,6 +324,7 @@ export const SIDEBAR_ORDER_CONFIG = [
333324
linkId: 'DEDICATED',
334325
linkPart: '#/configuration/license/order',
335326
app: [DEDICATED],
327+
regions: ['EU', 'CA', 'US'],
336328
},
337329

338330
// CLOUD
@@ -343,7 +335,6 @@ export const SIDEBAR_ORDER_CONFIG = [
343335
linkId: 'publicCloudKubernetes',
344336
target: '_blank',
345337
external: true,
346-
featureType: 'KUBE',
347338
app: [CLOUD],
348339
regions: ['EU'],
349340
},
@@ -354,8 +345,8 @@ export const SIDEBAR_ORDER_CONFIG = [
354345
linkId: 'vps',
355346
target: '_blank',
356347
external: true,
357-
featureTupe: 'VPS',
358348
app: [CLOUD],
349+
regions: ['EU', 'CA'],
359350
},
360351
{
361352
id: 'order-private-cloud',
@@ -364,8 +355,8 @@ export const SIDEBAR_ORDER_CONFIG = [
364355
linkId: 'dedicated_cloud',
365356
target: '_blank',
366357
external: true,
367-
featureType: 'DEDICATED_CLOUD',
368358
app: [CLOUD],
359+
regions: ['EU', 'CA'],
369360
},
370361
{
371362
id: 'order-cda',
@@ -374,8 +365,8 @@ export const SIDEBAR_ORDER_CONFIG = [
374365
linkId: 'cloud_disk_array',
375366
target: '_blank',
376367
external: true,
377-
featureType: 'CEPH',
378368
app: [CLOUD],
369+
regions: ['EU', 'CA'],
379370
},
380371
{
381372
id: 'order-nasha',
@@ -384,8 +375,8 @@ export const SIDEBAR_ORDER_CONFIG = [
384375
state: 'paas.nasha-add',
385376
linkId: 'CLOUD',
386377
linkPart: '#/paas/nasha/new',
387-
featureType: 'NASHA',
388378
app: [CLOUD],
379+
regions: ['EU', 'CA'],
389380
},
390381
{
391382
id: 'order-veeam',
@@ -394,8 +385,8 @@ export const SIDEBAR_ORDER_CONFIG = [
394385
linkId: 'veeam',
395386
target: '_blank',
396387
external: true,
397-
featureType: 'VEEAM',
398388
app: [CLOUD],
389+
regions: ['EU'],
399390
},
400391
{
401392
id: 'order-veeam-enterprise',
@@ -404,8 +395,8 @@ export const SIDEBAR_ORDER_CONFIG = [
404395
linkId: 'veeam_enterprise',
405396
target: '_blank',
406397
external: true,
407-
featureType: 'VEEAM_ENTERPRISE',
408398
app: [CLOUD],
399+
regions: ['EU', 'CA'],
409400
},
410401
{
411402
id: 'order-metrics',
@@ -414,8 +405,8 @@ export const SIDEBAR_ORDER_CONFIG = [
414405
linkId: 'dbaas',
415406
target: '_blank',
416407
external: true,
417-
featureType: 'METRICS',
418408
app: [CLOUD],
409+
regions: ['EU'],
419410
},
420411
{
421412
id: 'order-vrack',
@@ -424,8 +415,8 @@ export const SIDEBAR_ORDER_CONFIG = [
424415
linkId: 'vrack',
425416
target: '_blank',
426417
external: true,
427-
featureType: 'VRACK',
428-
app: [CLOUD],
418+
app: [DEDICATED],
419+
regions: ['EU', 'CA', 'US'],
429420
},
430421
{
431422
id: 'order-cloud-desktop',
@@ -434,8 +425,8 @@ export const SIDEBAR_ORDER_CONFIG = [
434425
linkId: 'cloud_desktop',
435426
target: '_blank',
436427
external: true,
437-
featureType: 'CLOUD_DESKTOP',
438428
app: [CLOUD],
429+
regions: ['EU', 'CA'],
439430
},
440431
{
441432
id: 'order-loadbalancer',
@@ -444,8 +435,8 @@ export const SIDEBAR_ORDER_CONFIG = [
444435
linkId: 'load_balancer',
445436
target: '_blank',
446437
external: true,
447-
featureType: 'LOAD_BALANCER',
448438
app: [CLOUD],
439+
regions: ['EU'],
449440
},
450441
{
451442
id: 'order-clouddb',
@@ -454,8 +445,8 @@ export const SIDEBAR_ORDER_CONFIG = [
454445
linkId: 'orderSql',
455446
target: '_blank',
456447
external: true,
457-
featureType: 'CLOUD_DB',
458448
app: [CLOUD],
449+
regions: [],
459450
},
460451
{
461452
id: 'order-logs',
@@ -464,8 +455,8 @@ export const SIDEBAR_ORDER_CONFIG = [
464455
state: 'dbaas.logs.welcome',
465456
linkId: 'CLOUD',
466457
linkPart: '#/dbaas/logs/welcome',
467-
featureType: 'DBAAS_LOGS',
468458
app: [CLOUD],
459+
regions: ['EU', 'CA'],
469460
},
470461
];
471462

0 commit comments

Comments
 (0)