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
[37874] Show warning when exceeding page size (#9412)
Oliver Güntherd6c589c750b5
diff --git a/config/locales/js-en.yml b/config/locales/js-en.ymlindex 3f08b2d52fe..e8ebc3f4c1a 100644--- a/config/locales/js-en.yml+++ b/config/locales/js-en.yml@@ -559,6 +559,7 @@ en:timeline: 'Here you can edit your project plan. Create new phases, milestones, and add dependencies. All team members can see and update the latest plan at any time.'notifications:+ title: "Notifications"channel: "Channel"channels:in_app: "In-app"@@ -567,6 +568,12 @@ en:mentioned: 'mentioned'watched: 'watched'involved: 'involved'+ facets:+ unread: 'Unread'+ all: 'All'+ center:+ mark_all_read: 'Mark all as read'+ total_count_warning: "Showing the %{newest_count} most recent notifications. %{more_count} more are not displayed."settings:default_all_projects: 'Default for all projects'involved: 'I am involved'diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.html b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.htmlindex 0ce23caf936..b44488d7c4b 100644--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.html+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.html@@ -46,7 +46,7 @@<ng-container *ngIf="(hasNotifications$ | async) as notifications; else noResults"><cdk-virtual-scroll-viewport- [itemSize]="notificationsCount$ | async"+ itemSize="50"class="op-ian-center--viewport"><op-in-app-notification-entry@@ -68,5 +68,11 @@</span></div></ng-template>++ <p+ class="op-ian-center--max-warning"+ *ngIf="hasMoreThanPageSize$ | async"+ [textContent]="totalCountWarning()">+ </p></div></div>diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.sass b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.sassindex b5060386fdd..88b5f778250 100644--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.sass+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.sass@@ -7,11 +7,15 @@&--viewportgrid-area: entries- height: 100%- overflow-y: auto+ flex: 1&--entrieslist-style: none&--entrydisplay: list-item++ &--max-warning+ margin-bottom: 0+ text-align: center+ font-style: italicdiff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.tsindex bb5bdee8ff4..fe255702d4e 100644--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts@@ -5,6 +5,7 @@ import { OpModalLocalsMap } from "core-app/shared/components/modal/modal.types";import { I18nService } from "core-app/core/i18n/i18n.service";import { InAppNotificationsQuery } from "core-app/features/in-app-notifications/store/in-app-notifications.query";import { InAppNotificationsService } from "core-app/features/in-app-notifications/store/in-app-notifications.service";+import { NOTIFICATIONS_MAX_SIZE } from "core-app/features/in-app-notifications/store/in-app-notification.model";@Component({selector: 'op-in-app-notification-center',@@ -17,20 +18,20 @@ export class InAppNotificationCenterComponent extends OpModalComponent implementnotifications$ = this.ianQuery.selectAll();notificationsCount$ = this.ianQuery.selectCount();hasNotifications$ = this.ianQuery.hasNotifications$;+ hasMoreThanPageSize$ = this.ianQuery.hasMoreThanPageSize$;+ maxSize = NOTIFICATIONS_MAX_SIZE;- facets:string[] = ['unread', 'all']+ facets:string[] = ['unread', 'all'];text = {- title: 'Notifications',- mark_all_read: 'Mark all as read',+ title: this.I18n.t('js.notifications.title'),+ mark_all_read: this.I18n.t('js.notifications.center.mark_all_read'),button_close: this.I18n.t('js.button_close'),no_results: this.I18n.t('js.notice_no_results_to_display'),- show_all: 'Show all',- show_unread: 'Show unread',facets: {- unread: 'Unread',- all: 'All'- }+ unread: this.I18n.t('js.notifications.facets.unread'),+ all: this.I18n.t('js.notifications.facets.all'),+ },};constructor(@@ -58,4 +59,13 @@ export class InAppNotificationCenterComponent extends OpModalComponent implementthis.ianService.get();}+ totalCountWarning() {+ const state = this.ianQuery.getValue();++ return this.I18n.t(+ 'js.notifications.center.total_count_warning',+ { newest_count: NOTIFICATIONS_MAX_SIZE, more_count: state.notShowing },+ );+ }+}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 4a3cbd30c3f..bb9e8efd65c 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,5 +1,6 @@<divclass="op-ian-item"+ [class.op-ian-item_expanded]="notification.expanded"attr.data-qa-selector="op-ian-notification-item-{{notification.id}}"><buttondiff --git a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sassindex e539601a542..0fa321d7d99 100644--- a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass+++ b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass@@ -7,6 +7,12 @@font-size: 1remborder: 1px solid #F1F1F1border-radius: 2px+ // This needs to be set in the itemSize of+ // the virtual scroller+ height: 50px++ &_expanded+ height: auto&:first-childmargin-top: 0diff --git a/frontend/src/app/features/in-app-notifications/store/in-app-notification.model.ts b/frontend/src/app/features/in-app-notifications/store/in-app-notification.model.tsindex cb2a1aca7e8..e3cdacd49f2 100644--- a/frontend/src/app/features/in-app-notifications/store/in-app-notification.model.ts+++ b/frontend/src/app/features/in-app-notifications/store/in-app-notification.model.ts@@ -6,6 +6,8 @@ export interface HalResourceLink {}export type InAppNotificationFormat = 'markdown'|'custom';+export const NOTIFICATIONS_MAX_SIZE = 100;+export interface InAppNotificationDetail {format:InAppNotificationFormat;raw:string|null;diff --git a/frontend/src/app/features/in-app-notifications/store/in-app-notifications.query.ts b/frontend/src/app/features/in-app-notifications/store/in-app-notifications.query.tsindex 16635c16e13..639e283a16c 100644--- a/frontend/src/app/features/in-app-notifications/store/in-app-notifications.query.ts+++ b/frontend/src/app/features/in-app-notifications/store/in-app-notifications.query.ts@@ -27,6 +27,13 @@ export class InAppNotificationsQuery extends QueryEntity<InAppNotificationsStateactiveFacet$ = this.select('activeFacet');+ /** Determine whether the pageSize is not sufficient to load all notifcations */+ hasMoreThanPageSize$ = this+ .select()+ .pipe(+ map(({ notShowing }) => notShowing > 0),+ );+constructor(protected store:InAppNotificationsStore) {super(store);}diff --git a/frontend/src/app/features/in-app-notifications/store/in-app-notifications.service.ts b/frontend/src/app/features/in-app-notifications/store/in-app-notifications.service.tsindex 8d14cbbe3e7..a0d64571c40 100644--- a/frontend/src/app/features/in-app-notifications/store/in-app-notifications.service.ts+++ b/frontend/src/app/features/in-app-notifications/store/in-app-notifications.service.ts@@ -1,6 +1,6 @@import { Injectable } from '@angular/core';import { applyTransaction, ID, transaction } from '@datorama/akita';-import { InAppNotification } from './in-app-notification.model';+import { InAppNotification, NOTIFICATIONS_MAX_SIZE } from './in-app-notification.model';import { InAppNotificationsStore } from './in-app-notifications.store';import { forkJoin, Observable } from "rxjs";import { APIV3Service } from "core-app/core/apiv3/api-v3.service";@@ -24,12 +24,12 @@ export class InAppNotificationsService {get():void {this.store.setLoading(true);- let facet = this.query.getValue().activeFacet;+ const facet = this.query.getValue().activeFacet;this.apiV3Service.notifications- .facet(facet)+ .facet(facet, { pageSize: NOTIFICATIONS_MAX_SIZE }).pipe(tap(events => this.sideLoadInvolvedWorkPackages(events._embedded.elements)))@@ -37,7 +37,7 @@ export class InAppNotificationsService {events => {applyTransaction(() => {this.store.set(events._embedded.elements);- this.store.update({ count: events.total });+ this.store.update({ count: events.total, notShowing: events.total - events.count });});},error => {diff --git a/frontend/src/app/features/in-app-notifications/store/in-app-notifications.store.ts b/frontend/src/app/features/in-app-notifications/store/in-app-notifications.store.tsindex 6f852eecbef..72b269af351 100644--- a/frontend/src/app/features/in-app-notifications/store/in-app-notifications.store.ts+++ b/frontend/src/app/features/in-app-notifications/store/in-app-notifications.store.ts@@ -12,6 +12,7 @@ export interface InAppNotificationsState extends EntityState<InAppNotification>export function createInitialState(): InAppNotificationsState {return {count: 0,+ notShowing: 0,activeFacet: 'unread',expanded: false,};