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
[#48756] Maximize work package from notifications view
Dombi Attila29c7ac5da327
diff --git a/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts b/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.tsindex 5c94e1f4f6f..fcf46a0097c 100644--- a/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts+++ b/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts@@ -271,14 +271,18 @@ export class IanCenterService extends UntilDestroyedMixin {}// eslint-disable-next-line @typescript-eslint/no-inferrable-types- openSplitScreen(wpId:string|null, tabIdentifier:string = 'activity'):void {+ openSplitScreen(workPackageId:string|null, tabIdentifier:string = 'activity'):void {void this.state.go(// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/restrict-template-expressions`${this.state.current.data.baseRoute}.details.tabs`,- { workPackageId: wpId, tabIdentifier },+ { workPackageId, tabIdentifier },);}+ openFullView(workPackageId:string|null):void {+ void this.state.go('work-packages.show', { workPackageId });+ }+goToCenter():void {// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argumentvoid this.state.go(this.state.current.data.baseRoute);diff --git a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.htmlindex 2f290680d32..b3a02186724 100644--- a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html+++ b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html@@ -1,6 +1,7 @@<divclass="op-ian-item--row"- (click)="showDetails()"+ (click)="onClick()"+ (dblclick)="onDoubleClick()"><ng-container *ngIf="workPackage$ && (workPackage$ | async) as workPackage; else workPackageLoading"><divdiff --git a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.tsindex b9d2e859b6f..9f0e62269ba 100644--- a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts+++ b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts@@ -68,6 +68,8 @@ export class InAppNotificationEntryComponent implements OnInit {mark_as_read: this.I18n.t('js.notifications.center.mark_as_read'),};+ private clickTimer:ReturnType<typeof setTimeout>;+constructor(readonly apiV3Service:ApiV3Service,readonly I18n:I18nService,@@ -98,6 +100,15 @@ export class InAppNotificationEntryComponent implements OnInit {}}+ onClick():void {+ clearTimeout(this.clickTimer); // Clear timer from the any previous single click events.+ this.clickTimer = setTimeout(() => {+ // The single click logic is handled in a timeout, because+ // it needs to be canceled in case the event is a double click.+ this.showDetails();+ }, 250);+ }+showDetails():void {if (!this.workPackage$) {return;@@ -115,6 +126,18 @@ export class InAppNotificationEntryComponent implements OnInit {});}+ onDoubleClick():void {+ clearTimeout(this.clickTimer); // Clear timer from the single click event onClick.+ this.showFullView();+ }++ showFullView():void {+ const href = this.notification._links.resource?.href;+ const id = href && HalResource.matchFromLink(href, 'work_packages');++ this.storeService.openFullView(id);+ }+projectClicked(event:MouseEvent):void { // eslint-disable-line class-methods-use-thisevent.stopPropagation();}diff --git a/spec/features/notifications/notification_center/notification_center_spec.rb b/spec/features/notifications/notification_center/notification_center_spec.rbindex b382e2a3250..edcb63333a3 100644--- a/spec/features/notifications/notification_center/notification_center_spec.rb+++ b/spec/features/notifications/notification_center/notification_center_spec.rb@@ -39,6 +39,7 @@ RSpec.describe "Notification center",let(:activity_tab) { Components::WorkPackages::Activities.new(work_package) }let(:split_screen) { Pages::SplitWorkPackage.new work_package }let(:split_screen2) { Pages::SplitWorkPackage.new work_package2 }+ let(:full_screen) { Pages::FullWorkPackage.new work_package }let(:notifications) do[notification, notification2]@@ -141,7 +142,7 @@ RSpec.describe "Notification center",endend- it 'can open the split screen of the notification' do+ it 'can open the split screen of the work package when clicking the notification' dovisit home_pathwait_for_reloadcenter.expect_bell_count 2@@ -169,6 +170,18 @@ RSpec.describe "Notification center",center.expect_work_package_item notification2end+ it 'can open the full view of the work package when double clicking the notification' do+ visit home_path+ center.expect_bell_count 2+ center.open++ center.double_click_item notification+ full_screen.expect_subject++ full_screen.go_back+ center.expect_item_not_read notification+ end+context "with a new notification" dolet(:work_package3) docreate(:work_package,diff --git a/spec/features/notifications/notification_center/split_screen_spec.rb b/spec/features/notifications/notification_center/split_screen_spec.rbindex 7acc80cc67e..58af25e1184 100644--- a/spec/features/notifications/notification_center/split_screen_spec.rb+++ b/spec/features/notifications/notification_center/split_screen_spec.rb@@ -100,6 +100,7 @@ RSpec.describe "Split screen in the notification center",# Html title should be updated with next WP data after making the current one as readsecond_title = "#{second_work_package.type.name}: #{second_work_package.subject} (##{second_work_package.id})"center.click_item notification+ sleep 0.25 # Wait after the item has been clicked to not be interpreted as a double clickcenter.mark_notification_as_read notificationglobal_html_title.expect_first_segment second_titlediff --git a/spec/support/pages/notifications/center.rb b/spec/support/pages/notifications/center.rbindex a7aac604c39..914c243cda0 100644--- a/spec/support/pages/notifications/center.rb+++ b/spec/support/pages/notifications/center.rb@@ -53,13 +53,21 @@ module Pagesclick_button 'All'end- def click_item(notification)+ def item_title(notification)text = notification.resource.is_a?(WorkPackage) ? notification.resource.subject : notification.subjectwithin_item(notification) do- page.find('span', text:, exact_text: true).click+ page.find('span', text:, exact_text: true)endend+ def click_item(notification)+ item_title(notification).click+ end++ def double_click_item(notification)+ item_title(notification).double_click+ end+def within_item(notification, &)page.within("[data-qa-selector='op-ian-notification-item-#{notification.id}']", &)end