Skip to content

Commit bcd932a

Browse files
marie-jjleveugle
authored andcommitted
feat(pci): change link to legacy manager display
1 parent 6c13bb8 commit bcd932a

File tree

13 files changed

+70
-60
lines changed

13 files changed

+70
-60
lines changed

packages/manager/modules/pci/src/projects/project/sidebar/legacy-forward/forward.constants.js renamed to packages/manager/modules/pci/src/projects/project/legacy-forward/forward.constants.js

File renamed without changes.

packages/manager/modules/pci/src/projects/project/sidebar/legacy-forward/forward.controller.js renamed to packages/manager/modules/pci/src/projects/project/legacy-forward/forward.controller.js

File renamed without changes.

packages/manager/modules/pci/src/projects/project/sidebar/legacy-forward/forward.html renamed to packages/manager/modules/pci/src/projects/project/legacy-forward/forward.html

File renamed without changes.

packages/manager/modules/pci/src/projects/project/project.controller.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,37 @@
11
import isNil from 'lodash/isNil';
22

33
import { ACTIONS, LINKS } from './project.constants';
4+
import { LEGACY_URLS } from './legacy-forward/forward.constants';
5+
6+
import controller from './legacy-forward/forward.controller';
7+
import template from './legacy-forward/forward.html';
48

59
export default class ProjectController {
610
/* @ngInject */
7-
constructor($state, $stateParams, $transitions, coreConfig, OvhApiCloudProject, sidebarVisible) {
11+
constructor(
12+
$state,
13+
$stateParams,
14+
$uibModal,
15+
atInternet,
16+
coreConfig,
17+
OvhApiCloudProject,
18+
sidebarVisible,
19+
user,
20+
) {
821
this.$state = $state;
922
this.$stateParams = $stateParams;
23+
this.$uibModal = $uibModal;
24+
this.atInternet = atInternet;
1025
this.OvhApiCloudProject = OvhApiCloudProject;
1126
this.sidebarVisible = sidebarVisible;
1227
this.loading = false;
28+
this.user = user;
1329

1430
this.actions = ACTIONS.filter(
1531
({ regions }) => isNil(regions) || regions.includes(coreConfig.getRegion()),
1632
);
1733
this.links = LINKS;
34+
this.LEGACY_URL = LEGACY_URLS[coreConfig.getRegion()];
1835
}
1936

2037
$onInit() {
@@ -33,4 +50,16 @@ export default class ProjectController {
3350
this.loading = false;
3451
});
3552
}
53+
54+
goToLegacy() {
55+
this.atInternet.trackClick({
56+
name: 'public-cloud_menu_back-to-cloud',
57+
type: 'action',
58+
});
59+
return this.$uibModal.open({
60+
template,
61+
controller,
62+
controllerAs: '$ctrl',
63+
});
64+
}
3665
}

packages/manager/modules/pci/src/projects/project/project.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@
44
<cloud-sidebar></cloud-sidebar>
55
</div>
66
<div class="h-100 position-relative p-0 col-lg-10">
7+
<div class="pci-project-banner d-flex justify-content-between p-3">
8+
<span data-translate="pci_projects_project_welcome" class="font-weight-bold oui-color-sapphire"></span>
9+
<button class="oui-link pci-project-link_light"
10+
data-ng-if="$ctrl.user.ovhSubsidiary === 'FR'"
11+
type="button"
12+
data-ng-click="$ctrl.goToLegacy()"
13+
data-translate="pci_projects_project_welcome_legacy">
14+
</button>
15+
<a class="oui-link pci-project-link_light"
16+
data-ng-if="$ctrl.user.ovhSubsidiary !== 'FR'"
17+
data-track-on="click"
18+
data-track-name="public-cloud_menu_back-to-cloud"
19+
data-track-type="action"
20+
data-ng-href="{{:: $ctrl.LEGACY_URL}}">
21+
<span data-translate="pci_projects_project_welcome_legacy"></span>
22+
</a>
23+
</div>
724
<div class="pci-project-content position-absolute w-100 h-100 pt-4 px-3 px-md-5" style="overflow: auto;">
825
<uirouter-breadcrumb></uirouter-breadcrumb>
926
<div class="pci-project-view mt-3 pb-4" data-ui-view>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@background-color: rgb(239, 249, 253);
2+
@link-color: rgb(77, 111, 146);
3+
4+
.pci-project-banner {
5+
background-color: @background-color;
6+
7+
.pci-project-link_light {
8+
color: @link-color;
9+
}
10+
}

