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

Notification settings table intiial round of changes

Benjamin Bädorf6a8d7cf80660
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html
index 0e340d8da0d..ec7b94a3360 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html
+++ b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html
@@ -127,8 +127,6 @@
[userId]="userId"
></op-notification-settings-table>
- <
-
<div class="generic-table--action-buttons">
<button
class="button -highlight"
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.html b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.html
index 40d30e2578e..a0590e4fcc6 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.html
+++ b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.html
@@ -1,125 +1,30 @@
-<div class="generic-table--container form--section">
- <div class="generic-table--results-container">
- <table class="generic-table">
- <colgroup>
- <col>
- <col opHighlightCol>
- <col opHighlightCol>
- <col opHighlightCol>
- <col opHighlightCol>
- <col opHighlightCol>
- <col opHighlightCol>
- <col opHighlightCol>
- <col opHighlightCol>
- <col opHighlightCol>
- <col opHighlightCol>
- </colgroup>
- <thead>
- <tr>
- <th>
- <div class="generic-table--empty-header"></div>
- </th>
- <th>
- <div class="generic-table--sort-header-outer">
- <div class="generic-table--sort-header">
- <span [textContent]="text.channel_header"></span>
- </div>
- </div>
- </th>
- <th>
- <div class="generic-table--sort-header-outer">
- <div class="generic-table--sort-header">
- <span [textContent]="text.involved_header"></span>
- </div>
- </div>
- </th>
- <th>
- <div class="generic-table--sort-header-outer">
- <div class="generic-table--sort-header">
- <span [textContent]="text.mentioned_header"></span>
- </div>
- </div>
- </th>
- <th>
- <div class="generic-table--sort-header-outer">
- <div class="generic-table--sort-header">
- <span [textContent]="text.watched_header"></span>
- </div>
- </div>
- </th>
- <th>
- <div class="generic-table--sort-header-outer">
- <div class="generic-table--sort-header">
- <span [textContent]="text.work_package_created_header"></span>
- </div>
- </div>
- </th>
- <th>
- <div class="generic-table--sort-header-outer">
- <div class="generic-table--sort-header">
- <span [textContent]="text.work_package_commented_header"></span>
- </div>
- </div>
- </th>
- <th>
- <div class="generic-table--sort-header-outer">
- <div class="generic-table--sort-header">
- <span [textContent]="text.work_package_processed_header"></span>
- </div>
- </div>
- </th>
- <th>
- <div class="generic-table--sort-header-outer">
- <div class="generic-table--sort-header">
- <span [textContent]="text.work_package_prioritized_header"></span>
- </div>
- </div>
- </th>
- <th>
- <div class="generic-table--sort-header-outer">
- <div class="generic-table--sort-header">
- <span [textContent]="text.work_package_scheduled_header"></span>
- </div>
- </div>
- </th>
- <th>
- <div class="generic-table--sort-header-outer">
- <div class="generic-table--sort-header">
- <span [textContent]="text.any_event_header"></span>
- </div>
- </div>
- </th>
- <th>
- <div class="generic-table--empty-header"></div>
- </th>
- </tr>
- </thead>
- <tbody>
- <ng-container *ngFor="let item of (groupedNotificationSettings$ | async) | keyvalue: projectOrder">
- <ng-container *ngFor="let setting of item.value; let first = first; let last = last">
- <tr
- class="-no-highlighting"
- op-notification-setting-row
- [attr.data-qa-notification-project]="item.key"
- [attr.data-qa-notification-channel]="setting.channel"
- [count]="item.value.length"
- [first]="first"
- [setting]="setting"
- >
- </tr>
- <tr *ngIf="last"
- class="op-notifications-settings-table--spacer">
- <td colspan="7"></td>
- </tr>
- </ng-container>
+<table
+ class="op-table"
+ *ngIf="showTable$ | async"
+>
+ <thead>
+ <tr>
+ <th class="op-table--cell--cell_heading"></th>
+ <ng-container
+ *ngFor="let item of (groupedNotificationSettings$ | async) | keyvalue"
+ >
+ <th class="op-table--cell op-table--cell_heading">{{ item.key }}</th>
</ng-container>
- </tbody>
- </table>
- <op-notification-setting-inline-create
- *ngIf="userId"
- [userId]="userId"
- (selected)="addRow($event)"
- data-qa-selector="notification-setting-inline-create"
- ></op-notification-setting-inline-create>
- </div>
-</div>
\ No newline at end of file
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <th class="op-table--cell op-table--cell_soft-heading">{{ text.mentioned_header }}</th>
+ <ng-container *ngFor="let item of (groupedNotificationSettings$ | async) | keyvalue">
+ <td><input type="checkbox" disabled checked /></td>
+ </ng-container>
+ </tr>
+ </tbody>
+</table>
+
+<op-notification-setting-inline-create
+ *ngIf="userId"
+ [userId]="userId"
+ (selected)="addRow($event)"
+ data-qa-selector="notification-setting-inline-create"
+></op-notification-setting-inline-create>
\ No newline at end of file
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
index be0c27bcdaa..75829738de3 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
+++ b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
@@ -1,15 +1,16 @@
// noinspection ES6UnusedImports
import {
- Component, OnInit, ChangeDetectionStrategy, Input,
+ Component,
+ ChangeDetectionStrategy,
+ Input,
} from '@angular/core';
+import { map, tap } from 'rxjs/operators';
import { KeyValue } from '@angular/common';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { UserPreferencesService } from 'core-app/features/user-preferences/state/user-preferences.service';
import { UserPreferencesStore } from 'core-app/features/user-preferences/state/user-preferences.store';
import { UserPreferencesQuery } from 'core-app/features/user-preferences/state/user-preferences.query';
-import { CurrentUserService } from 'core-app/core/current-user/current-user.service';
-import { UIRouterGlobals } from '@uirouter/core';
import { HalSourceLink } from 'core-app/features/hal/resources/hal-resource';
import {
buildNotificationSetting,
@@ -28,6 +29,8 @@ export class NotificationSettingsTableComponent {
groupedNotificationSettings$ = this.query.notificationsGroupedByProject$;
+ showTable$ = this.query.notificationsGroupedByProject$.pipe(map((settings) => Object.keys(settings).length > 0));
+
text = {
save: this.I18n.t('js.button_save'),
involved_header: this.I18n.t('js.notifications.settings.involved'),
@@ -44,14 +47,6 @@ export class NotificationSettingsTableComponent {
};
projectOrder = (a:KeyValue<string, unknown>, b:KeyValue<string, unknown>):number => {
- if (a.key === 'global') {
- return -1;
- }
-
- if (b.key === 'global') {
- return 1;
- }
-
return a.key.localeCompare(b.key);
};
diff --git a/frontend/src/app/features/user-preferences/state/user-preferences.query.ts b/frontend/src/app/features/user-preferences/state/user-preferences.query.ts
index 7cf0f1d62b7..e17b1bba315 100644
--- a/frontend/src/app/features/user-preferences/state/user-preferences.query.ts
+++ b/frontend/src/app/features/user-preferences/state/user-preferences.query.ts
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { Query } from '@datorama/akita';
-import { map } from 'rxjs/operators';
+import { map, tap } from 'rxjs/operators';
import { Observable } from 'rxjs';
import { UserPreferencesStore } from 'core-app/features/user-preferences/state/user-preferences.store';
import { UserPreferencesModel } from 'core-app/features/user-preferences/state/user-preferences.model';
@@ -16,7 +16,9 @@ export class UserPreferencesQuery extends Query<UserPreferencesModel> {
notificationsGroupedByProject$:Observable<{ [key:string]:NotificationSetting[] }> = this
.notificationSettings$
.pipe(
- map((notifications) => _.groupBy(notifications, (setting) => setting._links.project.title || 'global')),
+ map((notifications) => notifications.filter((setting) => setting.channel === 'in_app' && setting._links.project.title)),
+ map((notifications) => _.groupBy(notifications, (setting) => setting._links.project.title)),
+ tap(console.log),
);
projectNotifications$ = this
diff --git a/frontend/src/app/shared/components/project-list-select/project-list-select.component.html b/frontend/src/app/shared/components/project-list-select/project-list-select.component.html
index e69de29bb2d..43468ae3167 100644
--- a/frontend/src/app/shared/components/project-list-select/project-list-select.component.html
+++ b/frontend/src/app/shared/components/project-list-select/project-list-select.component.html
@@ -0,0 +1,20 @@
+<div class="op-popout--headline">
+ <h1>Select project(s)</h1>
+ <button
+ class="op-link"
+ type="button"
+ (click)="clearSelection()"
+ ></button>
+</div>
+
+<label>
+ <span class="hidden-for-sighted">Search</span>
+ <input
+ type="text"
+ (input)="search()"
+ />
+</label>
+
+<ul>
+ <li>Project A</li>
+</ul>
diff --git a/frontend/src/app/shared/components/project-list-select/project-list-select.component.ts b/frontend/src/app/shared/components/project-list-select/project-list-select.component.ts
index e69de29bb2d..acd145a49e6 100644
--- a/frontend/src/app/shared/components/project-list-select/project-list-select.component.ts
+++ b/frontend/src/app/shared/components/project-list-select/project-list-select.component.ts
@@ -0,0 +1,18 @@
+import {
+ Component,
+ HostBinding,
+} from '@angular/core';
+
+@Component({
+ selector: 'op-project-list-select',
+ templateUrl: './project-list-select.component.html',
+})
+export class OpProjectListSelectComponent {
+ @HostBinding('class.op-project-list-select') className = true;
+
+ public clearSelection() {
+ }
+
+ public search() {
+ }
+}
diff --git a/frontend/src/app/shared/components/table/table.sass b/frontend/src/app/shared/components/table/table.sass
new file mode 100644
index 00000000000..67df3dfa0a1
--- /dev/null
+++ b/frontend/src/app/shared/components/table/table.sass
@@ -0,0 +1,17 @@
+.op-table
+ max-width: 100%
+ overflow-x: scroll
+ border-collapse: collapse
+
+ &--cell
+ padding: 12px 16px
+ border: 1px solid #cccccc
+ text-align: center
+
+ &_heading
+ background-color: #f3f3f3
+ font-weight: bold
+ text-align: left
+
+ &_soft-heading
+ background-color: transparent
diff --git a/frontend/src/global_styles/common/openproject-common.module.sass b/frontend/src/global_styles/common/openproject-common.module.sass
index 410274c958b..335fdfc780d 100644
--- a/frontend/src/global_styles/common/openproject-common.module.sass
+++ b/frontend/src/global_styles/common/openproject-common.module.sass
@@ -6,5 +6,6 @@
@import '../../app/shared/components/forms'
@import '../../app/shared/components/option-list/option-list'
@import '../../app/shared/components/popout/popout'
+@import '../../app/shared/components/table/table'
@import 'export-options/export-options'
@import 'select/select'