Skip to content

Commit 9cdabab

Browse files
author
jleveugle
committed
fix: rework imports to improve standalone modules
1 parent fd3c662 commit 9cdabab

File tree

17 files changed

+130
-101
lines changed

17 files changed

+130
-101
lines changed

packages/manager/core/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,16 @@
2222
},
2323
"peerDependencies": {
2424
"angular": "^1.7.5",
25+
"angular-aria": "^1.7.5",
2526
"angular-dynamic-locale": "^0.1.37",
2627
"angular-i18n": "~1.5.x",
28+
"angular-resource": "^1.7.5",
29+
"angular-sanitize": "^1.7.5",
2730
"angular-translate": "^2.18.1",
2831
"angular-translate-loader-pluggable": "^1.3.1",
32+
"ovh-angular-apiv7": "^1.2.8",
33+
"ovh-angular-http": "^4.0.0-alpha.1",
34+
"ovh-angular-sso-auth": "^4.0.0-alpha.2",
2935
"ovh-api-services": "^3.18.0"
3036
}
31-
}
37+
}

packages/manager/core/src/index.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
import angular from 'angular';
2+
import _ from 'lodash';
3+
4+
import 'angular-aria';
5+
import 'angular-sanitize';
6+
import 'angular-resource';
7+
28
import kebabCase from 'lodash/kebabCase';
39
import translateAsyncLoader from '@ovh-ux/translate-async-loader';
10+
import OvhHttp from 'ovh-angular-http';
11+
import ssoAuth from 'ovh-angular-sso-auth';
412

513
import 'angular-dynamic-locale';
614
import 'angular-translate';
715
import 'angular-translate-loader-pluggable';
16+
17+
import 'ovh-angular-apiv7';
818
import 'ovh-api-services';
919

1020
import translateServiceProvider from './translate/translate.service';
@@ -18,11 +28,14 @@ const moduleName = 'ovhManagerCore';
1828

1929
angular
2030
.module(moduleName, [
31+
'ngSanitize',
2132
'angular-translate-loader-pluggable',
2233
'ovh-api-services',
2334
'pascalprecht.translate',
2435
'tmh.dynamicLocale',
2536
translateAsyncLoader,
37+
OvhHttp,
38+
ssoAuth,
2639
])
2740
.constant('constants', {})
2841
.constant('CORE_LANGUAGES', LANGUAGES)
@@ -115,6 +128,63 @@ angular
115128
angularLocalePromise
116129
.then(() => injectAngularLocale(angularLocale))
117130
.then(() => tmhDynamicLocale.set(angularLocale));
131+
})
132+
.run((ssoAuthentication/* , User */) => {
133+
ssoAuthentication.login(); // .then(() => User.getUser());
134+
})
135+
.constant('OVH_SSO_AUTH_LOGIN_URL', '/auth')
136+
.factory('serviceTypeInterceptor', () => ({
137+
request(config) {
138+
const localConfig = config;
139+
if (/^(\/?engine\/)?2api(-m)?\//.test(localConfig.url)) {
140+
localConfig.url = localConfig.url.replace(/^(\/?engine\/)?2api(-m)?/, '');
141+
localConfig.serviceType = 'aapi';
142+
}
143+
144+
if (/^apiv6\//.test(localConfig.url)) {
145+
localConfig.url = localConfig.url.replace(/^apiv6/, '');
146+
localConfig.serviceType = 'apiv6';
147+
}
148+
149+
if (/^apiv7\//.test(localConfig.url)) {
150+
localConfig.url = localConfig.url.replace(/^apiv7/, '');
151+
localConfig.serviceType = 'apiv7';
152+
}
153+
154+
return localConfig;
155+
},
156+
}))
157+
.config((ssoAuthenticationProvider, $httpProvider, OVH_SSO_AUTH_LOGIN_URL) => {
158+
ssoAuthenticationProvider.setLoginUrl(OVH_SSO_AUTH_LOGIN_URL);
159+
ssoAuthenticationProvider.setLogoutUrl(`${OVH_SSO_AUTH_LOGIN_URL}?action=disconnect`);
160+
161+
// if (!constants.prodMode) {
162+
ssoAuthenticationProvider.setUserUrl('/engine/apiv6/me');
163+
// }
164+
165+
ssoAuthenticationProvider.setConfig([
166+
{
167+
serviceType: 'apiv6',
168+
urlPrefix: '/engine/apiv6',
169+
},
170+
{
171+
serviceType: 'aapi',
172+
urlPrefix: '/engine/2api',
173+
},
174+
{
175+
serviceType: 'apiv7',
176+
urlPrefix: '/engine/apiv7',
177+
},
178+
]);
179+
180+
$httpProvider.interceptors.push('serviceTypeInterceptor');
181+
$httpProvider.interceptors.push('ssoAuthInterceptor');
182+
})
183+
.config((OvhHttpProvider) => {
184+
// OvhHttpProvider.rootPath = constants.swsProxyPath;
185+
_.set(OvhHttpProvider, 'clearCacheVerb', ['POST', 'PUT', 'DELETE']);
186+
_.set(OvhHttpProvider, 'returnSuccessKey', 'data'); // By default, request return response.data
187+
_.set(OvhHttpProvider, 'returnErrorKey', 'data'); // By default, request return error.data
118188
});
119189

120190

packages/manager/freefax/src/freefax.component.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import '@ovh-ux/ng-uirouter-title';
88
import 'ovh-angular-ui-confirm-modal';
99
import 'ovh-api-services';
1010

11+
import '@ovh-ux/ovh-angular-contracts';
12+
1113
import credit from './credit';
1214
import faxConfiguration from './faxConfiguration';
1315
import notifications from './notifications';

packages/manager/layout-ovh/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@
7171
"ovh-manager-webfont": "^1.0.2",
7272
"ovh-ngstrap": "^4.0.2",
7373
"ovh-ui-angular": "^2.23.0",
74-
"ovh-ui-kit": "^2.21.5",
75-
"ovh-ui-kit-bs": "~1.3.3",
74+
"ovh-ui-kit": "^2.23.1",
75+
"ovh-ui-kit-bs": "^2.0.1",
7676
"punycode": "^1.2.4",
7777
"validator-js": "chriso/validator.js#3.40.1"
7878
},

packages/manager/layout-ovh/src/index.js

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ import ngMessages from 'angular-messages';
99
import ngSanitize from 'angular-sanitize';
1010
import 'angular-resource';
1111
import translate from 'angular-translate';
12-
import _ from 'lodash';
13-
14-
import ssoAuth from 'ovh-angular-sso-auth';
15-
import OvhHttp from 'ovh-angular-http';
1612

1713
import core from '@ovh-ux/manager-core';
1814
import overthebox from '@ovh-ux/manager-overthebox';
@@ -29,11 +25,6 @@ import 'angular-ui-bootstrap';
2925
import 'at-internet-ui-router-plugin';
3026
import 'ng-at-internet';
3127
import 'ovh-angular-apiv7';
32-
import 'ovh-angular-checkbox-table';
33-
import 'ovh-angular-otrs';
34-
import 'ovh-angular-pagination-front';
35-
import 'ovh-angular-responsive-tabs';
36-
import 'ovh-angular-ui-confirm-modal';
3728
import 'ovh-ui-angular';
3829

