Skip to content

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

Show sharing upsale page when clicking the "shared with" query in the WP module. For the global wp page, I needed to add an extra route

Henriette Darge781fa59fe2c3
diff --git a/config/routes.rb b/config/routes.rb
index 0d0ddccdf60..87512fff146 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -493,6 +493,7 @@ OpenProject::Application.routes.draw do
get '/new' => 'work_packages#index', on: :collection, as: 'new', state: 'new'
# We do not want to match the work package export routes
get '(/*state)' => 'work_packages#show', on: :member, as: '', constraints: { id: /\d+/ }
+ get '/share_upsale' => 'work_packages#index', on: :collection, as: ''
get '/edit' => 'work_packages#show', on: :member, as: 'edit'
end
diff --git a/frontend/src/app/features/enterprise/enterprise-trial.service.ts b/frontend/src/app/features/enterprise/enterprise-trial.service.ts
index 75800d2861d..27a3722ed5e 100644
--- a/frontend/src/app/features/enterprise/enterprise-trial.service.ts
+++ b/frontend/src/app/features/enterprise/enterprise-trial.service.ts
@@ -28,29 +28,16 @@
import { Injectable } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
-import {
- HttpClient,
- HttpErrorResponse,
-} from '@angular/common/http';
+import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { Query } from '@datorama/akita';
-import {
- filter,
- map,
- shareReplay,
-} from 'rxjs/operators';
-
+import { filter, map, shareReplay } from 'rxjs/operators';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
import { ToastService } from 'core-app/shared/components/toaster/toast.service';
import { EXTERNAL_REQUEST_HEADER } from 'core-app/features/hal/http/openproject-header-interceptor';
import { EnterpriseTrialStore } from 'core-app/features/enterprise/enterprise-trial.store';
-import { GonType } from 'core-app/core/gon/gon.service';
-import {
- EnterpriseTrialErrorHalResource,
- EnterpriseTrialHalResource,
- IEnterpriseData,
- IEnterpriseTrial,
-} from 'core-app/features/enterprise/enterprise-trial.model';
+import { GonService } from 'core-app/core/gon/gon.service';
+import { EnterpriseTrialErrorHalResource, EnterpriseTrialHalResource, IEnterpriseData, IEnterpriseTrial } from 'core-app/features/enterprise/enterprise-trial.model';
import isDefinedEntity from 'core-app/core/state/is-defined-entity';
@Injectable()
@@ -113,15 +100,17 @@ export class EnterpriseTrialService {
taken_domain: this.I18n.t('js.admin.enterprise.trial.form.taken_domain'),
};
- constructor(readonly I18n:I18nService,
+ constructor(
+ readonly I18n:I18nService,
protected http:HttpClient,
readonly pathHelper:PathHelperService,
- protected toastService:ToastService) {
- const gon = window.gon as (GonType&{ augur_url:string, token_version:string, ee_trial_key?:string });
- this.baseUrlAugur = gon.augur_url;
- this.tokenVersion = gon.token_version;
+ protected toastService:ToastService,
+ readonly Gon:GonService,
+ ) {
+ this.baseUrlAugur = this.Gon.get('augur_url') as string;
+ this.tokenVersion = this.Gon.get('token_version') as string;
- if (gon.ee_trial_key) {
+ if (this.Gon.get('ee_trial_key')) {
this.setMailSubmittedStatus();
}
}
diff --git a/frontend/src/app/features/in-app-notifications/in-app-notifications.routes.ts b/frontend/src/app/features/in-app-notifications/in-app-notifications.routes.ts
index 3c8a4303f2c..21274f563f3 100644
--- a/frontend/src/app/features/in-app-notifications/in-app-notifications.routes.ts
+++ b/frontend/src/app/features/in-app-notifications/in-app-notifications.routes.ts
@@ -59,7 +59,7 @@ export const IAN_ROUTES:Ng2StateDeclaration[] = [
component: InAppNotificationsDateAlertsUpsaleComponent,
},
{
- url: '/share',
+ url: '/share_upsale',
name: 'notifications.share_upsale',
component: ShareUpsaleComponent,
},
diff --git a/frontend/src/app/features/work-packages/routing/work-packages-routes.ts b/frontend/src/app/features/work-packages/routing/work-packages-routes.ts
index 8ff1718c340..b70e63b382f 100644
--- a/frontend/src/app/features/work-packages/routing/work-packages-routes.ts
+++ b/frontend/src/app/features/work-packages/routing/work-packages-routes.ts
@@ -37,6 +37,7 @@ import { WorkPackageViewPageComponent } from 'core-app/features/work-packages/ro
import { makeSplitViewRoutes } from 'core-app/features/work-packages/routing/split-view-routes.template';
import { WorkPackageCopyFullViewComponent } from 'core-app/features/work-packages/components/wp-copy/wp-copy-full-view.component';
import { KeepTabService } from 'core-app/features/work-packages/components/wp-single-view-tabs/keep-tab/keep-tab.service';
+import { ShareUpsaleComponent } from 'core-app/features/enterprise/share-upsale/share-upsale.component';
export const menuItemClass = 'work-packages-menu-item';
@@ -148,6 +149,11 @@ export const WORK_PACKAGES_ROUTES:Ng2StateDeclaration[] = [
menuItemClass,
WorkPackageSplitViewComponent,
),
+ {
+ url: '/share_upsale',
+ name: 'work-packages.share_upsale',
+ component: ShareUpsaleComponent,
+ },
// Avoid lazy-loading the routes for now
// {
// name: 'work-packages.calendar.**',
diff --git a/frontend/src/app/shared/components/op-view-select/op-static-queries.service.ts b/frontend/src/app/shared/components/op-view-select/op-static-queries.service.ts
index 692e9af87cf..3b85809c52b 100644
--- a/frontend/src/app/shared/components/op-view-select/op-static-queries.service.ts
+++ b/frontend/src/app/shared/components/op-view-select/op-static-queries.service.ts
@@ -36,6 +36,7 @@ import { CurrentUserService } from 'core-app/core/current-user/current-user.serv
import { IOpSidemenuItem } from 'core-app/shared/components/sidemenu/sidemenu.component';
import { ViewType } from 'core-app/shared/components/op-view-select/op-view-select.component';
import { ConfigurationService } from 'core-app/core/config/configuration.service';
+import { BannersService } from 'core-app/core/enterprise/banners.service';
interface IStaticQuery extends IOpSidemenuItem {
view:ViewType;
@@ -52,6 +53,7 @@ export class StaticQueriesService {
private readonly PathHelper:PathHelperService,
private readonly CurrentUser:CurrentUserService,
private readonly configurationService:ConfigurationService,
+ private readonly bannersService:BannersService,
) {
this.staticQueries = this.buildQueries();
}
@@ -230,13 +232,9 @@ export class StaticQueriesService {
},
{
title: this.text.shared_with_users,
- uiSref: 'work-packages',
- uiParams: {
- query_id: '',
- query_props: '{"c":["id","subject","type","project"],"hi":false,"g":"","t":"updatedAt:desc,id:asc","f":[{"n":"sharedWithUser","o":"*","v":[]}]}',
- },
view: 'WorkPackagesTable',
isEnterprise: true,
+ ...this.eeGuardedShareRoute,
},
{
title: this.text.created_by_me,
@@ -258,4 +256,18 @@ export class StaticQueriesService {
},
];
}
+
+ private get eeGuardedShareRoute() {
+ if (this.bannersService.eeShowBanners) {
+ return { uiSref: 'work-packages.share_upsale', uiParams: null, uiOptions: { inherit: false } };
+ }
+
+ return {
+ uiSref: 'work-packages',
+ uiParams: {
+ query_id: '',
+ query_props: '{"c":["id","subject","type","project"],"hi":false,"g":"","t":"updatedAt:desc,id:asc","f":[{"n":"sharedWithUser","o":"*","v":[]}]}',
+ },
+ };
+ }
}