OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Avoid double loading of components and remove unnecessary global variables
Henriette Dinger8431fb531528
diff --git a/app/views/enterprises/_current.html.erb b/app/views/enterprises/_current.html.erbindex 53224492a4f..5514c2f40db 100644--- a/app/views/enterprises/_current.html.erb+++ b/app/views/enterprises/_current.html.erb@@ -5,9 +5,9 @@data-expires-at="<%= (!@current_token.will_expire?) ? t('js.admin.enterprise.upsale.unlimited') : (format_date @current_token.expires_at) %>"></enterprise-active-trial>-<%= form_tag({ action: :destroy },- method: :delete) do %>+<%= form_tag({}, method: :delete) do %><confirm-form-submit></confirm-form-submit>- <%= styled_button_tag t(:button_delete), type: 'submit', class: '-with-icon icon-delete' %>+ <%= styled_button_tag t(:button_delete),+ method: :delete,+ class: '-with-icon icon-delete' %><% end %>-diff --git a/config/locales/js-en.yml b/config/locales/js-en.ymlindex 20f86031adf..efb639b4743 100644--- a/config/locales/js-en.yml+++ b/config/locales/js-en.yml@@ -208,7 +208,7 @@ en:resend_link: "Resend"resend_success: "Email has been resent. Please check your emails and click the confirmation link provided."resend_warning: "Could not resend email."- session_timeout: "Your session timed out. Please try to resend email."+ session_timeout: "Your session timed out. Please try to reload the page or resend email."status_label: "Status:"status_confirmed: "confirmed"status_waiting: "email sent - waiting for confirmation"diff --git a/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.ts b/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.tsindex 129fc962c7f..8309c424c91 100644--- a/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.ts+++ b/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.ts@@ -32,8 +32,10 @@ import {baseUrlAugur, EnterpriseTrialService} from "app/components/enterprise/enimport {DynamicBootstrapper} from "core-app/globals/dynamic-bootstrapper";import {HttpClient, HttpErrorResponse} from "@angular/common/http";+export const enterpriseActiveTrialSelector = 'enterprise-active-trial';+@Component({- selector: 'enterprise-active-trial',+ selector: enterpriseActiveTrialSelector,templateUrl: './ee-active-trial.component.html',styleUrls: ['./ee-active-trial.component.sass']})@@ -86,7 +88,7 @@ export class EEActiveTrialComponent implements OnInit {.then((userData:any) => {this.subscriber = userData.first_name + ' ' + userData.last_name;this.email = userData.email;- this.eeTrialService.retryConfirmation(this.eeTrialService.delay, this.eeTrialService.retries);+ this.eeTrialService.retryConfirmation();}).catch((error:HttpErrorResponse) => {this.eeTrialService.cancelled = true;@@ -98,8 +100,3 @@ export class EEActiveTrialComponent implements OnInit {return gon ? gon.ee_trial_key : undefined;}}--DynamicBootstrapper.register({- selector: 'enterprise-active-trial', cls: EEActiveTrialComponent-});-diff --git a/frontend/src/app/components/enterprise/enterprise-base.component.ts b/frontend/src/app/components/enterprise/enterprise-base.component.tsindex ec904b9f95b..b84f81bfaa0 100644--- a/frontend/src/app/components/enterprise/enterprise-base.component.ts+++ b/frontend/src/app/components/enterprise/enterprise-base.component.ts@@ -69,7 +69,3 @@ export class EnterpriseBaseComponent {return this.eeTrialService.status === undefined;}}--DynamicBootstrapper.register({- selector: enterpriseBaseSelector, cls: EnterpriseBaseComponent-});diff --git a/frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.ts b/frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.tsindex d9e7100db25..c22f5302bc1 100644--- a/frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.ts+++ b/frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.ts@@ -64,7 +64,7 @@ export class EETrialWaitingComponent {.toPromise().then(() => {this.notificationsService.addSuccess(this.text.resend_success);- this.eeTrialService.retryConfirmation(this.eeTrialService.delay, this.eeTrialService.retries);+ this.eeTrialService.retryConfirmation();}).catch((error:HttpErrorResponse) => {this.notificationsService.addError(this.text.resend_warning);diff --git a/frontend/src/app/components/enterprise/enterprise-trial.service.ts b/frontend/src/app/components/enterprise/enterprise-trial.service.tsindex cf0480b9331..b475da4db72 100644--- a/frontend/src/app/components/enterprise/enterprise-trial.service.ts+++ b/frontend/src/app/components/enterprise/enterprise-trial.service.ts@@ -20,10 +20,6 @@ export class EnterpriseTrialService {public status:'mailSubmitted'|'startTrial'|undefined;public errorMsg:string|undefined;- // retry confirmation- public delay = 5000; // wait 5s until next request- public retries = 60; // keep trying for 5 minutes-constructor(readonly I18n:I18nService,protected http:HttpClient,readonly pathHelper:PathHelperService,@@ -46,7 +42,7 @@ export class EnterpriseTrialService {.then((enterpriseTrial:any) => {this.trialLink = enterpriseTrial._links.self.href;- this.retryConfirmation(this.delay, this.retries);+ this.retryConfirmation();}).catch((error:HttpErrorResponse) => {// mail is invalid or user already created a trial@@ -96,7 +92,6 @@ export class EnterpriseTrialService {} else if (_.get(error, 'error._type') === 'Error') {this.notificationsService.addError(error.error.message);} else {- // backend returned an unsuccessful response codethis.notificationsService.addError(error.error || I18n.t('js.error.internal'));}});@@ -133,7 +128,7 @@ export class EnterpriseTrialService {}// retry request while waiting for mail confirmation- public retryConfirmation(delay:number, retries:number) {+ public retryConfirmation(delay:number = 5000, retries:number = 60) {if (this.cancelled || this.confirmed) {return;} else if (retries === 0) {diff --git a/frontend/src/app/global-dynamic-components.const.ts b/frontend/src/app/global-dynamic-components.const.tsindex 272652c5a6d..449bfba8e1b 100644--- a/frontend/src/app/global-dynamic-components.const.ts+++ b/frontend/src/app/global-dynamic-components.const.ts@@ -130,6 +130,10 @@ import {EnterpriseBaseComponent,enterpriseBaseSelector} from "core-components/enterprise/enterprise-base.component";+import {+ EEActiveTrialComponent,+ enterpriseActiveTrialSelector+} from "core-components/enterprise/enterprise-active-trial/ee-active-trial.component";export const globalDynamicComponents:OptionalBootstrapDefinition[] = [{ selector: appBaseSelector, cls: ApplicationBaseComponent },@@ -166,6 +170,7 @@ export const globalDynamicComponents:OptionalBootstrapDefinition[] = [{ selector: collapsibleSectionAugmentSelector, cls: CollapsibleSectionComponent },{ selector: enterpriseBannerSelector, cls: EnterpriseBannerBootstrapComponent },{ selector: enterpriseBaseSelector, cls: EnterpriseBaseComponent },+ { selector: enterpriseActiveTrialSelector, cls: EEActiveTrialComponent },{ selector: projectMenuAutocompleteSelector, cls: ProjectMenuAutocompleteComponent },{ selector: remoteFieldUpdaterSelector, cls: RemoteFieldUpdaterComponent },{ selector: wpEmbeddedTableEntrySelector, cls: WorkPackageEmbeddedTableEntryComponent },