From 80b6566ed74a4e7694132df1e95e9986c82a44aa Mon Sep 17 00:00:00 2001 From: Cyrille Bourgois Date: Wed, 13 Jul 2022 15:45:21 +0200 Subject: [PATCH] refactor(hub): remove common manager's features ref: MANAGER-9201 Signed-off-by: Cyrille Bourgois --- packages/manager/apps/hub/package.json | 9 +------ packages/manager/apps/hub/src/app.module.js | 28 +-------------------- packages/manager/apps/hub/src/controller.js | 26 ------------------- packages/manager/apps/hub/src/index.html | 19 -------------- packages/manager/apps/hub/src/index.js | 12 +-------- 5 files changed, 3 insertions(+), 91 deletions(-) diff --git a/packages/manager/apps/hub/package.json b/packages/manager/apps/hub/package.json index ff93f4504adf..3df54f9a38b7 100644 --- a/packages/manager/apps/hub/package.json +++ b/packages/manager/apps/hub/package.json @@ -19,20 +19,15 @@ "start:watch": "lerna exec --stream --parallel --scope='@ovh-ux/manager-hub-app' --include-dependencies -- npm run dev:watch --if-present" }, "dependencies": { - "@ovh-ux/manager-account-sidebar": "^2.0.0 || ^3.0.0", "@ovh-ux/manager-at-internet-configuration": "^1.0.0 || ^2.0.0", "@ovh-ux/manager-banner": "^1.1.3", "@ovh-ux/manager-billing-components": "^2.0.0 || ^3.0.0", "@ovh-ux/manager-config": "^5.0.0 || ^6.0.0", - "@ovh-ux/manager-cookie-policy": "^0.0.0 || ^1.0.0", "@ovh-ux/manager-core": "^12.0.0 || ^13.0.0", "@ovh-ux/manager-error-page": "^1.3.0 || ^2.0.0", "@ovh-ux/manager-hub": "^2.0.0 || ^3.0.0", "@ovh-ux/manager-models": "^1.0.0", - "@ovh-ux/manager-navbar": "^4.0.0 || ^5.0.0", "@ovh-ux/manager-ng-layout-helpers": "^2.0.0", - "@ovh-ux/manager-notifications-sidebar": "^0.0.0 || ^1.0.0", - "@ovh-ux/manager-preloader": "^1.0.0", "@ovh-ux/manager-trusted-nic": "^0.0.0 || ^1.0.0", "@ovh-ux/ng-at-internet": "^5.9.1", "@ovh-ux/ng-at-internet-ui-router-plugin": "^3.2.1", @@ -45,14 +40,12 @@ "@ovh-ux/ng-ovh-proxy-request": "^2.0.4", "@ovh-ux/ng-ovh-request-tagger": "^1.1.0", "@ovh-ux/ng-ovh-sso-auth": "^4.6.1", - "@ovh-ux/ng-ovh-sso-auth-modal-plugin": "^4.1.1", "@ovh-ux/ng-ovh-swimming-poll": "^5.0.5", "@ovh-ux/ng-ovh-user-pref": "^2.0.4", "@ovh-ux/ng-shell-tracking": "^0.1.1", "@ovh-ux/ng-translate-async-loader": "^2.1.4", "@ovh-ux/ng-ui-router-breadcrumb": "^1.1.6", "@ovh-ux/ng-ui-router-layout": "^4.1.0", - "@ovh-ux/ng-ui-router-line-progress": "^1.2.7", "@ovh-ux/shell": "^0.0.0 || ^1.0.0", "@ovh-ux/ufrontend": "^1.1.1 || ^2.0.0", "@ovh-ux/ui-kit": "^6.1.0", @@ -95,4 +88,4 @@ "EU", "US" ] -} \ No newline at end of file +} diff --git a/packages/manager/apps/hub/src/app.module.js b/packages/manager/apps/hub/src/app.module.js index 5a27ad8f78de..714f470f4912 100644 --- a/packages/manager/apps/hub/src/app.module.js +++ b/packages/manager/apps/hub/src/app.module.js @@ -6,24 +6,17 @@ import 'angular-animate'; import 'angular-translate'; import '@ovh-ux/ng-at-internet'; import uiRouter, { RejectType } from '@uirouter/angularjs'; -import ngOvhUiRouterLineProgress from '@ovh-ux/ng-ui-router-line-progress'; import ngUiRouterBreadcrumb from '@ovh-ux/ng-ui-router-breadcrumb'; -import ovhManagerCookiePolicy from '@ovh-ux/manager-cookie-policy'; import { isString, get, has } from 'lodash-es'; import '@ovh-ux/ui-kit'; import ovhManagerBanner from '@ovh-ux/manager-banner'; import ngOvhFeatureFlipping from '@ovh-ux/ng-ovh-feature-flipping'; -import ovhManagerAccountSidebar from '@ovh-ux/manager-account-sidebar'; import { registerCoreModule } from '@ovh-ux/manager-core'; import ovhManagerHub from '@ovh-ux/manager-hub'; -import ovhManagerNavbar from '@ovh-ux/manager-navbar'; import ovhManagerOrderTracking from '@ovh-ux/ng-ovh-order-tracking'; -import ngOvhSsoAuthModalPlugin from '@ovh-ux/ng-ovh-sso-auth-modal-plugin'; import ngOvhPaymentMethod from '@ovh-ux/ng-ovh-payment-method'; -import { detach as detachPreloader } from '@ovh-ux/manager-preloader'; -import ovhNotificationsSidebar from '@ovh-ux/manager-notifications-sidebar'; import { isTopLevelApplication } from '@ovh-ux/manager-config'; import { initHubAtInternet } from './components/at-internet'; @@ -69,22 +62,16 @@ export default async (containerEl, shellClient) => { errorPage, 'ngAnimate', ngOvhFeatureFlipping, - ngOvhSsoAuthModalPlugin, - isTopLevelApplication() ? ngOvhUiRouterLineProgress : null, ngUiRouterBreadcrumb, 'oui', - ovhManagerAccountSidebar, registerCoreModule(environment, coreCallbacks), ovhManagerHub, - ovhManagerNavbar, ovhManagerOrderTracking, - ovhNotificationsSidebar, ovhManagerBanner, ngOvhPaymentMethod, 'pascalprecht.translate', 'ui.bootstrap', uiRouter, - isTopLevelApplication() ? ovhManagerCookiePolicy : null, ...get(__NG_APP_INJECTIONS__, environment.getRegion(), []), ].filter(isString), ) @@ -111,16 +98,6 @@ export default async (containerEl, shellClient) => { ovhPaymentMethodProvider.setUserLocale(locale); }, ) - .config( - /* @ngInject */ (ssoAuthModalPluginFctProvider) => { - ssoAuthModalPluginFctProvider.setOnLogout(() => { - shellClient.auth.logout(); - }); - ssoAuthModalPluginFctProvider.setOnReload(() => { - shellClient.navigation.reload(); - }); - }, - ) .config( /* @ngInject */ (ssoAuthenticationProvider) => { ssoAuthenticationProvider.setOnLogin(() => { @@ -133,7 +110,6 @@ export default async (containerEl, shellClient) => { ) .run( /* @ngInject */ ($transitions) => { - // replace ngOvhUiRouterLineProgress if in container if (!isTopLevelApplication()) { $transitions.onBefore({}, (transition) => { if ( @@ -212,9 +188,7 @@ export default async (containerEl, shellClient) => { .run( /* @ngInject */ ($rootScope, $transitions) => { const unregisterHook = $transitions.onSuccess({}, () => { - if (isTopLevelApplication()) { - detachPreloader(); - } else { + if (!isTopLevelApplication()) { shellClient.ux.hidePreloader(); } $rootScope.$broadcast('app:started'); diff --git a/packages/manager/apps/hub/src/controller.js b/packages/manager/apps/hub/src/controller.js index 583332eba8cb..18c5cebdaef1 100644 --- a/packages/manager/apps/hub/src/controller.js +++ b/packages/manager/apps/hub/src/controller.js @@ -1,5 +1,4 @@ import { isString } from 'lodash-es'; -import { isTopLevelApplication } from '@ovh-ux/manager-config'; import { getShellClient } from './shell'; export default class HubController { @@ -22,39 +21,14 @@ export default class HubController { this.chatbotEnabled = false; this.coreConfig = coreConfig; this.ovhFeatureFlipping = ovhFeatureFlipping; - this.isTopLevelApplication = isTopLevelApplication(); this.shell = getShellClient(); this.isAccountSidebarVisible = false; this.liveChatService = liveChatService; } async $onInit() { - this.navbarOptions = { - universe: this.coreConfig.getUniverse(), - toggle: { - event: 'sidebar:loaded', - }, - }; this.currentLanguage = this.coreConfig.getUserLanguage(); this.me = this.coreConfig.getUser(); - const unregisterListener = this.$scope.$on('app:started', () => { - const CHATBOT_FEATURE = 'chatbot'; - this.ovhFeatureFlipping - .checkFeatureAvailability(CHATBOT_FEATURE) - .then((featureAvailability) => { - this.chatbotEnabled = featureAvailability.isFeatureAvailable( - CHATBOT_FEATURE, - ); - if (this.chatbotEnabled) { - this.showLivechat = this.liveChatService.getShowLivechat(); - this.$rootScope.$broadcast( - 'ovh-chatbot:enable', - this.chatbotEnabled, - ); - } - }); - unregisterListener(); - }); this.isAccountSidebarVisible = await this.shell.ux.isAccountSidebarVisible(); } diff --git a/packages/manager/apps/hub/src/index.html b/packages/manager/apps/hub/src/index.html index 7b096e1ccea4..3fd4270d0193 100644 --- a/packages/manager/apps/hub/src/index.html +++ b/packages/manager/apps/hub/src/index.html @@ -29,25 +29,6 @@ > - - - - - - - -
attach(findAvailableLocale(detectUserLocale()))) - .catch(() => {}); -} - useShellClient('hub') .then(async (client) => { const isSidebarMenuVisible = await client.ux.isMenuSidebarVisible();