Skip to content

Commit

Permalink
refactor(hub): remove common manager's features
Browse files Browse the repository at this point in the history
ref: MANAGER-9201

Signed-off-by: Cyrille Bourgois <[email protected]>
  • Loading branch information
Cyrille Bourgois committed Jul 13, 2022
1 parent 948f8d8 commit 80b6566
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 91 deletions.
9 changes: 1 addition & 8 deletions packages/manager/apps/hub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -95,4 +88,4 @@
"EU",
"US"
]
}
}
28 changes: 1 addition & 27 deletions packages/manager/apps/hub/src/app.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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),
)
Expand All @@ -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(() => {
Expand All @@ -133,7 +110,6 @@ export default async (containerEl, shellClient) => {
)
.run(
/* @ngInject */ ($transitions) => {
// replace ngOvhUiRouterLineProgress if in container
if (!isTopLevelApplication()) {
$transitions.onBefore({}, (transition) => {
if (
Expand Down Expand Up @@ -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');
Expand Down
26 changes: 0 additions & 26 deletions packages/manager/apps/hub/src/controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { isString } from 'lodash-es';
import { isTopLevelApplication } from '@ovh-ux/manager-config';
import { getShellClient } from './shell';

export default class HubController {
Expand All @@ -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();
}

Expand Down
19 changes: 0 additions & 19 deletions packages/manager/apps/hub/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,6 @@
>
</a>
</div>

<!-- /Skip to main content -->
<ovh-manager-navbar
data-navbar-options="$ctrl.navbarOptions"
data-sidebar-expand="true"
data-sidebar-links="{}"
data-ng-if="$ctrl.isTopLevelApplication"
>
</ovh-manager-navbar>
<ovh-manager-account-sidebar
expand="true"
me="$ctrl.me"
data-ng-if="$ctrl.isTopLevelApplication"
>
</ovh-manager-account-sidebar>
<ovh-manager-notifications-sidebar
data-ng-if="$ctrl.isTopLevelApplication"
>
</ovh-manager-notifications-sidebar>
<div class="position-relative w-100 h-100 overflow-auto ng-cloak">
<div
class="position-absolute hub-main w-100 h-100"
Expand Down
12 changes: 1 addition & 11 deletions packages/manager/apps/hub/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,12 @@ import 'regenerator-runtime/runtime';
import { useShellClient } from '@ovh-ux/shell';

import { buildURL } from '@ovh-ux/ufrontend';
import {
findAvailableLocale,
detectUserLocale,
isTopLevelApplication,
} from '@ovh-ux/manager-config';
import { isTopLevelApplication } from '@ovh-ux/manager-config';
import { BILLING_REDIRECTIONS } from './constants';

import { getShellClient, setShellClient } from './shell';
import TRACKING from './components/at-internet/at-internet.constant';

if (isTopLevelApplication()) {
import('@ovh-ux/manager-preloader')
.then(({ attach }) => attach(findAvailableLocale(detectUserLocale())))
.catch(() => {});
}

useShellClient('hub')
.then(async (client) => {
const isSidebarMenuVisible = await client.ux.isMenuSidebarVisible();
Expand Down

0 comments on commit 80b6566

Please sign in to comment.