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

Re-add queryId to pass to the Submenu target url . Otherwise the wrong element will be highlighted in the submenu. This was accidentally removed during the refactoring of the boards submenu

Henriette Darge142b8834af1f
diff --git a/frontend/src/app/core/main-menu/submenu.service.ts b/frontend/src/app/core/main-menu/submenu.service.ts
index 941a9cd5cc6..95a9cf3cc2e 100644
--- a/frontend/src/app/core/main-menu/submenu.service.ts
+++ b/frontend/src/app/core/main-menu/submenu.service.ts
@@ -6,16 +6,30 @@ import { StateService } from '@uirouter/core';
export class SubmenuService {
constructor(protected $state:StateService) {}
- reloadSubmenu():void {
+ reloadSubmenu(selectedQueryId:string|null):void {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
const menuIdentifier:string|undefined = this.$state.current.data.sideMenuOptions?.sidemenuId;
if (menuIdentifier) {
const menu = (document.getElementById(menuIdentifier) as HTMLElement&TurboElement);
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ const sideMenuOptions = this.$state.$current.data?.sideMenuOptions as { hardReloadOnBaseRoute?:boolean, defaultQuery?:string };
const currentSrc = menu.getAttribute('src');
if (currentSrc && menu) {
const frameUrl = new URL(currentSrc);
+ const defaultQuery = sideMenuOptions.defaultQuery;
+
+ if (selectedQueryId) {
+ // If there is a default query passed in the route definition, it means that id passed as argument and not as parameter,
+ // e.g. calendars/:id, team_planner/:id, ...
+ // Otherwise, we will just replace the params
+ if (defaultQuery) {
+ frameUrl.search = `?id=${selectedQueryId}`;
+ } else {
+ frameUrl.search = `?query_id=${selectedQueryId}`;
+ }
+ }
// Override the frame src to enforce a reload
menu.setAttribute('src', frameUrl.href);
diff --git a/frontend/src/app/features/boards/board/board-partitioned-page/board-partitioned-page.component.ts b/frontend/src/app/features/boards/board/board-partitioned-page/board-partitioned-page.component.ts
index f27b4581cbb..9aa35c27722 100644
--- a/frontend/src/app/features/boards/board/board-partitioned-page/board-partitioned-page.component.ts
+++ b/frontend/src/app/features/boards/board/board-partitioned-page/board-partitioned-page.component.ts
@@ -9,9 +9,11 @@ import {
ToolbarButtonComponentDefinition,
ViewPartitionState,
} from 'core-app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component';
-import { StateService, TransitionService } from '@uirouter/core';
+import {
+ StateService,
+ TransitionService,
+} from '@uirouter/core';
import { BoardFilterComponent } from 'core-app/features/boards/board/board-filter/board-filter.component';
-import { Board } from 'core-app/features/boards/board/board';
import { ToastService } from 'core-app/shared/components/toaster/toast.service';
import { HalResourceNotificationService } from 'core-app/features/hal/services/hal-resource-notification.service';
import { BoardService } from 'core-app/features/boards/board/board.service';
@@ -19,13 +21,10 @@ import { DragAndDropService } from 'core-app/shared/helpers/drag-and-drop/drag-a
import { WorkPackageFilterButtonComponent } from 'core-app/features/work-packages/components/wp-buttons/wp-filter-button/wp-filter-button.component';
import { ZenModeButtonComponent } from 'core-app/features/work-packages/components/wp-buttons/zen-mode-toggle-button/zen-mode-toggle-button.component';
import { BoardsMenuButtonComponent } from 'core-app/features/boards/board/toolbar-menu/boards-menu-button.component';
-import { RequestSwitchmap } from 'core-app/shared/helpers/rxjs/request-switchmap';
-import { componentDestroyed } from '@w11k/ngx-componentdestroyed';
import {
catchError,
finalize,
take,
- tap,
} from 'rxjs/operators';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
@@ -35,11 +34,7 @@ import { BoardFiltersService } from 'core-app/features/boards/board/board-filter
import { CardViewHandlerRegistry } from 'core-app/features/work-packages/components/wp-card-view/event-handler/card-view-handler-registry';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import { OpTitleService } from 'core-app/core/html/op-title.service';
-import {
- EMPTY,
- Observable,
- of,
-} from 'rxjs';
+import { EMPTY } from 'rxjs';
import { SubmenuService } from 'core-app/core/main-menu/submenu.service';
export function boardCardViewHandlerFactory(injector:Injector) {
@@ -249,6 +244,6 @@ export class BoardPartitionedPageComponent extends UntilDestroyedMixin {
}
private reloadSidemenu():void {
- this.submenuService.reloadSubmenu();
+ this.submenuService.reloadSubmenu(null);
}
}
diff --git a/frontend/src/app/features/work-packages/components/wp-list/wp-list.service.ts b/frontend/src/app/features/work-packages/components/wp-list/wp-list.service.ts
index 6f6d1935378..6652798f7b0 100644
--- a/frontend/src/app/features/work-packages/components/wp-list/wp-list.service.ts
+++ b/frontend/src/app/features/work-packages/components/wp-list/wp-list.service.ts
@@ -262,7 +262,7 @@ export class WorkPackagesListService {
// Reload the query, and then reload the menu
this.reloadQuery(createdQuery).subscribe(() => {
this.states.changes.queries.next(createdQuery.id);
- this.reloadSidemenu();
+ this.reloadSidemenu(createdQuery.id);
});
return createdQuery;
@@ -313,7 +313,7 @@ export class WorkPackagesListService {
if (queryAccessibleByUser) {
void this.$state.go('.', { query_id: query.id, query_props: null }, { reload: true });
this.states.changes.queries.next(query.id);
- this.reloadSidemenu();
+ this.reloadSidemenu(query.id);
} else {
this.navigateToDefaultQuery(query);
}
@@ -344,7 +344,7 @@ export class WorkPackagesListService {
this.toastService.addSuccess(this.I18n.t('js.notice_successful_update'));
this.states.changes.queries.next(query.id!);
- this.reloadSidemenu();
+ this.reloadSidemenu(query.id);
});
return promise;
@@ -458,11 +458,11 @@ export class WorkPackagesListService {
void this.loadDefaultQuery(projectId);
this.states.changes.queries.next(query.id);
- this.reloadSidemenu();
+ this.reloadSidemenu(null);
}
}
- private reloadSidemenu():void {
- this.submenuService.reloadSubmenu();
+ private reloadSidemenu(selectedQueryId:string|null):void {
+ this.submenuService.reloadSubmenu(selectedQueryId);
}
}
diff --git a/modules/calendar/spec/features/query_handling_spec.rb b/modules/calendar/spec/features/query_handling_spec.rb
index ce2194667eb..7d1f21cc932 100644
--- a/modules/calendar/spec/features/query_handling_spec.rb
+++ b/modules/calendar/spec/features/query_handling_spec.rb
@@ -141,7 +141,7 @@ RSpec.describe "Calendar query handling", :js do
calendar_page.expect_and_dismiss_toaster(message: I18n.t("js.notice_successful_create"))
# The saved query appears in the side menu...
- query_menu.expect_item "I am your Query"
+ query_menu.expect_item "I am your Query", selected: true
query_menu.expect_item saved_query.name
# .. but not in the work packages module
diff --git a/modules/team_planner/spec/features/query_handling_spec.rb b/modules/team_planner/spec/features/query_handling_spec.rb
index 005c10402b8..fb9d6d31238 100644
--- a/modules/team_planner/spec/features/query_handling_spec.rb
+++ b/modules/team_planner/spec/features/query_handling_spec.rb
@@ -128,7 +128,7 @@ RSpec.describe "Team planner query handling", :js, with_ee: %i[team_planner_view
team_planner.expect_and_dismiss_toaster(message: I18n.t("js.notice_successful_create"))
# The saved query appears in the side menu...
- query_menu.expect_item "I am your Query"
+ query_menu.expect_item "I am your Query", selected: true
# .. but not in the work packages module
work_package_page.visit!
diff --git a/spec/features/views/shared_examples.rb b/spec/features/views/shared_examples.rb
index 36a20470770..a6a328f313c 100644
--- a/spec/features/views/shared_examples.rb
+++ b/spec/features/views/shared_examples.rb
@@ -44,7 +44,7 @@ RSpec.shared_examples "module specific query view management" do
settings_menu.open_and_save_query "My first query"
query_title.expect_not_changed
query_title.expect_title "My first query"
- query_menu.expect_item "My first query"
+ query_menu.expect_item "My first query", selected: true
# Change the filter again
filters.add_filter_by "% Complete", "is", ["25"], "percentageDone"
@@ -55,7 +55,7 @@ RSpec.shared_examples "module specific query view management" do
settings_menu.open_and_save_query_as "My second query"
query_title.expect_not_changed
query_title.expect_title "My second query"
- query_menu.expect_item "My second query"
+ query_menu.expect_item "My second query", selected: true
query_menu.expect_item "My first query"
# Rename a query
@@ -67,7 +67,7 @@ RSpec.shared_examples "module specific query view management" do
query_title.expect_not_changed
query_title.expect_title "My second query (renamed)"
- query_menu.expect_item "My second query (renamed)"
+ query_menu.expect_item "My second query (renamed)", selected: true
query_menu.expect_item "My first query"
# Delete a query