Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions e2e/mockserver/mockserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ export class MockServer {
case '/rest/v1/me':
response.end(JSON.stringify(this.me()));
break;
case '/rest/v1/filter':
response.end(JSON.stringify(this.filters()));
break;
case '/rest/v1/list/deleted_messages':
response.end(JSON.stringify({ 'message_ids': [], 'status': 'success' }));
break;
Expand Down Expand Up @@ -691,4 +694,74 @@ export class MockServer {
],
];
}

filters(): any {
return {
"result": {
"filters": [
{
"active": true,
"action": "t",
"id": 101486365,
"priority": 0,
"location": "1",
"target": "Inbox",
"negated": false,
"string": "from-rule"
},
{
"string": "reply-to-rule",
"active": true,
"action": "t",
"id": 101486367,
"priority": 0,
"location": "4",
"target": "Inbox",
"negated": false
},
{
"negated": false,
"target": "Inbox",
"location": "0",
"priority": 0,
"id": 101486369,
"action": "t",
"active": true,
"string": "to-rule"
},
{
"string": "from-forwarded",
"negated": false,
"priority": 0,
"location": "1",
"target": "target@runbox.com",
"action": "f",
"id": 101486371,
"active": true
},
{
"string": "cc-redirected",
"active": true,
"action": "b",
"id": 101486373,
"priority": 0,
"location": "3",
"target": "target@runbox.com",
"negated": false
},
{
"string": "added-in-rmm7",
"active": true,
"action": "t",
"id": 101486379,
"location": "0",
"priority": null,
"target": "Inbox",
"negated": false
}
]
},
"status": "success"
}
}
}
12 changes: 12 additions & 0 deletions src/app/account-app/account-app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ import { HeaderToolbarComponent } from '../menu/headertoolbar.component';
import { AccountAppComponent } from './account-app.component';
import { AccountAddonsComponent } from './account-addons.component';
import { AccountComponentsComponent } from './account-components.component';
import { AccountFiltersComponent } from './filters/account-filters.component';
import { FilterEditorComponent } from './filters/filter-editor.component';
import { SenderListComponent } from './filters/sender-list.component';
import { AccountRenewalsComponent } from './account-renewals.component';
import { AccountReceiptComponent } from './account-receipt.component';
import { AccountTransactionsComponent } from './account-transactions.component';
Expand Down Expand Up @@ -63,6 +66,7 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatRadioModule } from '@angular/material/radio';
import { MatSelectModule } from '@angular/material/select';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatTabsModule } from '@angular/material/tabs';
import { MatTableModule } from '@angular/material/table';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatTooltipModule } from '@angular/material/tooltip';
Expand All @@ -74,6 +78,7 @@ import { SubAccountRenewalDialogComponent } from './sub-account-renewal-dialog';
AccountAddonsComponent,
AccountAppComponent,
AccountComponentsComponent,
AccountFiltersComponent,
AccountReceiptComponent,
AccountRenewalsComponent,
AccountTransactionsComponent,
Expand All @@ -90,6 +95,8 @@ import { SubAccountRenewalDialogComponent } from './sub-account-renewal-dialog';
SubAccountRenewalDialogComponent,
RunboxTimerComponent,
CreditCardsComponent,
FilterEditorComponent,
SenderListComponent,
],
imports: [
BrowserAnimationsModule,
Expand All @@ -111,6 +118,7 @@ import { SubAccountRenewalDialogComponent } from './sub-account-renewal-dialog';
MatRadioModule,
MatSelectModule,
MatSidenavModule,
MatTabsModule,
MatTableModule,
MatToolbarModule,
MatTooltipModule,
Expand Down Expand Up @@ -173,6 +181,10 @@ import { SubAccountRenewalDialogComponent } from './sub-account-renewal-dialog';
path: 'credit_cards',
component: CreditCardsComponent
},
{
path: 'filters',
component: AccountFiltersComponent
},
]
}
]
Expand Down
53 changes: 53 additions & 0 deletions src/app/account-app/filters/account-filters.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<h1> Filters </h1>

<mat-tab-group>
<mat-tab label="Filters">
<div *ngIf="shownFilters | async as filters; else loading">
<div style="margin: 10px">
<button mat-stroked-button (click)="newFilter()">
<mat-icon svgIcon="plus-box"></mat-icon> Add new filter
</button>
</div>

<app-account-filter-editor
[attr.id]="filter.id"
*ngFor="let filter of filters"
[filter]="filter"
(save)="saveFilter(filter, $event)"
(delete)="deleteFilter(filter)"
(moveUp)="moveFilterUp(filter)"
(moveDown)="moveFilterDown(filter)"
></app-account-filter-editor>

<p *ngIf="filters.length < filtersTotal">
Showing {{ filters.length }}/{{ filtersTotal }} filters
<button mat-button (click)="showMoreFilters()"> Show {{ filterPageSize }} more </button>
<button mat-button (click)="showAllFilters()"> Show all </button>
</p>
</div>
</mat-tab>
<mat-tab label="Blocked senders">
<div *ngIf="blockedSenders | async as blocked; else loading">
<app-account-sender-list
[senders]="blocked"
(add)="addBlocked($event)"
(remove)="removeBlocked($event)"
></app-account-sender-list>
</div>
</mat-tab>
<mat-tab label="Allowed senders">
<div *ngIf="allowedSenders | async as allowed; else loading">
<app-account-sender-list
[senders]="allowed"
(add)="addAllowed($event)"
(remove)="removeAllowed($event)"
></app-account-sender-list>
</div>
</mat-tab>
</mat-tab-group>

<ng-template #loading>
<app-runbox-loading
text="Loading your filters..."
></app-runbox-loading>
</ng-template>
Loading