Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: lazy load otrs section #4340

Merged
merged 1 commit into from
Feb 5, 2021
Merged

Conversation

frenautvh
Copy link
Contributor

@frenautvh frenautvh commented Jan 26, 2021

Question Answer
Branch? develop
Bug fix? no
New feature? no
Breaking change? no
Tickets MANAGER-6397
License BSD 3-Clause

Description

Lazy load otrs section (part is conditionnally loaded only for US region)

@frenautvh frenautvh added quality check feature New feature blocked Don't merge yet labels Jan 26, 2021
@frenautvh frenautvh requested a review from a team as a code owner January 26, 2021 08:05
@frenautvh frenautvh requested review from antleblanc, varun257 and radireddy and removed request for a team January 26, 2021 08:05
angular.module(moduleName, ['oc.lazyLoad', 'ui.router']).config(
/* @ngInject */ ($stateProvider, $urlRouterProvider, coreConfigProvider) => {
const region = coreConfigProvider.getRegion();
if (region === 'US') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lazy load the module for US region otherwise perform a redirection

self.init = function init() {
// self.createMenu();
self.isLoaded = true;
$compile(angular.element('#otrs-popup'))($rootScope.$new());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added this line :
the otrs-popup directive code will only be loaded for US region, so we need to compile the directive (https://github.com/ovh/manager/pull/4340/files#diff-4eaf543ac34656361a5e0375c3730f87305031a7a866a005d4ce09d01183723dR134) after the otrs module have been lazy loaded

@frenautvh frenautvh force-pushed the feat/dedicated-otrs-lazyloading branch from 98197d5 to b29a0f2 Compare January 26, 2021 08:13
@@ -291,7 +291,7 @@ <h1 data-translate="otrs_title"></h1>
</tbody>
<tbody data-ng-show="!loaders.tickets && tickets.ids.length">
<tr
data-ng-repeat="ticket in tickets.detail | orderBy:'creationDate':true track by ticket.ticketNumber"
data-ng-repeat="ticket in tickets.detail | orderBy:'creationDate':true track by ticket.ticketNumber+$index"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a fix here because there is a silent error in production (duplicate index in repeater)

cbourgois
cbourgois previously approved these changes Jan 26, 2021
JeremyDec
JeremyDec previously approved these changes Jan 27, 2021
Base automatically changed from feat/breadcrumb-billing-useraccount to develop January 29, 2021 13:18
@antleblanc antleblanc dismissed stale reviews from JeremyDec and cbourgois January 29, 2021 13:18

The base branch was changed.

@frenautvh frenautvh force-pushed the feat/dedicated-otrs-lazyloading branch from b29a0f2 to e400fe5 Compare January 29, 2021 13:37
@frenautvh frenautvh removed the blocked Don't merge yet label Jan 29, 2021
return '/support';
}
if (/^\/ticket\//.test(path)) {
return path.replace(/^\/ticket\//, '/support/tickets/');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in a (near) future we could uniformize urls as it is quite confusing to know when it is supposed to be /ticket or /support/tickets

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes i suppose it was introduced for backward compatibility with old urls, i wonder if it's still necessary

@frenautvh frenautvh force-pushed the feat/dedicated-otrs-lazyloading branch from e400fe5 to f66634b Compare February 1, 2021 09:12
antleblanc
antleblanc previously approved these changes Feb 5, 2021
@frenautvh frenautvh force-pushed the feat/dedicated-otrs-lazyloading branch 3 times, most recently from 90613ee to a5cc6f1 Compare February 5, 2021 08:08
@frenautvh frenautvh force-pushed the feat/dedicated-otrs-lazyloading branch from a5cc6f1 to 24ce039 Compare February 5, 2021 09:38
@antleblanc antleblanc changed the title feat(dedicated): lazy load otrs section perf: lazy load otrs section Feb 5, 2021
@antleblanc antleblanc added performance Improves performance and removed feature New feature labels Feb 5, 2021
@antleblanc antleblanc merged commit 421940b into develop Feb 5, 2021
@antleblanc antleblanc deleted the feat/dedicated-otrs-lazyloading branch February 5, 2021 12:43
@antleblanc antleblanc mentioned this pull request Feb 5, 2021
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants