From 35f1901cbb7b8f170bf9c499c9e941df9d5afeb9 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Wed, 3 Nov 2021 10:32:55 +0100 Subject: [PATCH] OZG-1194 hide attachments in vorgang detail --- goofy-client/libs/postfach-shared/src/index.ts | 1 + .../libs/postfach-shared/src/lib/postfach.tokens.ts | 3 +++ .../postfach-mail-list-container.component.ts | 5 +++-- .../postfach-mail/postfach-mail.component.html | 8 +++++--- .../postfach-mail/postfach-mail.component.spec.ts | 8 +++++++- .../postfach-mail/postfach-mail.component.ts | 6 ++++-- .../postfach-nachricht-attachments.component.html | 2 +- .../postfach-page-container.component.ts | 6 ++++-- goofy-client/libs/postfach/src/lib/postfach.module.ts | 8 +++++++- 9 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 goofy-client/libs/postfach-shared/src/lib/postfach.tokens.ts diff --git a/goofy-client/libs/postfach-shared/src/index.ts b/goofy-client/libs/postfach-shared/src/index.ts index 1771d50b4d..68b5a581b6 100644 --- a/goofy-client/libs/postfach-shared/src/index.ts +++ b/goofy-client/libs/postfach-shared/src/index.ts @@ -3,4 +3,5 @@ export * from './lib/postfach.facade'; export * from './lib/postfach.linkrel'; export * from './lib/postfach.model'; export * from './lib/postfach.service'; +export * from './lib/postfach.tokens'; export * from './lib/postfach.util'; diff --git a/goofy-client/libs/postfach-shared/src/lib/postfach.tokens.ts b/goofy-client/libs/postfach-shared/src/lib/postfach.tokens.ts new file mode 100644 index 0000000000..e25d44638e --- /dev/null +++ b/goofy-client/libs/postfach-shared/src/lib/postfach.tokens.ts @@ -0,0 +1,3 @@ +import { InjectionToken } from '@angular/core'; + +export const ON_PAGE = new InjectionToken<boolean>('ON_PAGE'); \ No newline at end of file diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list-container.component.ts b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list-container.component.ts index 261a1609d5..bb58842880 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list-container.component.ts +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list-container.component.ts @@ -1,5 +1,5 @@ import { Component, Input, OnChanges } from '@angular/core'; -import { PostfachMailListResource, PostfachMailResource, PostfachService } from '@goofy-client/postfach-shared'; +import { ON_PAGE, PostfachMailListResource, PostfachService } from '@goofy-client/postfach-shared'; import { StateResource } from '@goofy-client/tech-shared'; import { VorgangWithEingangResource } from '@goofy-client/vorgang-shared'; import { isNull } from 'lodash-es'; @@ -8,7 +8,8 @@ import { Observable } from 'rxjs'; @Component({ selector: 'goofy-client-postfach-mail-list-container', templateUrl: './postfach-mail-list-container.component.html', - styleUrls: ['./postfach-mail-list-container.component.scss'] + styleUrls: ['./postfach-mail-list-container.component.scss'], + providers: [{ provide: ON_PAGE, useValue: false }] }) export class PostfachMailListContainerComponent implements OnChanges { diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.html b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.html index c4a3e458ec..7ce109e37c 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.html +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.html @@ -1,6 +1,8 @@ <goofy-client-incomming-mail *ngIf="isIncomingMail" [postfachMail]="postfachMail"></goofy-client-incomming-mail> <goofy-client-outgoing-mail *ngIf="!isIncomingMail" [postfachMail]="postfachMail"></goofy-client-outgoing-mail> -<goofy-client-postfach-nachricht-attachments *ngIf="postfachMail | hasLink: postfachNachrichtLinkRel.ATTACHMENTS" data-test-id="postfach-nachricht-attachments-container" - [postfachNachricht]="postfachMail"> -</goofy-client-postfach-nachricht-attachments> \ No newline at end of file +<ng-container *ngIf="onPage"> + <goofy-client-postfach-nachricht-attachments *ngIf="postfachMail | hasLink: postfachNachrichtLinkRel.ATTACHMENTS" data-test-id="postfach-nachricht-attachments-container" + [postfachNachricht]="postfachMail"> + </goofy-client-postfach-nachricht-attachments> +</ng-container> \ No newline at end of file diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.spec.ts b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.spec.ts index 42f95adf68..4581cbc017 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.spec.ts +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.spec.ts @@ -1,5 +1,5 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { PostfachMailLinkRel } from '@goofy-client/postfach-shared'; +import { ON_PAGE, PostfachMailLinkRel } from '@goofy-client/postfach-shared'; import { HasLinkPipe } from '@goofy-client/tech-shared'; import { getElementFromFixture } from '@goofy-client/test-utils'; import { createPostfachMailResource } from 'libs/postfach-shared/test/postfach'; @@ -23,6 +23,12 @@ describe('PostfachMailComponent', () => { MockComponent(IncommingMailComponent), MockComponent(OutgoingMailComponent), MockComponent(PostfachNachrichtAttachmentsComponent) + ], + providers: [ + { + provide: ON_PAGE, + useValue: true + } ] }).compileComponents(); }); diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.ts b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.ts index eb1a68b3d0..c8746cb78c 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.ts +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.ts @@ -1,5 +1,5 @@ -import { Component, Input } from '@angular/core'; -import { isIncomingMail, PostfachMailLinkRel, PostfachMailResource } from '@goofy-client/postfach-shared'; +import { Component, Inject, Input } from '@angular/core'; +import { isIncomingMail, ON_PAGE, PostfachMailLinkRel, PostfachMailResource } from '@goofy-client/postfach-shared'; @Component({ selector: 'goofy-client-postfach-mail', @@ -12,6 +12,8 @@ export class PostfachMailComponent { readonly postfachNachrichtLinkRel = PostfachMailLinkRel; + constructor(@Inject(ON_PAGE) public onPage: boolean) { } + get isIncomingMail(): boolean { return isIncomingMail(this.postfachMail); } diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-nachricht-attachments/postfach-nachricht-attachments.component.html b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-nachricht-attachments/postfach-nachricht-attachments.component.html index 75ca2304cd..bb1c5a6c42 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-nachricht-attachments/postfach-nachricht-attachments.component.html +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-nachricht-attachments/postfach-nachricht-attachments.component.html @@ -6,4 +6,4 @@ </goofy-client-ozg-file-container> </div> </goofy-client-spinner> -</ng-container> +</ng-container> \ No newline at end of file diff --git a/goofy-client/libs/postfach/src/lib/postfach-page-container/postfach-page-container.component.ts b/goofy-client/libs/postfach/src/lib/postfach-page-container/postfach-page-container.component.ts index a78652d551..65ba0830c4 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-page-container/postfach-page-container.component.ts +++ b/goofy-client/libs/postfach/src/lib/postfach-page-container/postfach-page-container.component.ts @@ -1,12 +1,14 @@ import { Component, OnInit } from '@angular/core'; -import { PostfachMailListResource, PostfachService } from '@goofy-client/postfach-shared'; +import { ON_PAGE, PostfachMailListResource, PostfachService } from '@goofy-client/postfach-shared'; import { StateResource } from '@goofy-client/tech-shared'; import { Observable } from 'rxjs'; @Component({ selector: 'goofy-client-postfach-page-container', templateUrl: './postfach-page-container.component.html', - styleUrls: ['./postfach-page-container.component.scss'] + styleUrls: ['./postfach-page-container.component.scss'], + providers: [{ provide: ON_PAGE, useValue: true } + ] }) export class PostfachPageContainerComponent implements OnInit { diff --git a/goofy-client/libs/postfach/src/lib/postfach.module.ts b/goofy-client/libs/postfach/src/lib/postfach.module.ts index e026b01fde..ba6f00774c 100644 --- a/goofy-client/libs/postfach/src/lib/postfach.module.ts +++ b/goofy-client/libs/postfach/src/lib/postfach.module.ts @@ -2,7 +2,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { OzgFileModule } from '@goofy-client/ozg-file'; -import { PostfachSharedModule } from '@goofy-client/postfach-shared'; +import { ON_PAGE, PostfachSharedModule } from '@goofy-client/postfach-shared'; import { UiModule } from '@goofy-client/ui'; import { UserProfileModule } from '@goofy-client/user-profile'; import { VorgangSharedModule } from '@goofy-client/vorgang-shared'; @@ -61,6 +61,12 @@ const routes: Routes = [ PostfachMailListContainerComponent, PostfachMailButtonContainerComponent, PostfachMailFormComponent + ], + providers: [ + { + provide: ON_PAGE, + useValue: undefined + } ] }) export class PostfachModule { } -- GitLab