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
Adapt background page content to state too
Inga Mai1603884c6267
diff --git a/app/views/enterprises/_info.html.erb b/app/views/enterprises/_info.html.erbindex 63314f1a275..d9362af856b 100644--- a/app/views/enterprises/_info.html.erb+++ b/app/views/enterprises/_info.html.erb@@ -32,12 +32,19 @@ See docs/COPYRIGHT.rdoc for more details.</script><% end %>-<p>- <b><%= t('js.admin.enterprise.upsale.become_hero') %></b><br>- <%= t('js.admin.enterprise.upsale.you_contribute') %>-</p>+<enterprise-base></enterprise-base>-<enterprise></enterprise>+<div class='upsale--actions'>+ <a href="#"+ class="button -highlight"+ data-cb-type="checkout"+ data-cb-plan-id="enterprise-edition---annual-user-license">+ <%= t('admin.enterprise.book_now') %>+ </a>+ <a href="https://www.openproject.org/upgrade-enterprise-edition/" target="_blank">+ <%= t('admin.enterprise.get_quote') %>+ </a>+</div><div class="info-boxes upsale-benefits"><h2><%= t('homescreen.blocks.upsale.description') %></h2>diff --git a/frontend/src/app/angular4-modules.ts b/frontend/src/app/angular4-modules.tsindex ff9b92bfa7e..aaca5dd906e 100644--- a/frontend/src/app/angular4-modules.ts+++ b/frontend/src/app/angular4-modules.ts@@ -40,7 +40,11 @@ import {ConfirmDialogModal} from "core-components/modals/confirm-dialog/confirm-import {ConfirmDialogService} from "core-components/modals/confirm-dialog/confirm-dialog.service";import {DynamicContentModal} from "core-components/modals/modal-wrapper/dynamic-content.modal";import {PasswordConfirmationModal} from "core-components/modals/request-for-confirmation/password-confirmation.modal";+import {EnterpriseBaseComponent} from "core-components/enterprise/enterprise-base.component";import {EnterpriseTrialModal} from "core-components/enterprise/enterprise-modal/enterprise-trial.modal";+import {EETrialFormComponent} from "core-components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component";+import {EETrialWaitingComponent} from "core-components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component";+import {EnterpriseTrialService} from "core-components/enterprise/enterprise-trial.service";import {OpenprojectFieldsModule} from "core-app/modules/fields/openproject-fields.module";import {OpenprojectCommonModule} from "core-app/modules/common/openproject-common.module";import {CommentService} from "core-components/wp-activity/comment-service";@@ -141,6 +145,9 @@ import {OpenprojectMembersModule} from "core-app/modules/members/members.module"// Split viewCommentService,ConfirmDialogService,++ // Enterprise Edition+ EnterpriseTrialService],declarations: [OpContextMenuTrigger,@@ -150,7 +157,12 @@ import {OpenprojectMembersModule} from "core-app/modules/members/members.module"DynamicContentModal,PasswordConfirmationModal,WpPreviewModal,++ // Enterprise Edition+ EnterpriseBaseComponent,EnterpriseTrialModal,+ EETrialFormComponent,+ EETrialWaitingComponent,// Main menuMainMenuResizerComponent,@@ -162,6 +174,31 @@ import {OpenprojectMembersModule} from "core-app/modules/members/members.module"// Form configurationOpDragScrollDirective,ConfirmFormSubmitController,+<<<<<<< HEAD+=======+ ],+ entryComponents: [+ // Project Auto completer+ ProjectMenuAutocompleteComponent,++ // Modals+ DynamicContentModal,+ ConfirmDialogModal,+ PasswordConfirmationModal,+ AttributeHelpTextModal,+ WpPreviewModal,++ // Enterprise Edition+ EnterpriseBaseComponent,+ EnterpriseTrialModal,+ EETrialFormComponent,+ EETrialWaitingComponent,++ // Main menu+ MainMenuResizerComponent,+ MainMenuToggleComponent,+ ConfirmFormSubmitController,+>>>>>>> Adapt background page content to state too]})export class OpenProjectModule {diff --git a/frontend/src/app/components/enterprise/enterprise-base.component.html b/frontend/src/app/components/enterprise/enterprise-base.component.htmlnew file mode 100644index 00000000000..e2d7a5fe353--- /dev/null+++ b/frontend/src/app/components/enterprise/enterprise-base.component.html@@ -0,0 +1,55 @@+<p *ngIf="!eeTrialService.status">+ <b>{{ text.become_hero }}</b><br>+ {{ text.you_contribute }}+</p>++<div *ngIf="eeTrialService.status === 'mailSubmitted'">+ <enterprise-trial-waiting>+ <div class="enterprise--active-token">+ <div class="attributes-group">+ <div class="attributes-key-value">+ <div class="attributes-key-value--key">Subscriber</div>+ <div class="attributes-key-value--value-container">+ <div class="attributes-key-value--value -text">+ <span>{{ eeTrialService.trialForm.first_name }}</span>+ </div>+ </div>+ <div class="attributes-key-value--key">Email</div>+ <div class="attributes-key-value--value-container">+ <div class="attributes-key-value--value -text">+ <span>{{ eeTrialService.trialForm.email }}</span>+ </div>+ </div>+ <div class="attributes-key-value--key">Maximum active users</div>+ <div class="attributes-key-value--value-container">+ <div class="attributes-key-value--value -text">+ <span>10</span>+ </div>+ </div>+ <div class="attributes-key-value--key">Valid since</div>+ <div class="attributes-key-value--value-container">+ <div class="attributes-key-value--value -text">+ <span>-</span>+ </div>+ </div>+ <div class="attributes-key-value--key">Expires at</div>+ <div class="attributes-key-value--value-container">+ <div class="attributes-key-value--value -text">+ <span>-</span>+ </div>+ </div>+ </div>+ </div>+ </div>+ <p><b>We are waiting for your confirmation.</b></p>+ </enterprise-trial-waiting>+ <p class="confirmation-hint">+ You did not receive a mail?+ <a (click)="eeTrialService.resendMail()">Resend mail</a> or try with+ <a (click)="openTrialModal()">another mail address.</a>+ </p>+</div>++<button *ngIf="!eeTrialService.status" class="button -alt-highlight" (click)="openTrialModal()">+ {{ text.button_trial }}+</button>\ No newline at end of filediff --git a/frontend/src/app/components/enterprise/enterprise-base.component.sass b/frontend/src/app/components/enterprise/enterprise-base.component.sassnew file mode 100644index 00000000000..cb7567840b4--- /dev/null+++ b/frontend/src/app/components/enterprise/enterprise-base.component.sass@@ -0,0 +1,4 @@+@import 'helpers'++.button+ float: left\ No newline at end of filediff --git a/frontend/src/app/components/enterprise/enterprise.component.ts b/frontend/src/app/components/enterprise/enterprise-base.component.tssimilarity index 74%rename from frontend/src/app/components/enterprise/enterprise.component.tsrename to frontend/src/app/components/enterprise/enterprise-base.component.tsindex 1b9f70eca6f..b50805cc7b7 100644--- a/frontend/src/app/components/enterprise/enterprise.component.ts+++ b/frontend/src/app/components/enterprise/enterprise-base.component.ts@@ -31,28 +31,38 @@ import {I18nService} from "core-app/modules/common/i18n/i18n.service";import {DynamicBootstrapper} from "core-app/globals/dynamic-bootstrapper";import {EnterpriseTrialModal} from "core-components/enterprise/enterprise-modal/enterprise-trial.modal";import {OpModalService} from "core-components/op-modals/op-modal.service";+import {EnterpriseTrialService} from "core-components/enterprise/enterprise-trial.service";@Component({- selector: 'enterprise',- templateUrl: './enterprise.component.html'+ selector: 'enterprise-base',+ templateUrl: './enterprise-base.component.html',+ styleUrls: ['./enterprise-base.component.sass']})-export class EnterpriseComponent {+export class EnterpriseBaseComponent {+public text = {button_trial: this.I18n.t('js.admin.enterprise.upsale.button_start_trial'),button_book: this.I18n.t('js.admin.enterprise.upsale.button_book_now'),- link_quote: this.I18n.t('js.admin.enterprise.upsale.link_quote')+ link_quote: this.I18n.t('js.admin.enterprise.upsale.link_quote'),+ become_hero: this.I18n.t('js.admin.enterprise.upsale.become_hero'),+ you_contribute: this.I18n.t('js.admin.enterprise.upsale.you_contribute'),};constructor(protected I18n:I18nService,protected opModalService:OpModalService,- readonly injector:Injector) {+ readonly injector:Injector,+ public eeTrialService:EnterpriseTrialService) {}+public openTrialModal() {+ // cancel request and open first modal window+ this.eeTrialService.cancelled = true;+ this.eeTrialService.status = undefined;this.opModalService.show(EnterpriseTrialModal, this.injector);}}DynamicBootstrapper.register({- selector: 'enterprise', cls: EnterpriseComponent+ selector: 'enterprise-base', cls: EnterpriseBaseComponent});diff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.html b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.htmlnew file mode 100644index 00000000000..5fdc087fe7b--- /dev/null+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.html@@ -0,0 +1,81 @@+<form id="enterprise-trial-form" class="form" [formGroup]="trialForm">+ <div class="form--field -wide-label -required">+ <label class="form--label">{{ text.label_company }}</label>+ <div class="form--field-container">+ <div class="form--text-field-container">+ <input type="text"+ class="form--text-field"+ formControlName="company">+ </div>+ </div>+ </div>+ <div class="form--field -wide-label -required">+ <label class="form--label">{{ text.label_first_name }}</label>+ <div class="form--field-container">+ <div class="form--text-field-container">+ <input type="text"+ class="form--text-field"+ formControlName="first_name">+ </div>+ </div>+ </div>+ <div class="form--field -wide-label -required">+ <label class="form--label">{{ text.label_last_name }}</label>+ <div class="form--field-container">+ <div class="form--text-field-container">+ <input type="text"+ class="form--text-field"+ formControlName="last_name">+ </div>+ </div>+ </div>+ <div class="form--field -wide-label -required" [ngClass]="{ '-error': eeTrialService.errorMsg }">+ <label class="form--label">{{ text.label_email }}</label>+ <div class="form--field-container">+ <div class="form--text-field-container">+ <input type="email" class="form--text-field" formControlName="email" (blur)="checkMailField()">+ </div>+ </div>+ <div *ngIf="eeTrialService.errorMsg" class="form--field-instructions">{{ eeTrialService.errorMsg }}</div>+ </div>+ <div class="form--field -wide-label -required">+ <label class="form--label">{{ text.label_domain }}</label>+ <div class="form--field-container">+ <div class="form--text-field-container">+ <input type="text" class="form--text-field" formControlName="domain">+ </div>+ </div>+ </div>+ <div class="form--field -required">+ <div class="form--field-container">+ <label class="form--label-with-check-box -no-ellipsis">+ <div class="form--check-box-container">+ <input type="checkbox"+ class="form--check-box"+ formControlName="general_consent">+ </div>+ <span>I agree with the+ <a href="https://www.openproject.com/terms-of-service/" target="_blank">+ terms of service</a> and the+ <a href="https://www.openproject.com/legal-notice/" target="_blank">privacy policy</a>.+ </span>+ </label>+ </div>+ </div>+ <div class="form--field">+ <div class="form--field-container">+ <label class="form--label-with-check-box -no-ellipsis">+ <div class="form--check-box-container">+ <input type="checkbox"+ class="form--check-box"+ formControlName="newsletter_consent">+ </div>+ <span>I want to receive the OpenProject+ <a href="https://www.openproject.com/newsletter/" target="_blank">+ newsletter</a>.+ </span>+ </label>+ </div>+ </div>+</form>+<p>{{ text.next_step }}</p>\ No newline at end of filediff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.sass b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.sassnew file mode 100644index 00000000000..9d1c2057b7f--- /dev/null+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.sass@@ -0,0 +1,10 @@+@import 'helpers'++#enterprise-trial-form+ .-error+ .form--field-instructions,+ .form--label,+ .form--label::after+ color: var(--content-form-danger-zone-bg-color)+ .form--text-field+ border: 1px solid var(--content-form-danger-zone-bg-color)\ No newline at end of filediff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.ts b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.tsnew file mode 100644index 00000000000..75909a619ec--- /dev/null+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component.ts@@ -0,0 +1,78 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2020 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License+// as published by the Free Software Foundation; either version 2+// of the License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.+//+// You should have received a copy of the GNU General Public License+// along with this program; if not, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See docs/COPYRIGHT.rdoc for more details.+// ++++import {Component, ElementRef} from "@angular/core";+import {FormBuilder, Validators} from "@angular/forms";+import {I18nService} from "app/modules/common/i18n/i18n.service";+import {EnterpriseTrialService} from "core-components/enterprise/enterprise-trial.service";++@Component({+ selector: 'enterprise-trial-form',+ templateUrl: './ee-trial-form.component.html',+ styleUrls: ['./ee-trial-form.component.sass']+})+export class EETrialFormComponent {+ // enterprise trial form+ trialForm = this.formBuilder.group({+ company: ['', Validators.required],+ first_name: ['', Validators.required],+ last_name: ['', Validators.required],+ email: ['', [Validators.required, Validators.email]],+ domain: ['', Validators.required],+ general_consent: [null, Validators.required],+ newsletter_consent: null,+ });++ public text = {+ label_test_ee: this.I18n.t('js.admin.enterprise.trial.test_ee'),+ label_company: this.I18n.t('js.admin.enterprise.trial.label_company'),+ label_first_name: this.I18n.t('js.admin.enterprise.trial.label_first_name'),+ label_last_name: this.I18n.t('js.admin.enterprise.trial.label_last_name'),+ label_email: this.I18n.t('js.admin.enterprise.trial.label_email'),+ label_domain: this.I18n.t('js.admin.enterprise.trial.label_domain'),+ next_step: this.I18n.t('js.admin.enterprise.trial.next_step'),+ };++ constructor(readonly elementRef:ElementRef,+ readonly I18n:I18nService,+ private formBuilder:FormBuilder,+ public eeTrialService:EnterpriseTrialService) {++ }++ // checks if mail is valid after input field was edited by the user+ // displays message for user+ public checkMailField() {+ if (this.trialForm.value.email !== '' && this.trialForm.controls.email.errors) {+ this.eeTrialService.errorMsg = 'Invalid e-mail address';+ } else {+ this.eeTrialService.errorMsg = undefined;+ }+ }+}+diff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.html b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.htmlnew file mode 100644index 00000000000..a27e52d3d65--- /dev/null+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.html@@ -0,0 +1,21 @@+<ng-content></ng-content>++<p>+ We sent you and email to {{ eeTrialService.trialForm.email }}+ Please check your mails and click the confirmation link provided to start your 14 days trial.+</p>+<p>+ <span>Status: </span>+ <span *ngIf="!eeTrialService.confirmed; else confirmedStatus" class="status--waiting">+ email sent - waiting for confirmation+ <a id="resend-link" (click)="eeTrialService.resendMail()">{{ text.resend }}</a>++ <p *ngIf="eeTrialService.cancelled">+ Sorry, session timed out. Please try to resend mail.+ </p>+ </span>++ <ng-template #confirmedStatus>+ <span class="status--confirmed">confirmed ✓</span>+ </ng-template>+</p>\ No newline at end of filediff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.sass b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.sassnew file mode 100644index 00000000000..cf9d64cea7a--- /dev/null+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.sass@@ -0,0 +1,9 @@+@import 'helpers'++#resend-link+ float: right++.status--confirmed+ color: var(--button--alt-highlight-background-color)+.status--waiting+ color: orange\ No newline at end of filediff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.ts b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.tsnew file mode 100644index 00000000000..2d861b562b6--- /dev/null+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial-waiting/ee-trial-waiting.component.ts@@ -0,0 +1,48 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2020 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License+// as published by the Free Software Foundation; either version 2+// of the License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.+//+// You should have received a copy of the GNU General Public License+// along with this program; if not, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See docs/COPYRIGHT.rdoc for more details.+// ++++import {Component, ElementRef} from "@angular/core";+import {I18nService} from "app/modules/common/i18n/i18n.service";+import {EnterpriseTrialService} from "app/components/enterprise/enterprise-trial.service";++@Component({+ selector: 'enterprise-trial-waiting',+ templateUrl: './ee-trial-waiting.component.html',+ styleUrls: ['./ee-trial-waiting.component.sass']+})+export class EETrialWaitingComponent {+ public text = {+ resend: this.I18n.t('js.admin.enterprise.trial.resend_link')+ };++ constructor(readonly elementRef:ElementRef,+ readonly I18n:I18nService,+ public eeTrialService:EnterpriseTrialService) {+ }+}+diff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.html b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.htmlindex 6bd3f701b75..feaefc8d34c 100644--- a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.html+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.html@@ -2,171 +2,77 @@<div class="op-modal--modal-container"data-indicator-name="modal"tabindex="0">- <div class="op-modal--modal-header">- <h3 *ngIf="!status"> {{ text.label_test_ee }}</h3>- <h3 *ngIf="status === 'mailSubmitted'">Confirmation of email-address</h3>- <h3 *ngIf="status === 'startTrial'">Next steps</h3>- <a *ngIf="showClose" class="op-modal--modal-close-button">- <i class="icon-close"- (click)="closeModal($event)"- [attr.title]="text.close_popup">- </i>- </a>- </div>-- <div class="op-modal--modal-body">- <div *ngIf="!status">- <form id="enterprise-trial-form" class="form" [formGroup]="enterpriseTrialForm">- <div class="form--field -wide-label -required">- <label class="form--label">{{ text.label_company }}</label>- <div class="form--field-container">- <div class="form--text-field-container">- <input type="text"- class="form--text-field"- formControlName="company">- </div>- </div>- </div>- <div class="form--field -wide-label -required">- <label class="form--label">{{ text.label_first_name }}</label>- <div class="form--field-container">- <div class="form--text-field-container">- <input type="text"- class="form--text-field"- formControlName="first_name">- </div>- </div>- </div>- <div class="form--field -wide-label -required">- <label class="form--label">{{ text.label_last_name }}</label>- <div class="form--field-container">- <div class="form--text-field-container">- <input type="text"- class="form--text-field"- formControlName="last_name">- </div>- </div>- </div>- <div class="form--field -wide-label -required" [ngClass]="{ '-error': this.errorMsg }">- <label class="form--label">{{ text.label_email }}</label>- <div class="form--field-container">- <div class="form--text-field-container">- <input type="email" class="form--text-field" formControlName="email" (blur)="checkMailField()">- </div>- </div>- <div *ngIf="this.errorMsg" class="form--field-instructions">{{ this.errorMsg }}</div>- </div>- <div class="form--field -wide-label -required">- <label class="form--label">{{ text.label_domain }}</label>- <div class="form--field-container">- <div class="form--text-field-container">- <input type="text" class="form--text-field" formControlName="domain">- </div>- </div>- </div>- <div class="form--field -required">- <div class="form--field-container">- <label class="form--label-with-check-box -no-ellipsis">- <div class="form--check-box-container">- <input type="checkbox"- class="form--check-box"- formControlName="general_consent">- </div>- <span>I agree with the- <a href="https://www.openproject.com/terms-of-service/" target="_blank">- terms of service</a> and the- <a href="https://www.openproject.com/legal-notice/" target="_blank">privacy policy</a>.- </span>- <span class="tooltip--right"- data-tooltip="You already confirmed the terms of service when you created your OpenProject trial.">- <i class="icon icon-info1"></i>- </span>- </label>- </div>- </div>- <div class="form--field">- <div class="form--field-container">- <label class="form--label-with-check-box -no-ellipsis">- <div class="form--check-box-container">- <input type="checkbox"- class="form--check-box"- formControlName="newsletter_consent">- </div>- <span>I want to receive the OpenProject- <a href="https://www.openproject.com/newsletter/" target="_blank">- newsletter</a>.- </span>- </label>- </div>- </div>- </form>- <p>{{ text.next_step }}</p>- </div>-- <div *ngIf="status === 'mailSubmitted'">- <p>We sent you an email. Please click the confirmation link provided in this email.</p>- <p>- <span>Status: </span>- <span *ngIf="!confirmed; else confirmedStatus" class="status--waiting">- email sent - waiting for confirmation- <a id="resend-link" (click)="resendMail()">{{ text.resend }}</a>- <p *ngIf="cancelled">Sorry, something went wrong. Please try to resend mail.</p>- </span>- <ng-template #confirmedStatus>- <span class="status--confirmed">confirmed ✓</span>- </ng-template>- </p>- </div>+ <div class="op-modal--modal-header">+ <h3 *ngIf="!eeTrialService.status"> {{ text.label_test_ee }}</h3>+ <h3 *ngIf="eeTrialService.status === 'mailSubmitted'">Confirmation of email-address</h3>+ <h3 *ngIf="eeTrialService.status === 'startTrial'">Next steps</h3>+ <a *ngIf="showClose" class="op-modal--modal-close-button">+ <i class="icon-close"+ (click)="closeModal($event)"+ [attr.title]="text.close_popup">+ </i>+ </a>+ </div>- <div *ngIf="status === 'startTrial'">- <h2>Get an overview</h2>- <div class="onboarding--video-block">- <div class="onboarding--video-text">- <span>Get a quick overview of project management and team collaboration with OpenProject.</span>- </div>- <div class="onboarding--video iframe-target-wrapper">- <iframe frameborder="0"- height="400"- width="100%"- allowfullscreen=""- src="https://player.vimeo.com/video/163426858?autoplay=1">- </iframe>- </div>+ <div class="op-modal--modal-body">+ <!-- first modal window -->+ <div *ngIf="!eeTrialService.status">+ <enterprise-trial-form></enterprise-trial-form>+ </div>+ <!-- second modal window -->+ <div *ngIf="eeTrialService.status === 'mailSubmitted'">+ <enterprise-trial-waiting></enterprise-trial-waiting>+ </div>+ <!-- third modal window -->+ <div *ngIf="eeTrialService.status === 'startTrial'">+ <h2>Get an overview</h2>+ <div class="onboarding--video-block">+ <div class="onboarding--video-text">+ <span>Get a quick overview of project management and team collaboration with OpenProject.</span>+ </div>+ <div class="onboarding--video iframe-target-wrapper">+ <iframe frameborder="0"+ height="400"+ width="100%"+ allowfullscreen=""+ src="https://player.vimeo.com/video/163426858?autoplay=1">+ </iframe></div></div></div>+ </div>- <div class="op-modal--modal-footer">- <div *ngIf="!status; else mailSubmitted">- <button class="confirm-form-submit--continue button -highlight"- (click)="onSubmit()"- [disabled]="!enterpriseTrialForm.valid"- [textContent]="text.button_submit"- [attr.title]="text.button_submit"- [hidden]="status === 'mailSubmitted'">- </button>- <button class="confirm-form-submit--cancel button"- (click)="closeModal($event)"- [textContent]="text.button_cancel"- [attr.title]="text.button_cancel">- </button>- </div>- <ng-template #mailSubmitted>- <button class="confirm-form-submit--continue button -highlight"- (click)="startEnterpriseTrial()"- [textContent]="text.button_continue"- [attr.title]="text.button_continue"- [disabled]="!confirmed"- [hidden]="status === 'startTrial'">- </button>- <button *ngIf="status === 'startTrial'"- class="confirm-form-submit--continue button -highlight"- (click)="closeModal($event)"- [textContent]="text.button_continue"- [attr.title]="text.button_continue">- </button>- </ng-template>+ <div class="op-modal--modal-footer">+ <div *ngIf="!eeTrialService.status; else mailSubmitted">+ <button class="confirm-form-submit--continue button -highlight"+ (click)="onSubmit()"+ [disabled]="!trialForm || trialForm.invalid"+ [textContent]="text.button_submit"+ [attr.title]="text.button_submit"+ [hidden]="eeTrialService.status === 'mailSubmitted'">+ </button>+ <button class="confirm-form-submit--cancel button"+ (click)="closeModal($event)"+ [textContent]="text.button_cancel"+ [attr.title]="text.button_cancel">+ </button></div>-+ <ng-template #mailSubmitted>+ <button class="confirm-form-submit--continue button -highlight"+ (click)="startEnterpriseTrial()"+ [textContent]="text.button_continue"+ [attr.title]="text.button_continue"+ [disabled]="!eeTrialService.confirmed"+ [hidden]="eeTrialService.status === 'startTrial'">+ </button>+ <button *ngIf="eeTrialService.status === 'startTrial'"+ class="confirm-form-submit--continue button -highlight"+ (click)="closeModal($event)"+ [textContent]="text.button_continue"+ [attr.title]="text.button_continue">+ </button>+ </ng-template></div>- </div>\ No newline at end of file++ </div>+</div>\ No newline at end of filediff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.sass b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.sassindex 8a86e985107..4ff8beda103 100644--- a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.sass+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.sass@@ -1,21 +1,4 @@@import 'helpers'.op-modal--modal-body- max-height: 65vh--#enterprise-trial-form- .-error- .form--field-instructions,- .form--label,- .form--label::after- color: var(--content-form-danger-zone-bg-color)- .form--text-field- border: 1px solid var(--content-form-danger-zone-bg-color)--#resend-link- float: right--.status--confirmed- color: var(--button--alt-highlight-background-color)-.status--waiting- color: orange\ No newline at end of file+ max-height: 65vh\ No newline at end of filediff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.ts b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.tsindex 0d713a7db7c..c651ac18e01 100644--- a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.ts+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.ts@@ -26,17 +26,17 @@// See docs/COPYRIGHT.rdoc for more details.// ++-import {ChangeDetectorRef, Component, ElementRef, Inject, Input} from "@angular/core";+import {AfterViewInit, ChangeDetectorRef, Component, ElementRef, Inject, Input, ViewChild} from "@angular/core";import {HttpClient, HttpErrorResponse} from "@angular/common/http";import {FormBuilder, FormControl, FormGroup, Validators} from "@angular/forms";import {OpModalComponent} from "app/components/op-modals/op-modal.component";import {OpModalLocalsToken} from "app/components/op-modals/op-modal.service";import {OpModalLocalsMap} from "app/components/op-modals/op-modal.types";import {I18nService} from "app/modules/common/i18n/i18n.service";-import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service";-import {enterpriseEditionUrl} from "core-app/globals/constants.const";import {PathHelperService} from "core-app/modules/common/path-helper/path-helper.service";import {NotificationsService} from "core-app/modules/common/notifications/notifications.service";+import {EETrialFormComponent} from "core-components/enterprise/enterprise-modal/enterprise-trial-form/ee-trial-form.component";+import {EnterpriseTrialService} from "core-components/enterprise/enterprise-trial.service";export interface EnterpriseTrialOptions {text:{@@ -51,29 +51,18 @@ export interface EnterpriseTrialOptions {}@Component({+ selector: 'enterprise-trial-modal',templateUrl: './enterprise-trial.modal.html',styleUrls: ['./enterprise-trial.modal.sass']})-export class EnterpriseTrialModal extends OpModalComponent {+export class EnterpriseTrialModal extends OpModalComponent implements AfterViewInit {+ @ViewChild(EETrialFormComponent, { static: false }) formComponent:EETrialFormComponent;@Input() public opReferrer:string;- // enterprise form- enterpriseTrialForm = this.formBuilder.group({- company: ['', Validators.required],- first_name: ['', Validators.required],- last_name: ['', Validators.required],- email: ['', [Validators.required, Validators.email]],- domain: ['', Validators.required],- general_consent: [null, Validators.required],- newsletter_consent: null,- });-- public baseUrlAugur = 'https://augur.openproject-edge.com';- public trialLink:string;- public resendLink:string;+ public trialForm:FormGroup;public showClose:boolean;- public confirmed = false;+ public confirmed:boolean;public cancelled = false;public status:string;public errorMsg:string|undefined;@@ -86,11 +75,6 @@ export class EnterpriseTrialModal extends OpModalComponent {button_continue: this.I18n.t('js.button_continue'),close_popup: this.I18n.t('js.close_popup_title'),label_test_ee: this.I18n.t('js.admin.enterprise.trial.test_ee'),- label_company: this.I18n.t('js.admin.enterprise.trial.label_company'),- label_first_name: this.I18n.t('js.admin.enterprise.trial.label_first_name'),- label_last_name: this.I18n.t('js.admin.enterprise.trial.label_last_name'),- label_email: this.I18n.t('js.admin.enterprise.trial.label_email'),- label_domain: this.I18n.t('js.admin.enterprise.trial.label_domain'),next_step: this.I18n.t('js.admin.enterprise.trial.next_step'),resend: this.I18n.t('js.admin.enterprise.trial.resend_link'),title: this.I18n.t('js.modals.form_submit.title'),@@ -104,7 +88,7 @@ export class EnterpriseTrialModal extends OpModalComponent {protected http:HttpClient,readonly pathHelper:PathHelperService,protected notificationsService:NotificationsService,- private formBuilder:FormBuilder) {+ public eeTrialService:EnterpriseTrialService) {super(locals, cdRef, elementRef);// modal configuration@@ -117,140 +101,32 @@ export class EnterpriseTrialModal extends OpModalComponent {this.text = _.defaults(this.options.text, this.text);}- // checks if form is valid and submits it- public onSubmit() {- if (this.enterpriseTrialForm.valid) {- this.enterpriseTrialForm.addControl('_type', new FormControl('enterprise-trial'));-- this.sendForm(this.enterpriseTrialForm.value);- }- }-- // sends POST request with form object- // receives an enterprise trial link to access a token- private sendForm(form:FormGroup) {- const delay = 5000; // wait 5s until next request- const retries = 60; // keep trying for 5 minutes- const trialPath = 'https://augur.openproject-edge.com/public/v1/trials';-- // POST /public/v1/trials/- this.http.post(trialPath, form)- .toPromise()- .then((enterpriseTrial:any) => {- this.trialLink = enterpriseTrial._links.self.href;-- this.retryConfirmation(delay, retries);- })- .catch((error:HttpErrorResponse) => {- // mail is invalid or user already created a trial- if (error.status === 422 || error.status === 400) {- this.errorMsg = error.error.description;- } else {- // 500 -> internal error occured- this.notificationsService.addWarning(error.error.description || I18n.t('js.error.internal'));- }- });- }-- // gets a token from the trial link if user confirmed mail- private getToken() {- // 2) GET /public/v1/trials/:id- this.http- .get<any>(this.baseUrlAugur + this.trialLink)- .toPromise()- .then((res:any) => {- // show confirmed status and enable continue btn- this.confirmed = true;- // returns token if mail was confirmed -> save token in backend- this.saveToken(res.token);- })- .catch((error:HttpErrorResponse) => {- // returns error 422 while waiting of confirmation- if (error.status === 422 && error.error.identifier === 'waiting_for_email_verification') {- // open next modal window -> status waiting- this.status = 'mailSubmitted';- // get resend button link- this.resendLink = error.error._links.resend.href;- } else if (_.get(error, 'error._type') === 'Error') {- this.notificationsService.addWarning(error.error.message);- } else {- // backend returned an unsuccessful response code- this.notificationsService.addWarning(error.error);- }- });+ ngAfterViewInit() {+ this.trialForm = this.formComponent.trialForm;}- // saves received token in controller- private saveToken(token:string) {- // POST /admin/enterprise (params[:enterprise_token][:encoded_token])- // -> if token is new (token_retrieved: false) save token in ruby controller- this.http.post(this.pathHelper.api.v3.appBasePath + '/admin/enterprise', { enterprise_token: { encoded_token: token } }, { withCredentials: true })- .toPromise()- .then((res:any) => {- console.log('saveToken() success: ', res);- })- .catch((error:HttpErrorResponse) => {- console.log('saveToken() failed: ', error.error);- this.notificationsService.addWarning(error.error.description || I18n.t('js.error.internal'));- });- }+ // checks if form is valid and submits it+ public onSubmit() {+ if (this.trialForm.valid) {+ this.trialForm.addControl('_type', new FormControl('enterprise-trial'));- // retries request while waiting for mail confirmation- private retryConfirmation(delay:number, retries:number) {- if (this.cancelled || this.confirmed) {- // stop if action was cancelled or confirmation link was clicked- return;- } else if (retries === 0) {- // action timed out -> show message- this.cancelled = true;- } else {- // retry as long as limit isn't reached- this.getToken();- setTimeout( () => {- this.retryConfirmation(delay, retries - 1);- }, delay);+ this.eeTrialService.cancelled = false;+ this.eeTrialService.sendForm(this.trialForm.value);}}// TODO: add enterprise onboarding youtube videopublic startEnterpriseTrial() {// open onboarding modal- this.status = 'startTrial';- }-- // resends mail if resend link has been clicked- public resendMail() {- this.http.post(this.baseUrlAugur + this.resendLink, {})- .toPromise()- .then((enterpriseTrial:any) => {- console.log('Mail has been resent.');- this.notificationsService.addSuccess('Mail has been resent. Please check your mails and click the confirmation link provided.');-- this.cancelled = false;- this.retryConfirmation(5000, 6);- })- .catch((error:HttpErrorResponse) => {- console.log('An Error occured: ', error);- this.notificationsService.addWarning('Could not resend mail.');- });- }-- // checks if mail is valid after input field was edited by the user- // displays message for user- public checkMailField() {- if (this.enterpriseTrialForm.value.email !== '' && this.enterpriseTrialForm.controls.email.errors) {- this.errorMsg = 'Invalid e-mail address';- } else {- this.errorMsg = undefined;- }+ this.eeTrialService.status = 'startTrial';}public closeModal(event:any) {// cancel all actions (e.g. an already send request)- this.cancelled = true;+ this.eeTrialService.cancelled = true;this.closeMe(event);// refresh page to show enterprise trial- if (this.status === 'startTrial' || this.confirmed) {+ if (this.eeTrialService.status === 'startTrial' || this.eeTrialService.confirmed) {window.location.reload();}}diff --git a/frontend/src/app/components/enterprise/enterprise-trial.service.ts b/frontend/src/app/components/enterprise/enterprise-trial.service.tsnew file mode 100644index 00000000000..72a210964fc--- /dev/null+++ b/frontend/src/app/components/enterprise/enterprise-trial.service.ts@@ -0,0 +1,132 @@+import {Injectable} from "@angular/core";+import {I18nService} from "core-app/modules/common/i18n/i18n.service";+import {HttpClient, HttpErrorResponse} from "@angular/common/http";+import {PathHelperService} from "core-app/modules/common/path-helper/path-helper.service";+import {NotificationsService} from "core-app/modules/common/notifications/notifications.service";+import {FormGroup} from "@angular/forms";+++@Injectable()+export class EnterpriseTrialService {+ public trialForm:FormGroup;+ public baseUrlAugur = 'https://augur.openproject-edge.com';+ public trialLink:string;+ public resendLink:string;++ public confirmed:boolean;+ public cancelled = false;+ public status:string|undefined;+ public errorMsg:string|undefined;++ constructor(readonly I18n:I18nService,+ protected http:HttpClient,+ readonly pathHelper:PathHelperService,+ protected notificationsService:NotificationsService) {+ }++ // sends POST request with form object+ // receives an enterprise trial link to access a token+ public sendForm(form:FormGroup) {+ this.trialForm = form;+ const delay = 5000; // wait 5s until next request+ const retries = 60; // keep trying for 5 minutes++ // POST /public/v1/trials/+ this.http.post(this.baseUrlAugur + '/public/v1/trials', form)+ .toPromise()+ .then((enterpriseTrial:any) => {+ console.log('Form successfully send: ', this.trialForm);+ this.trialLink = enterpriseTrial._links.self.href;++ this.retryConfirmation(delay, retries);+ })+ .catch((error:HttpErrorResponse) => {+ // mail is invalid or user already created a trial+ if (error.status === 422 || error.status === 400) {+ this.errorMsg = error.error.description;+ } else {+ // 500 -> internal error occured+ this.notificationsService.addWarning(error.error.description || I18n.t('js.error.internal'));+ }+ });+ }++ // gets a token from the trial link if user confirmed mail+ private getToken() {+ // 2) GET /public/v1/trials/:id+ this.http+ .get<any>(this.baseUrlAugur + this.trialLink)+ .toPromise()+ .then((res:any) => {+ // show confirmed status and enable continue btn+ this.confirmed = true;+ // returns token if mail was confirmed -> save token in backend+ console.log('res.token_retrieved: ', res.token_retrieved);+ this.saveToken(res.token);+ })+ .catch((error:HttpErrorResponse) => {+ // returns error 422 while waiting of confirmation+ if (error.status === 422 && error.error.identifier === 'waiting_for_email_verification') {+ // open next modal window -> status waiting+ this.status = 'mailSubmitted';+ this.confirmed = false;++ // get resend button link+ this.resendLink = error.error._links.resend.href;+ } else if (_.get(error, 'error._type') === 'Error') {+ this.notificationsService.addWarning(error.error.message);+ } else {+ // backend returned an unsuccessful response code+ this.notificationsService.addWarning(error.error);+ }+ });+ }++ // saves received token in controller+ private saveToken(token:string) {+ // POST /admin/enterprise (params[:enterprise_token][:encoded_token])+ // -> if token is new (token_retrieved: false) save token in ruby controller+ this.http.post(this.pathHelper.api.v3.appBasePath + '/admin/enterprise', { enterprise_token: { encoded_token: token } }, { withCredentials: true })+ .toPromise()+ .then((res:any) => {+ console.log('saveToken() success: ', res);+ })+ .catch((error:HttpErrorResponse) => {+ console.log('saveToken() failed: ', error.error);+ this.notificationsService.addWarning(error.error.description || I18n.t('js.error.internal'));+ });+ }++ // retries request while waiting for mail confirmation+ public retryConfirmation(delay:number, retries:number) {+ if (this.cancelled || this.confirmed) {+ // stop if action was cancelled or confirmation link was clicked+ return;+ } else if (retries === 0) {+ // action timed out -> show message+ this.cancelled = true;+ } else {+ // retry as long as limit isn't reached+ this.getToken();+ setTimeout( () => {+ this.retryConfirmation(delay, retries - 1);+ }, delay);+ }+ }++ // resends mail if resend link has been clicked+ public resendMail() {+ this.http.post(this.baseUrlAugur + this.resendLink, {})+ .toPromise()+ .then((enterpriseTrial:any) => {+ this.notificationsService.addSuccess('Mail has been resent. Please check your mails and click the confirmation link provided.');++ this.cancelled = false;+ this.retryConfirmation(5000, 60);+ })+ .catch((error:HttpErrorResponse) => {+ console.log('An Error occured: ', error);+ this.notificationsService.addWarning('Could not resend mail.');+ });+ }+}\ No newline at end of filediff --git a/frontend/src/app/components/enterprise/enterprise.component.html b/frontend/src/app/components/enterprise/enterprise.component.htmldeleted file mode 100644index fc05b932306..00000000000--- a/frontend/src/app/components/enterprise/enterprise.component.html+++ /dev/null@@ -1,12 +0,0 @@-<div class='upsale--actions'>- <button class="button -alt-highlight" (click)="openTrialModal()">{{ text.button_trial }}</button>- <a href="javascript:void(0)"- class="button -highlight"- data-cb-type="checkout"- data-cb-plan-id="enterprise-edition---annual-user-license">- {{ text.button_book }}- </a>- <a href="https://www.openproject.org/upgrade-enterprise-edition/" target="_blank">- {{ text.link_quote }}- </a>-</div>\ No newline at end of filediff --git a/frontend/src/app/modules/common/openproject-common.module.ts b/frontend/src/app/modules/common/openproject-common.module.tsindex 801c527a016..6626c1a60a1 100644--- a/frontend/src/app/modules/common/openproject-common.module.ts+++ b/frontend/src/app/modules/common/openproject-common.module.ts@@ -63,7 +63,6 @@ import {ContentTabsComponent} from "core-app/modules/common/tabs/content-tabs/coimport {EditableToolbarTitleComponent} from "core-app/modules/common/editable-toolbar-title/editable-toolbar-title.component";import {UserAvatarComponent} from "core-components/user/user-avatar/user-avatar.component";import {EnterpriseBannerComponent} from "core-components/enterprise-banner/enterprise-banner.component";-import {EnterpriseComponent} from "core-components/enterprise/enterprise.component";import {EnterpriseBannerBootstrapComponent} from "core-components/enterprise-banner/enterprise-banner-bootstrap.component";import {DynamicModule} from "ng-dynamic-component";import {VersionAutocompleterComponent} from "core-app/modules/common/autocomplete/version-autocompleter.component";@@ -265,7 +264,6 @@ export function bootstrapModule(injector:Injector) {// Enterprise EditionEnterpriseBannerComponent,EnterpriseBannerBootstrapComponent,- EnterpriseComponent,// AutocompleterCreateAutocompleterComponent,