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
Identify "new" query path as an empty query_id
Oliver Günther94595e908c1d
diff --git a/frontend/src/app/core/routing/openproject.routes.ts b/frontend/src/app/core/routing/openproject.routes.tsindex 10cc37d8080..b7e64375bd2 100644--- a/frontend/src/app/core/routing/openproject.routes.ts+++ b/frontend/src/app/core/routing/openproject.routes.ts@@ -208,6 +208,18 @@ export function uiRouterConfiguration(uiRouter:UIRouter, injector:Injector, moduequals: (a:any, b:any) => _.isEqual(a, b),},);++ uiRouter.urlService.config.type(+ 'opQueryId',+ {+ encode: (id:string|null) => id || 'new',+ decode: (id:string) => (id === 'new' ? null : id),+ raw: true,+ dynamic: true,+ is: (val:unknown) => typeof (val) === 'string',+ equals: (a:unknown, b:unknown) => _.isEqual(a, b),+ },+ );}export function initializeUiRouterListeners(injector:Injector) {diff --git a/frontend/src/app/features/calendar/op-calendar.service.ts b/frontend/src/app/features/calendar/op-calendar.service.tsindex 032f6b92697..218bcf34c4d 100644--- a/frontend/src/app/features/calendar/op-calendar.service.ts+++ b/frontend/src/app/features/calendar/op-calendar.service.ts@@ -159,7 +159,7 @@ export class OpCalendarService extends UntilDestroyedMixin {const endDate = moment(fetchInfo.end).format('YYYY-MM-DD');let queryId:string|null = null;- if (this.urlParams.query_id && this.urlParams.query_id !== 'new') {+ if (this.urlParams.query_id) {queryId = this.urlParams.query_id as string;}@@ -314,14 +314,16 @@ export class OpCalendarService extends UntilDestroyedMixin {}private get initializingWithQuery():boolean {- return (this.areFiltersEmpty && this.urlParams.query_id && !this.urlParams.query_props) as boolean;+ return this.areFiltersEmpty+ && !!this.urlParams.query_id+ && !this.urlParams.query_props;}private get urlParams() {return this.uiRouterGlobals.params;}- private get areFiltersEmpty() {+ private get areFiltersEmpty():boolean {return this.wpTableFilters.isEmpty;}diff --git a/frontend/src/app/features/team-planner/team-planner/team-planner.routes.ts b/frontend/src/app/features/team-planner/team-planner/team-planner.routes.tsindex 4fbc0854f10..e91bbf147a2 100644--- a/frontend/src/app/features/team-planner/team-planner/team-planner.routes.ts+++ b/frontend/src/app/features/team-planner/team-planner/team-planner.routes.ts@@ -37,13 +37,13 @@ export const TEAM_PLANNER_ROUTES:Ng2StateDeclaration[] = [{name: 'team_planner',parent: 'optional_project',- url: '/team_planners/{query_id}?query_props&cdate&cview',+ url: '/team_planners/:query_id?query_props&cdate&cview',redirectTo: 'team_planner.page',views: {'!$default': { component: WorkPackagesBaseComponent },},params: {- query_id: { type: 'query' },+ query_id: { type: 'opQueryId', dynamic: true },cdate: { type: 'string', dynamic: true },cview: { type: 'string', dynamic: true },// Use custom encoder/decoder that ensures validity of URL stringdiff --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.tsindex 9bf0d438722..a8d42cfb007 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@@ -194,7 +194,7 @@ export class StaticQueriesService {title: this.text.create_new_team_planner,uiSref: 'team_planner.page.show',uiParams: {- query_id: '',+ query_id: null,query_props: '',},view: 'TeamPlanner',diff --git a/frontend/src/app/shared/components/op-view-select/op-view-select.component.ts b/frontend/src/app/shared/components/op-view-select/op-view-select.component.tsindex 12df6454b1d..c2903ce42ee 100644--- a/frontend/src/app/shared/components/op-view-select/op-view-select.component.ts+++ b/frontend/src/app/shared/components/op-view-select/op-view-select.component.ts@@ -55,7 +55,7 @@ import { ApiV3ListParameters } from 'core-app/core/apiv3/paths/apiv3-list-resourimport { CurrentUserService } from 'core-app/core/current-user/current-user.service';import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';-export type ViewType = 'WorkPackagesTable'|'Bim'|'TeamPlanner';+export type ViewType = 'WorkPackagesTable'|'Bim'|'TeamPlanner'|'WorkPackagesCalendar';export const opViewSelectSelector = 'op-view-select';diff --git a/modules/team_planner/spec/features/team_planner_index_spec.rb b/modules/team_planner/spec/features/team_planner_index_spec.rbindex 7cd138e21a7..ee5441cbe8c 100644--- a/modules/team_planner/spec/features/team_planner_index_spec.rb+++ b/modules/team_planner/spec/features/team_planner_index_spec.rb@@ -51,6 +51,18 @@ describe 'Team planner index', type: :feature, js: true, with_ee: %i[team_planneexpect(page).to have_text 'There is currently nothing to display.'expect(page).to have_selector '.button', text: 'Create'end++ it 'can create an action through the sidebar' do+ click_on 'Create new planner'++ team_planner.expect_title++ # Also works from the frontend+ click_on 'Create new planner'++ team_planner.expect_no_toaster+ team_planner.expect_title+ endendcontext 'with an existing view' do