packages/manager/modules/pci/src/projects/project/project.module.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import vouchers from './vouchers';
2323
import regions from './regions';
2424
import routing from './project.routing';
2525

26+
import './project.less';
27+
2628
const moduleName = 'ovhManagerPciProject';
2729

2830
angular

packages/manager/modules/pci/src/projects/project/project.routing.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export default /* @ngInject */ ($stateProvider) => {
4444
? project.description
4545
: null),
4646
sidebarVisible: /* @ngInject */ project => project.status !== 'creating',
47+
user: /* @ngInject */ SessionService => SessionService.getUser(),
4748
},
4849
});
4950
};

packages/manager/modules/pci/src/projects/project/sidebar/sidebar.controller.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import isEmpty from 'lodash/isEmpty';
22
import isNil from 'lodash/isNil';
33
import set from 'lodash/set';
4-
import get from 'lodash/get';
54

65
import { MENU } from './sidebar.constant';
7-
import { LEGACY_URLS } from './legacy-forward/forward.constants';
86

97
export default class SidebarController {
108
/* @ngInject */
@@ -15,11 +13,9 @@ export default class SidebarController {
1513
$stateParams,
1614
$transitions,
1715
atInternet,
18-
CloudSidebar,
1916
coreConfig,
2017
OvhApiServices,
2118
OvhApiCloudProject,
22-
SessionService,
2319
) {
2420
this.$translate = $translate;
2521
this.$transitions = $transitions;
@@ -30,8 +26,6 @@ export default class SidebarController {
3026
this.coreConfig = coreConfig;
3127
this.OvhApiServices = OvhApiServices;
3228
this.OvhApiCloudProject = OvhApiCloudProject;
33-
this.CloudSidebar = CloudSidebar;
34-
this.sessionService = SessionService;
3529

3630
this.isOpen = false;
3731
this.isLoading = false;
@@ -82,12 +76,6 @@ export default class SidebarController {
8276
}
8377
this.isDisplayingProjectsList = false;
8478
});
85-
86-
this.sessionService.getUser()
87-
.then((user) => {
88-
this.user = user;
89-
this.legacyUrl = get(LEGACY_URLS, this.coreConfig.getRegion());
90-
});
9179
}
9280

9381
onMenuItemClick({ id }) {

packages/manager/modules/pci/src/projects/project/sidebar/sidebar.html

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,6 @@ <h2 class="mb-0 d-inline-block" style="font-weight: 400;" data-ng-bind="$ctrl.pr
4848
</ul>
4949
</div>
5050
</li>
51-
<li class="oui-sidebar-list__item sidebar-menu-orphan-item">
52-
<button class="oui-sidebar-link"
53-
data-ng-if="$ctrl.user.ovhSubsidiary === 'FR'"
54-
type="button"
55-
data-ng-click="$ctrl.CloudSidebar.goToLegacy()"
56-
data-translate="cloud_sidebar_public_cloud_project_forward_legacy">
57-
</button>
58-
59-
<a class="oui-sidebar-link"
60-
data-ng-if="$ctrl.user.ovhSubsidiary !== 'FR'"
61-
data-track-on="click"
62-
data-track-name="public-cloud_menu_back-to-cloud"
63-
data-track-type="action"
64-
data-ng-href="{{$ctrl.legacyUrl}}">
65-
<span data-translate="cloud_sidebar_public_cloud_project_forward_legacy"></span>
66-
</a>
67-
</li>
6851
</ul>
6952
</div>
7053
</nav>

0 commit comments

Comments
 (0)