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
Make used Augur API configurable
Henriette Dinger36ab37f6936e
diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rbindex 13f663f5c2d..a2c074388dd 100644--- a/app/controllers/enterprises_controller.rb+++ b/app/controllers/enterprises_controller.rb@@ -43,8 +43,10 @@ class EnterprisesController < ApplicationController@current_token = EnterpriseToken.current@token = @current_token || EnterpriseToken.new+ write_augur_to_gon+if !@current_token.present?- initialize_gon+ write_trial_key_to_gonendend@@ -87,7 +89,9 @@ class EnterprisesController < ApplicationControllerToken::EnterpriseTrialKey.create(user_id: User.system.id, value: params[:trial_key])end- def initialize_gon+ private++ def write_trial_key_to_gon@trial_key = Token::EnterpriseTrialKey.find_by(user_id: User.system.id)if @trial_keygon.ee_trial_key = {@@ -96,7 +100,9 @@ class EnterprisesController < ApplicationControllerendend- private+ def write_augur_to_gon+ gon.augur_url = Rails.env.production? ? OpenProject::Configuration[:enterprise_trial_creation_host] : 'https://augur.openproject-edge.com'+ enddef default_breadcrumbt(:label_enterprise_edition)diff --git a/app/views/enterprises/_info.html.erb b/app/views/enterprises/_info.html.erbindex d16501b47d9..5bb81085d4e 100644--- a/app/views/enterprises/_info.html.erb+++ b/app/views/enterprises/_info.html.erb@@ -32,10 +32,6 @@ See docs/COPYRIGHT.rdoc for more details.</script><% end %>-<%= nonced_javascript_tag do %>- <%= include_gon(need_tag: false) -%>-<% end %>-<enterprise-base></enterprise-base><div class='upsale--actions'>diff --git a/app/views/enterprises/show.html.erb b/app/views/enterprises/show.html.erbindex 60cab9ab87b..d8aa1e6e2a6 100644--- a/app/views/enterprises/show.html.erb+++ b/app/views/enterprises/show.html.erb@@ -2,6 +2,10 @@<%= toolbar title: t(:label_enterprise_edition) %>+<%= nonced_javascript_tag do %>+ <%= include_gon(need_tag: false) -%>+<% end %>+<%= error_messages_for 'token' %><% if @current_token.present? %>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 4661b11a2a4..50f90ed7dbe 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@@ -30,7 +30,7 @@ import {ChangeDetectorRef, Component, ElementRef, OnInit} from "@angular/core";import {distinctUntilChanged} from "rxjs/operators";import {UntilDestroyedMixin} from "core-app/helpers/angular/until-destroyed.mixin";import {I18nService} from "app/modules/common/i18n/i18n.service";-import {baseUrlAugur, EnterpriseTrialService} from "app/components/enterprise/enterprise-trial.service";+import {EnterpriseTrialService} from "app/components/enterprise/enterprise-trial.service";import {HttpClient, HttpErrorResponse} from "@angular/common/http";export const enterpriseActiveTrialSelector = 'enterprise-active-trial';@@ -85,7 +85,7 @@ export class EEActiveTrialComponent extends UntilDestroyedMixin implements OnIniif (eeTrialKey && !this.eeTrialService.userData) {// after reload: get data from Augur using the trial key saved in gon- this.eeTrialService.trialLink = baseUrlAugur + '/public/v1/trials/' + eeTrialKey.value;+ this.eeTrialService.trialLink = this.eeTrialService.baseUrlAugur + '/public/v1/trials/' + eeTrialKey.value;this.getUserDataFromAugur();}}diff --git a/frontend/src/app/components/enterprise/enterprise-trial.service.ts b/frontend/src/app/components/enterprise/enterprise-trial.service.tsindex 2d1a25891d3..17572cb3e4e 100644--- a/frontend/src/app/components/enterprise/enterprise-trial.service.ts+++ b/frontend/src/app/components/enterprise/enterprise-trial.service.ts@@ -6,14 +6,14 @@ import {NotificationsService} from "core-app/modules/common/notifications/notifiimport {FormGroup} from "@angular/forms";import {BehaviorSubject} from 'rxjs';-export const baseUrlAugur = 'https://augur.openproject-edge.com';-@Injectable()export class EnterpriseTrialService {// user data needs to be sync in ee-active-trial.component.tsprivate userDataSubject = new BehaviorSubject<any>({});public userData$ = this.userDataSubject.asObservable();public userData:{subscriber:string, email:string};+ public baseUrlAugur:string;+public trialLink:string;public resendLink:string;@@ -28,7 +28,10 @@ export class EnterpriseTrialService {protected http:HttpClient,readonly pathHelper:PathHelperService,protected notificationsService:NotificationsService) {- if ((window as any).gon) {+ let gon = (window as any).gon;+ this.baseUrlAugur = gon.augur_url;++ if ((window as any).gon.ee_trial_key) {this.setMailSubmittedStatus();}}@@ -43,7 +46,7 @@ export class EnterpriseTrialService {this.userDataSubject.next(this.userData);this.cancelled = false;- this.http.post(baseUrlAugur + '/public/v1/trials', form.value)+ this.http.post(this.baseUrlAugur + '/public/v1/trials', form.value).toPromise().then((enterpriseTrial:any) => {this.trialLink = enterpriseTrial._links.self.href;