-
-
Notifications
You must be signed in to change notification settings - Fork 397
UI mail-log and mail-detail #1252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Lorslux
wants to merge
16
commits into
alfio-event:master
Choose a base branch
from
Lorslux:mail
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 14 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0ebb854
fixed button add new categories
Lorslux e229abc
load mails call and service
Lorslux 8dcfe97
UI mail page header and table
Lorslux 532f915
routing event-detail and added css rules
Lorslux 07af0e1
translate date
Lorslux 58f73ce
configured routing childrens of event-dashboard
Lorslux 1d58e5c
refactoring model names
Lorslux c3ea1a9
load mail
Lorslux 746fd85
Added message detail
Lorslux 352395c
pagination
Lorslux 5ee6fa5
search
Lorslux 03cb063
translate
Lorslux 5a43e94
Merge branch 'master' into mail
Lorslux ec92fc6
fixed import
Lorslux 8e5d646
fixed button
Lorslux 3db0c61
fixed file
Lorslux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
frontend/projects/admin/src/app/event/email-detail/email-detail.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <div class="container my-3"> | ||
| <h1 translate="admin.event.mail-detail.title"></h1> | ||
| <hr /> | ||
| <div *ngIf="mail$ | async as mail"> | ||
| <dl data-ng-if="mail"> | ||
| <dt translate="admin.event.mail-detail.recipient"></dt> | ||
| <dd>{{ mail.recipient }}</dd> | ||
| <dt translate="admin.event.mail-detail.subject"></dt> | ||
| <dd>{{ mail.subject }}</dd> | ||
| <dt translate="admin.event.mail-detail.message"></dt> | ||
| <dd> | ||
| <pre class="white">{{ mail.message }}</pre> | ||
| </dd> | ||
| <dt translate="admin.event.mail-detail.status"></dt> | ||
| <dd>{{ mail.status }}</dd> | ||
| <dt translate="admin.event.mail-detail.checksum"></dt> | ||
| <dd class="hidden-sm hidden-xs">{{ mail.checksum }}</dd> | ||
| <dd class="visible-sm visible-xs"> | ||
| {{ mail.checksum | slice : 0 : 35 }} | ||
| </dd> | ||
| <dt translate="admin.event.mail-detail.requested"></dt> | ||
| <dd>{{ mail.requestTimestamp }}</dd> | ||
| <dt translate="admin.event.mail-detail.sent"></dt> | ||
| <dd>{{ mail.sentTimestamp }}</dd> | ||
| </dl> | ||
| <div class="text-center"> | ||
| <a | ||
| class="btn btn-outline-primary" | ||
| href="#" | ||
| [routerLink]="['../']" | ||
| translate="admin.event.mail-detail.back-to-list" | ||
| ></a> | ||
| </div> | ||
| </div> | ||
| </div> |
Empty file.
51 changes: 51 additions & 0 deletions
51
frontend/projects/admin/src/app/event/email-detail/email-detail.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import { Component, OnInit } from '@angular/core'; | ||
| import { ActivatedRoute } from '@angular/router'; | ||
| import { MailService } from 'projects/admin/src/event/mail.service'; | ||
| import { EventService } from '../../shared/event.service'; | ||
| import { Observable, map, mergeMap, of } from 'rxjs'; | ||
| import { Mail } from '../../model/mail'; | ||
| import { EventInfo } from '../../model/event'; | ||
|
|
||
| @Component({ | ||
| selector: 'app-email-detail', | ||
| templateUrl: './email-detail.component.html', | ||
| styleUrls: ['./email-detail.component.scss'], | ||
| }) | ||
| export class EmailDetailComponent implements OnInit { | ||
| public mail$: Observable<Mail> = of(); | ||
|
|
||
| constructor( | ||
| private readonly mailService: MailService, | ||
| private readonly route: ActivatedRoute, | ||
| private readonly eventService: EventService | ||
| ) {} | ||
|
|
||
| ngOnInit(): void { | ||
| this.loadMail(); | ||
| } | ||
| loadMail() { | ||
| this.mail$ = this.route.paramMap.pipe( | ||
| mergeMap((pm) => { | ||
| const eventId = pm.get('eventId'); | ||
| const mailId = pm.get('emailId'); | ||
| if (eventId != null && mailId != null) { | ||
| return this.eventService | ||
| .getEvent(eventId) | ||
| .pipe( | ||
| map((event) => new ShortNameAndMailId(event.shortName, mailId)) | ||
| ); | ||
| } | ||
| return of(); | ||
| }), | ||
| mergeMap((shortNameAndMailId) => | ||
| this.mailService.getMail( | ||
| shortNameAndMailId.shortName, | ||
| shortNameAndMailId.mailId | ||
| ) | ||
| ) | ||
| ); | ||
| } | ||
| } | ||
| class ShortNameAndMailId { | ||
| constructor(public shortName: string, public mailId: string) {} | ||
| } |
70 changes: 69 additions & 1 deletion
70
frontend/projects/admin/src/app/event/email-log/email-log.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,69 @@ | ||
| <p>email-log works!</p> | ||
| <div class="container" *ngIf="mailLog$ | async as mailLog"> | ||
| <h1 class="my-3" translate="admin.event.mail-log.title"></h1> | ||
| <p translate="admin.event.mail-log.legend"></p> | ||
| <hr /> | ||
| <div class="fs-2 my-3"> | ||
| <svg-icon key="mail" size="xxl"></svg-icon> | ||
| <span translate="admin.event.mail-log.emails"></span> | ||
| </div> | ||
|
|
||
| <div class="input-group"> | ||
| <button class="btn btn-outline-secondary" type="button" (click)="search()"> | ||
| <svg-icon key="search"></svg-icon> | ||
| </button> | ||
|
|
||
| <input | ||
| type="text" | ||
| class="form-control" | ||
| placeholder="Filter table" | ||
| aria-label="Filter table" | ||
| aria-describedby="Filter table" | ||
| [(ngModel)]="searchText" | ||
| autofocus | ||
| (keydown.enter)="search()" | ||
| /> | ||
| </div> | ||
|
|
||
| <div class="my-4"> | ||
| <table class="table table-striped"> | ||
| <thead> | ||
| <tr> | ||
| <th scope="col" translate="admin.event.mail-log.list.recipent"></th> | ||
| <th scope="col" translate="admin.event.mail-log.list.subject"></th> | ||
| <th scope="col" translate="admin.event.mail-log.list.message"></th> | ||
| <th scope="col" translate="admin.event.mail-log.list.status"></th> | ||
| <th scope="col" translate="admin.event.mail-log.list.checksum"></th> | ||
| <th scope="col" translate="admin.event.mail-log.list.requested"></th> | ||
| <th scope="col" translate="admin.event.mail-log.list.sent"></th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <tr | ||
| *ngFor=" | ||
| let mail of mailLog.left | ||
| | slice : (page - 1) * pageSize : page * pageSize | ||
| " | ||
| > | ||
| <th scope="row">{{ mail.recipient }}</th> | ||
| <td class="text-overflow">{{ mail.subject }}</td> | ||
| <td> | ||
| <a [routerLink]="['./', mail.id]">{{ mail.message }}</a> | ||
| </td> | ||
| <td>{{ mail.status }}</td> | ||
| <td class="text-overflow"> | ||
| {{ mail.checksum }} | ||
| </td> | ||
| <td>{{ mail.requestTimestamp | date : dateTimeFormat }}</td> | ||
| <td>{{ mail.sentTimestamp | date : dateTimeFormat }}</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| <div class="d-flex justify-content-center"> | ||
| <ngb-pagination | ||
| [(page)]="page" | ||
| [pageSize]="pageSize" | ||
| [collectionSize]="mailLog.left.length" | ||
| ></ngb-pagination> | ||
| </div> | ||
| </div> | ||
| </div> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| .text-overflow { | ||
| overflow: hidden; | ||
| text-overflow: ellipsis; | ||
| white-space: nowrap; | ||
| max-width: 100px; | ||
| } |
39 changes: 37 additions & 2 deletions
39
frontend/projects/admin/src/app/event/email-log/email-log.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,50 @@ | ||
| import { Component, OnInit } from '@angular/core'; | ||
| import { ActivatedRoute } from '@angular/router'; | ||
| import { MailService } from 'projects/admin/src/event/mail.service'; | ||
| import { Observable, map, mergeMap, of, retry, tap } from 'rxjs'; | ||
| import { EventService } from '../../shared/event.service'; | ||
| import { MailLog } from '../../model/mail'; | ||
| import { TranslateService } from '@ngx-translate/core'; | ||
|
|
||
| @Component({ | ||
| selector: 'app-email-log', | ||
| templateUrl: './email-log.component.html', | ||
| styleUrls: ['./email-log.component.scss'] | ||
| styleUrls: ['./email-log.component.scss'], | ||
| }) | ||
| export class EmailLogComponent implements OnInit { | ||
| public searchText = ''; | ||
| public mailLog$: Observable<MailLog> = of(); | ||
| public page: number = 1; | ||
| public pageSize: number = 10; | ||
|
|
||
| constructor() { } | ||
| constructor( | ||
| private readonly mailService: MailService, | ||
| private readonly route: ActivatedRoute, | ||
| private readonly eventService: EventService, | ||
| private readonly translateService: TranslateService | ||
| ) {} | ||
|
|
||
| ngOnInit(): void { | ||
| this.loadMails(); | ||
| } | ||
|
|
||
| loadMails() { | ||
| this.mailLog$ = this.route.paramMap.pipe( | ||
| map((pm) => pm.get('eventId')), | ||
| mergeMap((eventId) => | ||
| eventId != null ? this.eventService.getEvent(eventId) : of() | ||
| ), | ||
| mergeMap((event) => | ||
| this.mailService.getAllMails(event.shortName, 0, this.searchText) | ||
| ) | ||
| ); | ||
| } | ||
|
|
||
| get dateTimeFormat(): string { | ||
| return this.translateService.instant('admin.common.date-time'); | ||
| } | ||
|
|
||
| search() { | ||
| this.loadMails(); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.