Remove unused component

pull/9636/head
Benjamin Bädorf 3 years ago
parent 457e1ce9d9
commit 17582a831a
No known key found for this signature in database
GPG Key ID: 069CA2D117AB5CCF
  1. 116
      frontend/src/app/features/user-preferences/notifications-settings/row/notification-setting-row.component.html
  2. 77
      frontend/src/app/features/user-preferences/notifications-settings/row/notification-setting-row.component.ts
  3. 2
      frontend/src/app/features/user-preferences/user-preferences.module.ts

@ -1,116 +0,0 @@
<td
*ngIf="first"
[attr.rowspan]="count"
>
<span
*ngIf="setting._links.project.href; else defaultTitle"
[textContent]="setting._links.project.title"
></span>
<ng-template #defaultTitle>
<em [textContent]="text.default_all_projects"></em>
</ng-template>
</td>
<td [textContent]="text.channel(setting.channel)">
</td>
<td>
<input
type="checkbox"
[checked]="setting.involved || setting.all"
[disabled]="setting.all"
(change)="update({ involved: $event.target.checked })"
data-qa-notification-type="involved"
[attr.aria-label]="text.involved_header"
/>
</td>
<td>
<input
type="checkbox"
[checked]="setting.mentioned || setting.all"
[disabled]="setting.all"
(change)="update({ mentioned: $event.target.checked })"
data-qa-notification-type="mentioned"
[attr.aria-label]="text.mentioned_header"
/>
</td>
<td>
<input
type="checkbox"
[checked]="setting.watched || setting.all"
[disabled]="setting.all"
(change)="update({ watched: $event.target.checked })"
data-qa-notification-type="watched"
[attr.aria-label]="text.watched_header"
/>
</td>
<td>
<input
type="checkbox"
[checked]="setting.workPackageCreated || setting.all"
[disabled]="setting.all"
(change)="update({ workPackageCreated: $event.target.checked })"
data-qa-notification-type="work_package_created"
[attr.aria-label]="text.work_package_created_header"
/>
</td>
<td>
<input
type="checkbox"
[checked]="setting.workPackageCommented || setting.all"
[disabled]="setting.all"
(change)="update({ workPackageCommented: $event.target.checked })"
data-qa-notification-type="work_package_commented"
[attr.aria-label]="text.work_package_commented_header"
/>
</td>
<td>
<input
type="checkbox"
[checked]="setting.workPackageProcessed || setting.all"
[disabled]="setting.all"
(change)="update({ workPackageProcessed: $event.target.checked })"
data-qa-notification-type="work_package_processed"
[attr.aria-label]="text.work_package_processed_header"
/>
</td>
<td>
<input
type="checkbox"
[checked]="setting.workPackagePrioritized || setting.all"
[disabled]="setting.all"
(change)="update({ workPackagePrioritized: $event.target.checked })"
data-qa-notification-type="work_package_prioritized"
[attr.aria-label]="text.work_package_prioritized_header"
/>
</td>
<td>
<input
type="checkbox"
[checked]="setting.workPackageScheduled || setting.all"
[disabled]="setting.all"
(change)="update({ workPackageScheduled: $event.target.checked })"
data-qa-notification-type="work_package_scheduled"
[attr.aria-label]="text.work_package_scheduled_header"
/>
</td>
<td>
<input
type="checkbox"
[checked]="setting.all"
(change)="update({ all: $event.target.checked })"
data-qa-notification-type="all"
[attr.aria-label]="text.any_event_header"
/>
</td>
<td
*ngIf="first"
[attr.rowspan]="count"
class="buttons"
>
<button
*ngIf="!global"
class="op-link"
(click)="remove()"
>
<op-icon icon-classes="icon-remove icon-no-color"></op-icon>
</button>
</td>

@ -1,77 +0,0 @@
import {
ChangeDetectionStrategy, Component, Input, OnInit,
} from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { arrayUpdate } from '@datorama/akita';
import { NotificationSetting } from 'core-app/features/user-preferences/state/notification-setting.model';
import { UserPreferencesStore } from 'core-app/features/user-preferences/state/user-preferences.store';
@Component({
// eslint-disable-next-line @angular-eslint/component-selector
selector: '[op-notification-setting-row]',
templateUrl: './notification-setting-row.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class NotificationSettingRowComponent implements OnInit {
@Input() first = false;
@Input() count:number;
@Input() setting:NotificationSetting;
/** Whether this setting is global */
global = false;
text = {
title: this.I18n.t('js.notifications.settings.title'),
save: this.I18n.t('js.button_save'),
email: this.I18n.t('js.notifications.email'),
inApp: this.I18n.t('js.notifications.in_app'),
remove_all: this.I18n.t('js.notifications.settings.remove_all'),
involved_header: this.I18n.t('js.notifications.settings.involved'),
mentioned_header: this.I18n.t('js.notifications.settings.mentioned'),
watched_header: this.I18n.t('js.notifications.settings.watched'),
work_package_commented_header: this.I18n.t('js.notifications.settings.work_package_commented'),
work_package_created_header: this.I18n.t('js.notifications.settings.work_package_created'),
work_package_processed_header: this.I18n.t('js.notifications.settings.work_package_processed'),
work_package_prioritized_header: this.I18n.t('js.notifications.settings.work_package_prioritized'),
work_package_scheduled_header: this.I18n.t('js.notifications.settings.work_package_scheduled'),
any_event_header: this.I18n.t('js.notifications.settings.all'),
default_all_projects: this.I18n.t('js.notifications.settings.default_all_projects'),
add_setting: this.I18n.t('js.notifications.settings.add'),
channel: (channel:string):string => this.I18n.t(`js.notifications.channels.${channel}`),
};
constructor(
private I18n:I18nService,
private store:UserPreferencesStore,
) {
}
ngOnInit() {
this.global = this.setting._links.project.href === null;
}
remove():void {
this.store.update(
({ notifications }) => ({
notifications: notifications.filter((notification) => notification._links.project.href !== this.setting._links.project.href),
}),
);
}
update(delta:Partial<NotificationSetting>) {
this.store.update(
({ notifications }) => ({
notifications: arrayUpdate(
notifications, this.matcherFn.bind(this), delta,
),
}),
);
}
private matcherFn(notification:NotificationSetting) {
return notification._links.project.href === this.setting._links.project.href
&& notification.channel === this.setting.channel;
}
}

@ -8,7 +8,6 @@ import { UserPreferencesStore } from 'core-app/features/user-preferences/state/u
import { UserPreferencesQuery } from 'core-app/features/user-preferences/state/user-preferences.query';
import { UserPreferencesService } from 'core-app/features/user-preferences/state/user-preferences.service';
import { NotificationsSettingsPageComponent } from 'core-app/features/user-preferences/notifications-settings/page/notifications-settings-page.component';
import { NotificationSettingRowComponent } from 'core-app/features/user-preferences/notifications-settings/row/notification-setting-row.component';
import { NotificationSettingInlineCreateComponent } from 'core-app/features/user-preferences/notifications-settings/inline-create/notification-setting-inline-create.component';
import { MY_ACCOUNT_ROUTES } from 'core-app/features/user-preferences/user-preferences.routes';
import { NotificationsSettingsToolbarComponent } from './notifications-settings/toolbar/notifications-settings-toolbar.component';
@ -22,7 +21,6 @@ import { NotificationSettingsTableComponent } from './notifications-settings/tab
],
declarations: [
NotificationsSettingsPageComponent,
NotificationSettingRowComponent,
NotificationSettingInlineCreateComponent,
NotificationsSettingsToolbarComponent,
NotificationSettingsTableComponent,

Loading…
Cancel
Save