From ebe67ffb61c69b4851c86d620722db5bd693b2fe Mon Sep 17 00:00:00 2001 From: Thibault Barske Date: Wed, 2 Oct 2024 21:04:26 +0200 Subject: [PATCH] feat(dedicated-cloud): add dashboard light when vcd and pcc is migrated ref: MANAGER-15242 Signed-off-by: Thibault Barske --- ...edicatedCloud-dashboard-light.component.js | 31 ++++++++++++ .../dedicatedCloud-dashboard-light.html | 12 +++++ .../dedicatedCloud-dashboard-light.scss | 3 ++ .../dedicated-cloud/dashboard-light/index.js | 12 +++++ .../dedicatedCloud-dashboard.component.js | 1 + .../dashboard/dedicatedCloud-dashboard.html | 1 + .../tiles/vmware-cloud-director/component.js | 1 + .../tiles/vmware-cloud-director/controller.js | 22 +++------ .../dedicatedCloud.component.js | 3 ++ .../dedicatedCloud.controller.js | 4 +- .../dedicated-cloud/dedicatedCloud.html | 6 ++- .../migration-banner/component.js | 3 ++ .../migration-banner/controller.js | 33 +++++-------- .../migration-banner/template.html | 10 +--- .../translations/Messages_fr_FR.json | 2 +- .../dedicatedCloudLight.module.js | 10 ++++ .../dedicatedCloudLight.routing.js | 22 +++++++++ .../dedicatedCloud-dashboard.module.js | 2 + .../details/dedicatedCloud.routing.js | 47 +++++++++++++++++-- .../dedicatedCloudLight.module.js | 10 ++++ .../dedicatedCloudLight.routing.js | 22 +++++++++ .../dashboard/dashboard.module.js | 2 + .../details/managed-baremetal.routing.js | 42 ++++++++++++++++- 23 files changed, 248 insertions(+), 53 deletions(-) create mode 100644 packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/dedicatedCloud-dashboard-light.component.js create mode 100644 packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/dedicatedCloud-dashboard-light.html create mode 100644 packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/dedicatedCloud-dashboard-light.scss create mode 100644 packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/index.js create mode 100644 packages/manager/apps/dedicated/client/app/dedicatedCloud/dashboard-light/dedicatedCloudLight.module.js create mode 100644 packages/manager/apps/dedicated/client/app/dedicatedCloud/dashboard-light/dedicatedCloudLight.routing.js create mode 100644 packages/manager/apps/dedicated/client/app/managedBaremetal/dashboard-light/dedicatedCloudLight.module.js create mode 100644 packages/manager/apps/dedicated/client/app/managedBaremetal/dashboard-light/dedicatedCloudLight.routing.js diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/dedicatedCloud-dashboard-light.component.js b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/dedicatedCloud-dashboard-light.component.js new file mode 100644 index 000000000000..f137ef6c51cf --- /dev/null +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/dedicatedCloud-dashboard-light.component.js @@ -0,0 +1,31 @@ +import template from './dedicatedCloud-dashboard-light.html'; + +export default { + bindings: { + currentDrp: '<', + currentUser: '<', + goToVpnConfiguration: '<', + pccType: '<', + isLv1Lv2BannerAvailable: '<', + productId: '<', + currentService: '<', + datacenterList: '<', + deleteDrp: '<', + disableVmwareOption: '<', + drpGlobalStatus: '<', + editDetails: '<', + goToDrp: '<', + goToDrpDatacenterSelection: '<', + isDrpActionPossible: '<', + onTerminate: '<', + onMlSubscribe: '<', + orderSecurityOption: '<', + orderVmwareOption: '<', + isMailingListSubscriptionAvailable: '<', + setMessage: '<', + onUpgradeVersion: '<', + associateIpBlockLink: '<', + onExecutionDateChange: '<', + }, + template, +}; diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/dedicatedCloud-dashboard-light.html b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/dedicatedCloud-dashboard-light.html new file mode 100644 index 000000000000..49ca0bab0549 --- /dev/null +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/dedicatedCloud-dashboard-light.html @@ -0,0 +1,12 @@ +
+
+ +
+
diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/dedicatedCloud-dashboard-light.scss b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/dedicatedCloud-dashboard-light.scss new file mode 100644 index 000000000000..ffbc85e8c49f --- /dev/null +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/dedicatedCloud-dashboard-light.scss @@ -0,0 +1,3 @@ +.oui-tile { + min-height: 19.5rem !important; +} diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/index.js b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/index.js new file mode 100644 index 000000000000..073e52b56fb2 --- /dev/null +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard-light/index.js @@ -0,0 +1,12 @@ +import generalInformation from '../dashboard/tiles/general-information'; +import component from './dedicatedCloud-dashboard-light.component'; +import './dedicatedCloud-dashboard-light.scss'; + +const moduleName = 'ovhManagerPccDashboardLight'; + +angular + .module(moduleName, [generalInformation]) + .component('pccDashboardLight', component) + .run(/* @ngTranslationsInject:json ./translations */); + +export default moduleName; diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/dedicatedCloud-dashboard.component.js b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/dedicatedCloud-dashboard.component.js index 5fc1e26a2fc1..29b154ae05f8 100644 --- a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/dedicatedCloud-dashboard.component.js +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/dedicatedCloud-dashboard.component.js @@ -35,6 +35,7 @@ export default { trackingPrefix: '<', dedicatedCloudDescription: '<', managedVCDAvailability: '<', + dedicatedCloudVCDMigrationState: '<', }, template, }; diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/dedicatedCloud-dashboard.html b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/dedicatedCloud-dashboard.html index 332cfb01cdae..18f7402596df 100644 --- a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/dedicatedCloud-dashboard.html +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/dedicatedCloud-dashboard.html @@ -82,6 +82,7 @@ data-tracking-prefix="$ctrl.trackingPrefix" data-go-to-vcd-order="$ctrl.goToVcdOrder" data-product-id="$ctrl.productId" + data-vcd-migration-state="$ctrl.dedicatedCloudVCDMigrationState" > diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/tiles/vmware-cloud-director/component.js b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/tiles/vmware-cloud-director/component.js index 624316d6aca2..20f7f5063cdf 100644 --- a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/tiles/vmware-cloud-director/component.js +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/tiles/vmware-cloud-director/component.js @@ -6,6 +6,7 @@ export default { goToVcdOrder: '<', productId: '<', trackingPrefix: '<', + vcdMigrationState: '<', }, name: 'ovhManagerPccDashboardVmwareCloudDirector', controller, diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/tiles/vmware-cloud-director/controller.js b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/tiles/vmware-cloud-director/controller.js index 81876e81f745..ded36b3e8911 100644 --- a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/tiles/vmware-cloud-director/controller.js +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dashboard/tiles/vmware-cloud-director/controller.js @@ -8,7 +8,7 @@ export default class { $onInit() { this.guideLinks = this.DedicatedCloud.getVCDGuideLinks(); - this.checkMigration(); + this.defineMigrationTitle(); } trackGuideClick(guideName) { @@ -18,19 +18,11 @@ export default class { }); } - checkMigration() { - this.loading = true; - return this.DedicatedCloud.getManagedVCDMigrationState(this.productId) - .then((state) => { - this.vcdMigrationState = state; - this.migrationTitle = this.$translate.instant( - this.vcdMigrationState.isDone - ? 'dedicatedCloud_vmware_cloud_director_migration' - : 'dedicatedCloud_vmware_cloud_director_validate_migration', - ); - }) - .finally(() => { - this.loading = false; - }); + defineMigrationTitle() { + this.migrationTitle = this.$translate.instant( + this.vcdMigrationState.isDone + ? 'dedicatedCloud_vmware_cloud_director_migration' + : 'dedicatedCloud_vmware_cloud_director_validate_migration', + ); } } diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dedicatedCloud.component.js b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dedicatedCloud.component.js index 8cebb5990b8f..962e0ea0bf64 100644 --- a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dedicatedCloud.component.js +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dedicatedCloud.component.js @@ -13,6 +13,9 @@ export default { securityState: '<', setMessage: '<', usersState: '<', + dedicatedCloudVCDMigrationState: '<', + dedicatedCloudPCCMigrationState: '<', + dedicatedCloudMigrationState: '<', }, controller, template, diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dedicatedCloud.controller.js b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dedicatedCloud.controller.js index 4fc61ea1de35..d67ec0e2ee23 100644 --- a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dedicatedCloud.controller.js +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dedicatedCloud.controller.js @@ -2,10 +2,12 @@ import { TRACKING_PREFIX } from './dedicatedCloud.constant'; export default class { /* @ngInject */ - constructor($scope, $translate) { + constructor($scope, $translate, $location) { this.$scope = $scope; this.$translate = $translate; this.TRACKING_PREFIX = TRACKING_PREFIX; + this.$location = $location; + this.isTabsHidden = this.dedicatedCloudMigrationState; } $onInit() { diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dedicatedCloud.html b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dedicatedCloud.html index fd6c23284c6a..f015615002e1 100644 --- a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dedicatedCloud.html +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dedicatedCloud.html @@ -33,9 +33,11 @@ - - + diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/component.js b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/component.js index 9319e5f29ef0..9c0c4fa3069d 100644 --- a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/component.js +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/component.js @@ -5,6 +5,9 @@ export default { bindings: { serviceName: '<', trackingPrefix: '<', + pccMigrationState: '<', + vcdMigrationState: '<', + migrationState: '<', }, controller, template, diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/controller.js b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/controller.js index 18f9171bc165..978f38423aaa 100644 --- a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/controller.js +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/controller.js @@ -6,7 +6,7 @@ export default class ManagedVcdMigrationBannerCtrl { } $onInit() { - this.loadMigrationState(); + this.trackMigrationState(); } trackPage(name) { @@ -15,26 +15,17 @@ export default class ManagedVcdMigrationBannerCtrl { }); } - loadMigrationState() { - this.migrationState = null; + trackMigrationState() { + if (this.pccMigrationState?.isEnabling) { + this.trackPage( + 'vmware::vmware::banner-info::migrate_to_managed_vcd_pending', + ); + } - this.DedicatedCloud.getPCCMigrationState(this.serviceName).then((state) => { - this.migrationState = state; - if (state.isEnabling) { - this.trackPage( - 'vmware::vmware::banner-info::migrate_to_managed_vcd_pending', - ); - } - }); - - this.DedicatedCloud.getManagedVCDMigrationState(this.serviceName).then( - (state) => { - if (state.isDone) { - this.trackPage( - 'vmware::vmware::banner-info::migrate_to_managed_vcd_success', - ); - } - }, - ); + if (this.vcdMigrationState?.isDone) { + this.trackPage( + 'vmware::vmware::banner-info::migrate_to_managed_vcd_success', + ); + } } } diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/template.html b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/template.html index 04a015b73ae8..2585a7dfbf25 100644 --- a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/template.html +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/template.html @@ -1,9 +1,3 @@ - - + + diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/translations/Messages_fr_FR.json b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/translations/Messages_fr_FR.json index 6b172cecf6b9..086ce0945901 100644 --- a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/translations/Messages_fr_FR.json +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/vmware-cloud-director/migration-banner/translations/Messages_fr_FR.json @@ -1,3 +1,3 @@ { - "dedicatedCloud_managed_vcd_migration_pending_warning": "Attention migration en cours : les modifications de votre service ne seront pas prises en compte" + "dedicatedCloud_managed_vcd_migrated": "Votre solution Hosted Private Cloud a été migrée vers VMware Cloud Director. Cette page vous permet de gérer vos blocs d'IP publiques (commande d'un nouveau bloc, réattribution d'un bloc existant vers un autre service) qui sont actuellement attachés à votre service Hosted Private Cloud et connectés à votre service VMware Cloud Director. Cette situation est temporaire et prendra fin lorsque vos blocs d'IP publiques auront été attachés automatiquement à votre service VMware Cloud Director." } diff --git a/packages/manager/apps/dedicated/client/app/dedicatedCloud/dashboard-light/dedicatedCloudLight.module.js b/packages/manager/apps/dedicated/client/app/dedicatedCloud/dashboard-light/dedicatedCloudLight.module.js new file mode 100644 index 000000000000..89c5a684d33b --- /dev/null +++ b/packages/manager/apps/dedicated/client/app/dedicatedCloud/dashboard-light/dedicatedCloudLight.module.js @@ -0,0 +1,10 @@ +import angular from 'angular'; + +import dashboardLightModule from '../../components/dedicated-cloud/dashboard-light'; +import routing from './dedicatedCloudLight.routing'; + +const moduleName = 'ovhManagerDedicatedCloudLightModule'; + +angular.module(moduleName, [dashboardLightModule]).config(routing); + +export default moduleName; diff --git a/packages/manager/apps/dedicated/client/app/dedicatedCloud/dashboard-light/dedicatedCloudLight.routing.js b/packages/manager/apps/dedicated/client/app/dedicatedCloud/dashboard-light/dedicatedCloudLight.routing.js new file mode 100644 index 000000000000..c83d31eb5eff --- /dev/null +++ b/packages/manager/apps/dedicated/client/app/dedicatedCloud/dashboard-light/dedicatedCloudLight.routing.js @@ -0,0 +1,22 @@ +export default /* @ngInject */ ($stateProvider) => { + $stateProvider.state('app.dedicatedCloud.details.dashboard.light', { + url: '/tag/migration-vcd', + redirectTo: (transition) => { + return transition + .injector() + .getAsync('dedicatedCloudMigrationState') + .then((dedicatedCloudMigrationState) => { + if (!dedicatedCloudMigrationState) { + return 'app.dedicatedCloud.details.dashboard'; + } + + return false; + }); + }, + resolve: { + breadcrumb: () => null, + }, + reloadOnSearch: false, + component: 'pccDashboardLight', + }); +}; diff --git a/packages/manager/apps/dedicated/client/app/dedicatedCloud/dashboard/dedicatedCloud-dashboard.module.js b/packages/manager/apps/dedicated/client/app/dedicatedCloud/dashboard/dedicatedCloud-dashboard.module.js index d8d8487c1a6c..d4078df7999a 100644 --- a/packages/manager/apps/dedicated/client/app/dedicatedCloud/dashboard/dedicatedCloud-dashboard.module.js +++ b/packages/manager/apps/dedicated/client/app/dedicatedCloud/dashboard/dedicatedCloud-dashboard.module.js @@ -13,6 +13,7 @@ import update from './update'; import vmwareOptionDisable from './vmware-option/disable'; import vmwareOptionOrder from './vmware-option/order'; import vcdOrder from './vmware-cloud-director/order'; +import dedicatedCloudDashboardLightModule from '../dashboard-light/dedicatedCloudLight.module'; const moduleName = 'dedicatedCloudDashboardModule'; @@ -30,6 +31,7 @@ angular vmwareOptionDisable, vmwareOptionOrder, vcdOrder, + dedicatedCloudDashboardLightModule, ]) .config(routing); diff --git a/packages/manager/apps/dedicated/client/app/dedicatedCloud/details/dedicatedCloud.routing.js b/packages/manager/apps/dedicated/client/app/dedicatedCloud/details/dedicatedCloud.routing.js index 4e525e7265d2..9497f96e43fa 100644 --- a/packages/manager/apps/dedicated/client/app/dedicatedCloud/details/dedicatedCloud.routing.js +++ b/packages/manager/apps/dedicated/client/app/dedicatedCloud/details/dedicatedCloud.routing.js @@ -26,7 +26,20 @@ export default /* @ngInject */ ($stateProvider) => { }, }; } - return 'app.dedicatedCloud.details.dashboard'; + + return transition + .injector() + .getAsync('dedicatedCloudMigrationState') + .then((dedicatedCloudMigrationState) => { + if (dedicatedCloudMigrationState) { + return { + state: 'app.dedicatedCloud.details.dashboard.light', + }; + } + + return 'app.dedicatedCloud.details.dashboard'; + }) + .catch(() => 'app.dedicatedCloud.details.dashboard'); }, resolve: { currentService: /* @ngInject */ (DedicatedCloud, productId) => @@ -99,7 +112,6 @@ export default /* @ngInject */ ($stateProvider) => { .then((featureAvailability) => featureAvailability.isFeatureAvailable('hpc-vmware-managed-vcd'), ), - dedicatedCloudServiceInfos: /* @ngInject */ ( $stateParams, OvhApiDedicatedCloud, @@ -107,7 +119,35 @@ export default /* @ngInject */ ($stateProvider) => { OvhApiDedicatedCloud.v6().getServiceInfos({ serviceName: $stateParams.productId, }), - + dedicatedCloudVCDMigrationState: /* @ngInject */ ( + DedicatedCloud, + $stateParams, + managedVCDAvailability, + ) => { + if (!managedVCDAvailability) return null; + return DedicatedCloud.getManagedVCDMigrationState( + $stateParams.productId, + ).catch(() => null); + }, + dedicatedCloudPCCMigrationState: /* @ngInject */ ( + DedicatedCloud, + $stateParams, + managedVCDAvailability, + ) => { + if (!managedVCDAvailability) return null; + return DedicatedCloud.getPCCMigrationState( + $stateParams.productId, + ).catch(() => null); + }, + dedicatedCloudMigrationState: /* @ngInject */ ( + dedicatedCloudVCDMigrationState, + dedicatedCloudPCCMigrationState, + ) => { + return !!( + dedicatedCloudVCDMigrationState?.isDone || + dedicatedCloudPCCMigrationState?.isEnabling + ); + }, drpAvailability: /* @ngInject */ (ovhFeatureFlipping) => ovhFeatureFlipping .checkFeatureAvailability('dedicated-cloud:drp') @@ -284,7 +324,6 @@ export default /* @ngInject */ ($stateProvider) => { ) => { Alerter.set(`alert-${type}`, message, null, 'dedicatedCloud'); }, - trackingPrefix: () => 'dedicated::dedicatedClouds', usesLegacyOrder: /* @ngInject */ (currentService) => currentService.usesLegacyOrder, newProductUrl: /* @ngInject */ (ovhFeatureFlipping, coreConfig) => diff --git a/packages/manager/apps/dedicated/client/app/managedBaremetal/dashboard-light/dedicatedCloudLight.module.js b/packages/manager/apps/dedicated/client/app/managedBaremetal/dashboard-light/dedicatedCloudLight.module.js new file mode 100644 index 000000000000..a1fd99442ee4 --- /dev/null +++ b/packages/manager/apps/dedicated/client/app/managedBaremetal/dashboard-light/dedicatedCloudLight.module.js @@ -0,0 +1,10 @@ +import angular from 'angular'; + +import dashboardLightModule from '../../components/dedicated-cloud/dashboard-light'; +import routing from './dedicatedCloudLight.routing'; + +const moduleName = 'ovhManagerManagedBaremetalLightModule'; + +angular.module(moduleName, [dashboardLightModule]).config(routing); + +export default moduleName; diff --git a/packages/manager/apps/dedicated/client/app/managedBaremetal/dashboard-light/dedicatedCloudLight.routing.js b/packages/manager/apps/dedicated/client/app/managedBaremetal/dashboard-light/dedicatedCloudLight.routing.js new file mode 100644 index 000000000000..450824a7d436 --- /dev/null +++ b/packages/manager/apps/dedicated/client/app/managedBaremetal/dashboard-light/dedicatedCloudLight.routing.js @@ -0,0 +1,22 @@ +export default /* @ngInject */ ($stateProvider) => { + $stateProvider.state('app.managedBaremetal.details.dashboard.light', { + url: '/tag/migration-vcd', + redirectTo: (transition) => { + return transition + .injector() + .getAsync('dedicatedCloudMigrationState') + .then((dedicatedCloudMigrationState) => { + if (!dedicatedCloudMigrationState) { + return 'app.managedBaremetal.details.dashboard'; + } + + return false; + }); + }, + resolve: { + breadcrumb: () => null, + }, + reloadOnSearch: false, + component: 'pccDashboardLight', + }); +}; diff --git a/packages/manager/apps/dedicated/client/app/managedBaremetal/dashboard/dashboard.module.js b/packages/manager/apps/dedicated/client/app/managedBaremetal/dashboard/dashboard.module.js index d682e2446eca..c0dd53a7fc42 100644 --- a/packages/manager/apps/dedicated/client/app/managedBaremetal/dashboard/dashboard.module.js +++ b/packages/manager/apps/dedicated/client/app/managedBaremetal/dashboard/dashboard.module.js @@ -13,6 +13,7 @@ import update from './update'; import vmwareOptionDisable from './vmware-option/disable'; import vmwareOptionOrder from './vmware-option/order'; import vcdOrder from './vmware-cloud-director/order'; +import dashboardLight from '../dashboard-light/dedicatedCloudLight.module'; const moduleName = 'managedBaremetalDashboardModule'; @@ -30,6 +31,7 @@ angular vmwareOptionDisable, vmwareOptionOrder, vcdOrder, + dashboardLight, ]) .config(routing); diff --git a/packages/manager/apps/dedicated/client/app/managedBaremetal/details/managed-baremetal.routing.js b/packages/manager/apps/dedicated/client/app/managedBaremetal/details/managed-baremetal.routing.js index 335ae4aa1a43..d71397842928 100644 --- a/packages/manager/apps/dedicated/client/app/managedBaremetal/details/managed-baremetal.routing.js +++ b/packages/manager/apps/dedicated/client/app/managedBaremetal/details/managed-baremetal.routing.js @@ -24,7 +24,20 @@ export default /* @ngInject */ ($stateProvider) => { }, }; } - return 'app.managedBaremetal.details.dashboard'; + + return transition + .injector() + .getAsync('dedicatedCloudMigrationState') + .then((dedicatedCloudMigrationState) => { + if (dedicatedCloudMigrationState) { + return { + state: 'app.managedBaremetal.details.dashboard.light', + }; + } + + return 'app.managedBaremetal.details.dashboard'; + }) + .catch(() => 'app.managedBaremetal.details.dashboard'); }, resolve: { currentService: /* @ngInject */ (DedicatedCloud, productId) => @@ -284,6 +297,33 @@ export default /* @ngInject */ ($stateProvider) => { trackingPrefix: () => 'dedicated::managedBaremetal', usesLegacyOrder: /* @ngInject */ (currentService) => currentService.usesLegacyOrder, + dedicatedCloudVCDMigrationState: /* @ngInject */ ( + DedicatedCloud, + $stateParams, + managedVCDAvailability, + ) => { + if (!managedVCDAvailability) return null; + return DedicatedCloud.getManagedVCDMigrationState( + $stateParams.productId, + ).catch(() => null); + }, + dedicatedCloudPCCMigrationState: /* @ngInject */ ( + DedicatedCloud, + productId, + managedVCDAvailability, + ) => { + if (!managedVCDAvailability) return null; + return DedicatedCloud.getPCCMigrationState(productId).catch(() => null); + }, + dedicatedCloudMigrationState: /* @ngInject */ ( + dedicatedCloudVCDMigrationState, + dedicatedCloudPCCMigrationState, + ) => { + return !!( + dedicatedCloudVCDMigrationState?.isDone || + dedicatedCloudPCCMigrationState?.isEnabling + ); + }, breadcrumb: /* @ngInject */ (productId) => productId, }, views: {