3930
import './manager-layout-ovh.scss';
@@ -51,81 +42,13 @@ angular
5142
ngSanitize,
5243
'oui',
5344
overthebox,
54-
'ovh-angular-checkbox-table',
5545
'ovh-angular-otrs',
56-
'ovh-angular-responsive-tabs',
57-
'ovh-angular-ui-confirm-modal',
58-
'ovhAngularContracts',
59-
'ovh-angular-ui-confirm-modal',
60-
'ovh-angular-pagination-front',
61-
OvhHttp,
6246
sidebar,
6347
sms,
64-
ssoAuth,
6548
translate,
6649
'ui.bootstrap',
6750
welcome,
6851
])
69-
.run((ssoAuthentication/* , User */) => {
70-
ssoAuthentication.login(); // .then(() => User.getUser());
71-
})
72-
.constant('OVH_SSO_AUTH_LOGIN_URL', '/auth')
73-
.factory('serviceTypeInterceptor', () => ({
74-
request(config) {
75-
const localConfig = config;
76-
if (/^(\/?engine\/)?2api(-m)?\//.test(localConfig.url)) {
77-
localConfig.url = localConfig.url.replace(/^(\/?engine\/)?2api(-m)?/, '');
78-
localConfig.serviceType = 'aapi';
79-
}
80-
81-
if (/^apiv6\//.test(localConfig.url)) {
82-
localConfig.url = localConfig.url.replace(/^apiv6/, '');
83-
localConfig.serviceType = 'apiv6';
84-
}
85-
86-
if (/^apiv7\//.test(localConfig.url)) {
87-
localConfig.url = localConfig.url.replace(/^apiv7/, '');
88-
localConfig.serviceType = 'apiv7';
89-
}
90-
91-
return localConfig;
92-
},
93-
}))
94-
.config(($locationProvider) => {
95-
$locationProvider.hashPrefix('');
96-
})
97-
.config((ssoAuthenticationProvider, $httpProvider, OVH_SSO_AUTH_LOGIN_URL) => {
98-
ssoAuthenticationProvider.setLoginUrl(OVH_SSO_AUTH_LOGIN_URL);
99-
ssoAuthenticationProvider.setLogoutUrl(`${OVH_SSO_AUTH_LOGIN_URL}?action=disconnect`);
100-
101-
// if (!constants.prodMode) {
102-
ssoAuthenticationProvider.setUserUrl('/engine/apiv6/me');
103-
// }
104-
105-
ssoAuthenticationProvider.setConfig([
106-
{
107-
serviceType: 'apiv6',
108-
urlPrefix: '/engine/apiv6',
109-
},
110-
{
111-
serviceType: 'aapi',
112-
urlPrefix: '/engine/2api',
113-
},
114-
{
115-
serviceType: 'apiv7',
116-
urlPrefix: '/engine/apiv7',
117-
},
118-
]);
119-
120-
$httpProvider.interceptors.push('serviceTypeInterceptor');
121-
$httpProvider.interceptors.push('ssoAuthInterceptor');
122-
})
123-
.config((OvhHttpProvider) => {
124-
// OvhHttpProvider.rootPath = constants.swsProxyPath;
125-
_.set(OvhHttpProvider, 'clearCacheVerb', ['POST', 'PUT', 'DELETE']);
126-
_.set(OvhHttpProvider, 'returnSuccessKey', 'data'); // By default, request return response.data
127-
_.set(OvhHttpProvider, 'returnErrorKey', 'data'); // By default, request return error.data
128-
})
12952
.config((OtrsPopupProvider /* , constants */) => {
13053
OtrsPopupProvider.setBaseUrlTickets('');
13154
})

packages/manager/layout-ovh/src/manager-layout-ovh.less

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/* stylelint-disable at-rule-no-unknown */
2-
@rem-base: rem-base(10px);
3-
42
@import "~ovh-ui-kit/packages/oui/stylekit";
53

64
/* OVH-UI-KIT Bootstrap theme. */
@@ -19,7 +17,7 @@
1917
}
2018

2119
.oui-sidebar-menu {
22-
width: 100%;
20+
width: 100% !important;
2321
}
2422

2523
/* stylelint-enable at-rule-no-unknown */

packages/manager/layout-ovh/src/manager-layout-ovh.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@import "../../../node_modules/bootstrap4/scss/_functions";
2-
@import "../../../node_modules/bootstrap4/scss/_variables";
3-
@import "../../../node_modules/bootstrap4/scss/_mixins";
4-
@import '../../../node_modules/bootstrap4/scss/_utilities.scss';
1+
@import "~bootstrap4/scss/_functions";
2+
@import "~bootstrap4/scss/_variables";
3+
@import "~bootstrap4/scss/_mixins";
4+
@import '~bootstrap4/scss/_utilities.scss';
55

66
// Microsoft Icons
77
// @import './../../../node_modules/office-ui-fabric-react/dist/sass/variables/_Icon.Variables.scss';

packages/manager/overthebox/package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,20 @@
2121
"@ovh-ux/component-rollup-config": "5.0.0-beta.3"
2222
},
2323
"peerDependencies": {
24-
"@ovh-ux/ng-uirouter-title": "^2.0.0-beta.2",
2524
"@ovh-ux/manager-core": "^1.1.0",
2625
"@ovh-ux/manager-telecom-styles": "^1.0.0-beta.0",
26+
"@ovh-ux/ng-uirouter-title": "^2.0.0-beta.2",
2727
"@ovh-ux/telecom-universe-components": "^1.3.0",
2828
"@uirouter/angularjs": "^1.0.15",
2929
"angular": "1.7.5",
3030
"angularjs-scroll-glue": "^2.2.0",
31+
"bootstrap4": "twbs/bootstrap#v4.0.0",
3132
"oclazyload": "^1.1.0",
3233
"ovh-angular-responsive-tabs": "^4.0.0",
33-
"ovh-angular-tail-logs": "^1.1.1"
34+
"ovh-angular-tail-logs": "^1.1.1",
35+
"ovh-angular-ui-confirm-modal": "^1.0.2",
36+
"ovh-manager-webfont": "^1.0.2",
37+
"ovh-ui-kit": "^2.23.1",
38+
"ovh-ui-kit-bs": "^2.0.1"
3439
}
3540
}

packages/manager/overthebox/src/details/overTheBox-details.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165

166166
<button class="btn btn-primary"
167167
type="submit"
168-
title="{{OverTheBoxDetails.deviceIdToLink}} {{::'common_table_validate_modifications' | translate}}"
168+
title="{{OverTheBoxDetails.deviceIdToLink}} {{::'overTheBox_common_table_validate_modifications' | translate}}"
169169
data-ng-really-click="OverTheBoxDetails.linkDevice({deviceId: OverTheBoxDetails.deviceIdToLink}); OverTheBoxDetails.device.editMode = false"
170170
data-ng-really-message="{{ 'overTheBox_link_device_confirm' | translate }}"
171171
data-ng-really-confirm="{{ 'ok' | translate }}"
@@ -176,7 +176,7 @@
176176
</button>
177177
<button class="btn btn-default ml-2"
178178
type="button"
179-
title="{{OverTheBoxDetails.deviceIdToLink}} {{::'common_table_cancel_modifications' | translate}}"
179+
title="{{OverTheBoxDetails.deviceIdToLink}} {{::'overTheBox_common_table_cancel_modifications' | translate}}"
180180
data-ng-disabled="!OverTheBoxDetails.device.deviceId"
181181
data-ng-click="OverTheBoxDetails.device.editMode = false">
182182
<span class="ovh-font ovh-font-wrong" aria-hidden="true"></span>

packages/manager/overthebox/src/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import angular from 'angular';
2+
3+
import '@ovh-ux/manager-core';
24
import '@uirouter/angularjs';
35
import 'oclazyload';
46

@@ -7,6 +9,7 @@ const moduleName = 'ovhManagerOtb';
79
angular.module(moduleName, [
810
'ui.router',
911
'oc.lazyLoad',
12+
'ovhManagerCore',
1013
])
1114
.config(/* @ngInject */ ($stateProvider) => {
1215
$stateProvider.state('overTheBox.**', {

0 commit comments

Comments
 (0)